Unable to include qSlicerSegmentationsEditorEffects when building extension

Hi, I’m trying to implement an editor effect as part of an extension. I’m having issues with accessing files from the qSlicerSegmentationsEditorEffects directory by declaring it in MODULE_INCLUDE_DIRECTORIES like so: ${qSlicerSegmentationsEditorEffects_INCLUDE_DIRS} which I have seen this done in the segmentations module. However the directory was not accessible after cmake has configured and generated successfully. I tried declaring ${qSlicerSegmentationsModules_INCLUDE_DIRS}\EditorEffects instead, but this only allowed me to access files in Slicer’s build directory not the source directory. What can I do to fix that?

Thanks in advance.

I managed to include \EditorEffects of the Slicer’s source directory in my build by doing this:

list(GET qSlicerSegmentationsModule_INCLUDE_DIRS 0 qSegmentationSource_DIR)
set(MODULE_INCLUDE_DIRECTORIES
  ${qSegmentationSource_DIR}/EditorEffects
}

However is there a preferred way to achieve this? Should I be referencing the EditorEffects API when I create a loadable editor effect?

You can print all CMake variables to see what variables you can use to specify the include directory.

Thanks for the reply. Following the instructions from your link I didn’t see a variable available for the editor effect directory specifically, which is why I was unsure if the qSlicerSegmentationsEditorEffects API was made “private” by design. Could you please confirm that it’s ok to reference the API the way I described in my previous post?

The API is not private, you can make your effects based on existing C++ classes. If you can send a link to your source code then we can have a look at it and suggest how to make CMake work (and maybe expose more directories as CMake variables from Slicer).

Sounds good! Here’s the CMakeList of the effect module(WIP):
https://bitbucket.org/OrthopaedicBiomechanicsLab/slicersegmenteditorfastlogicaleffect/src/master/SegmentEditorFastLogical/CMakeLists.txt

Thank you, this helped. I have a potential fix, but @jcfr has to review first.

1 Like