I built a Slicer from source and some extension modules. I have the following:
[tb571@pnl-z840-2 Slicer]$ ls build/Slicer-build/Slicer
build/Slicer-build/Slicer
[tb571@pnl-z840-2 SlicerExtensionsBuild]$ ls *-build/SlicerWith*
MarkupsToModel-build/SlicerWithMarkupsToModel
MarkupsToModel-build/SlicerWithMarkupsToModelLauncherSettings.ini
SegmentEditorExtraEffects-build/SlicerWithSegmentEditorExtraEffects
SegmentEditorExtraEffects-build/SlicerWithSegmentEditorExtraEffectsLauncherSettings.ini
SlicerFreeSurfer-build/SlicerWithSlicerFreeSurfer
SlicerFreeSurfer-build/SlicerWithSlicerFreeSurferLauncherSettings.ini
UKFTractography-build/SlicerWithUKFTractography
UKFTractography-build/SlicerWithUKFTractographyLauncherSettings.ini
Now how do I launch a Slicer knowledgeable of all the extension modules? In contrast, when I download a Slicer, it populated ~/.config/NA-MIC/Extension-28257.ini that had knowledge of all the downloaded modules.
I find it easiest to just make a shell script that combines the extension builds and scripted modules I need and then I just customize it to add or remove things based on what Iβm working on at the moment.
#!/bin/zsh
# run this from within build tree
LIB_PATH=$(pwd)/inner-build/lib/Slicer-4.13
SLICER_BUILD=/opt/sr/Slicer-build
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk ${SLICER_BUILD}/Slicer $* \
--additional-module-paths \
${LIB_PATH}/cli-modules ${LIB_PATH}/qt-loadable-modules ${LIB_PATH}/qt-scripted-modules \
|& tee /tmp/log
So do I get that the above has to be repeated for all extension builds I need? For what itβs worth, inner-build directory exists for SlicerDMRI only. The rest of the modules I attached above follow <name>-build/lib/Slicer-4.13 pattern.
Yes, if you go with the script approach you just set the appropriate lib dir as a variable and then duplicate the lines that add the three paths as needed.
Extensions that provide additional shared libraries may need not just the module libraries but also additional folders in LibraryPath, Path, and PYTHONPATH. These are listed in the automatically generated AdditionalLauncherSettings.ini file in the extensionβs build folder and can be used to launch Slicer with the extension (convenient for debugging and testing). However, if you add multiple extensions then you have other options:
Option A: combine content of AdditionalLauncherSettings.ini files of all the extensions that you use, and use that as additional launcher settings for starting Slicer
Option B: package each extension and install the extension from file using Slicerβs Extensions Manager.
For development (when you often make small changes to the code and rebuild and run) option A typically works better, while for a custom Slicer setup options B and C may be better, as they robust and fully automatic (no need for manual merging of path lists).
You can also just copy extension files into bin and module folders in the Slicer install tree. There will be an even cleaner solution (where you can copy the extension package contents into a single subfolder in the Slicer install tree and all settings in that subfolder, too), which requires merging of this PR (will happen soon).