Difference between revisions of "Documentation/Nightly/Developers/Build Module"
m |
|||
Line 52: | Line 52: | ||
[...] | [...] | ||
</pre> | </pre> | ||
+ | |||
+ | After successfully compiling the Slicer module, the executable will be located in your main Slicer build directory, Slicer-Superbuild/Slicer-build. Refer to http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/DirectoryStructure for the directory structure. | ||
Revision as of 08:05, 4 March 2013
Home < Documentation < Nightly < Developers < Build ModuleBuild module outside of Slicer source tree
The different type of modules supported by Slicer can easily be built outside of the Slicer source tree.
The following examples are specific to unix-like platforms and can easily be adapted for Windows.
Assuming the source code of your module is located in folder MyModule
, externally building modules could be achieved doing:
$ mkdir MyModule-build $ cd MyModule-build $ cmake -DSlicer_DIR:PATH=/path/to/Slicer-Superbuild/Slicer-build ../MyModule $ make
For this to work, in addition to invoke cmake_minimum_required
at the top of the top-level CMakeLists.txt
, it's important to make sure the following line are added after setting MODULE_NAME
:
#----------------------------------------------------------------------------- if(NOT Slicer_SOURCE_DIR) find_package(Slicer REQUIRED) include(${Slicer_USE_FILE}) endif()
For example:
cmake_minimum_required(VERSION 2.8.8) <- - - - ADD THIS #----------------------------------------------------------------------------- set(MODULE_NAME MyModule) set(MODULE_TITLE ${MODULE_NAME}) string(TOUPPER ${MODULE_NAME} MODULE_NAME_UPPER) #----------------------------------------------------------------------------- if(NOT Slicer_SOURCE_DIR) <- - - - - - - - - - ADD THIS find_package(Slicer REQUIRED) <- - - - - - - ADD THIS include(${Slicer_USE_FILE}) <- - - - - - - - ADD THIS endif() #----------------------------------------------------------------------------- add_subdirectory(Logic) #----------------------------------------------------------------------------- set(MODULE_EXPORT_DIRECTIVE "Q_SLICER_QTMODULES_${MODULE_NAME_UPPER}_EXPORT") [...]
After successfully compiling the Slicer module, the executable will be located in your main Slicer build directory, Slicer-Superbuild/Slicer-build. Refer to http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Developers/DirectoryStructure for the directory structure.