Skip to content

COMP: Support building extension with specific module bundles #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nhjohnston
Copy link

This is helpful in the context of a Slicer custom application, where it is desired to include a subset of the SlicerSandbox experimental modules to avoid the unnecessary loading of bundled modules, which may be problematic.

This is helpful in the context of a Slicer custom application where it is
desired to include a subset of the SlicerSandbox experimental modules to
avoid unnecessary loading of bundled modules which may be problematic.
@jamesobutler
Copy link

cc: @lassoan, we are going to be bundling the LineProfile module. Additionally we could discuss what changes may be necessary to move this module into its own extension or into Slicer core. As a pretty basic feature there probably isn't a whole lot involved to make it no longer "Experimental" for the Sandbox extension.

@lassoan
Copy link
Contributor

lassoan commented May 16, 2025

We can use the SlicerCheckModuleEnabled function to include/exclude modules, see:

https://github.com/Slicer/Slicer/blob/main/Modules/Scripted/CMakeLists.txt#L33

Additionally we could discuss what changes may be necessary to move this module into its own extension or into Slicer core. As a pretty basic feature there probably isn't a whole lot involved to make it no longer "Experimental" for the Sandbox extension.

I agree, it would be great to move this module into Slicer core. For this, it would be nice if the module used the latest module template, parameter node, and Qt designer for GUI.

@jamesobutler
Copy link

Ah I had interpreted https://github.com/KitwareMedical/SlicerCustomAppTemplate/blob/c2abc0ce3eeea2b5d59239cdf38da4a64bac0b90/%7B%7Bcookiecutter.project_name%7D%7D/CMakeLists.txt#L121-L137 as being include/exclude for only the Slicer core built-in modules, but will try specifying modules from remote extensions that are being bundled into the custom app.

I agree, it would be great to move this module into Slicer core. For this, it would be nice if the module used the latest module template, parameter node, and Qt designer for GUI.

Sounds good. We can aim to provide this update into Slicer core.

@lassoan
Copy link
Contributor

lassoan commented May 16, 2025

Ah I had interpreted https://github.com/KitwareMedical/SlicerCustomAppTemplate/blob/c2abc0ce3eeea2b5d59239cdf38da4a64bac0b90/%7B%7Bcookiecutter.project_name%7D%7D/CMakeLists.txt#L121-L137 as being include/exclude for only the Slicer core built-in modules, but will try specifying modules from remote extensions that are being bundled into the custom app.

You are right, the macros in SlicerCheckModuleEnabled.cmake are specific to Slicer built-in modules. However, the _slicer_is_module_enabled function is generic and can be used in extensions. For example, something like this could work in this extension:

include(SlicerCheckModuleEnabled)

foreach(module ${modules})
  _slicer_is_module_enabled("Sandbox_QTSCRIPTEDMODULES" ${module} _build_module)
  if(_build_module)
    add_subdirectory(${module})
  endif()
endforeach()

The _slicer_is_module_enabled is less than 20 lines of code, so it would not be a problem to duplicate it in each extension where selection of modules are needed, but it is a bit nicer and more consistent if we reuse this existing function.

@nhjohnston
Copy link
Author

PR to move the Line Profile module to Slicer core issued Slicer/Slicer#8435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants