Difference between revisions of "Documentation/Nightly/Developers/Tutorials/BundleModulesIntoExtension"
m |
m |
||
Line 239: | Line 239: | ||
* [http://www.slicer.org/slicerWiki/images/a/a1/AHM-2011-SlicerExtensions-final.ppt AHM 2011 SlicerExtensions presentation] | * [http://www.slicer.org/slicerWiki/images/a/a1/AHM-2011-SlicerExtensions-final.ppt AHM 2011 SlicerExtensions presentation] | ||
+ | |||
+ | {{:Documentation/{{documentation/version}}/FAQ/Extensions|Extensions}} | ||
{{:Documentation/{{documentation/version}}/Developers/FAQ/Extensions|Extensions}} | {{:Documentation/{{documentation/version}}/Developers/FAQ/Extensions|Extensions}} |
Revision as of 22:33, 20 February 2013
Home < Documentation < Nightly < Developers < Tutorials < BundleModulesIntoExtensionContents
Overview
Extensions are packaged against a specific version of Slicer, to be distributed and available for a revision X of Slicer, extensions have to be build against that same revision of Slicer. Otherwise, an extension will be considered as incompatible.
CMake variables
In case an extension is expected to bundle more than one module, the following CMake variables could be defined:
List of partially supported CMake variables:
CMake variable | Description |
---|---|
EXTENSION_STATUS
|
Give people an idea what to expect from this code |
Project layout
The code should be organized as illustrated below:
MyExtension <- - - - - - - - - - - - - - - - - - - - - - Top-level folder of the extension project | |-- CMakeLists.txt | |-- MyExtension.png | |-- MyCLIModule | | | |-- CMakeLists.txt | | | |-- MyCLIModule.cxx | | | |-- MyCLIModule.xml . . . . | |-- MyLoadableModule | |-- CMakeLists.txt | |-- qSlicerMyLoadableModuleModule.cxx | |-- qSlicerMyLoadableModuleModule.h . .
Top-level CMakeLists.txt
The top-level CMakeLists.txt
could be organized as reported below:
cmake_minimum_required(VERSION 2.8.9) #----------------------------------------------------------------------------- if(NOT Slicer_SOURCE_DIR) <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EXTENSION SPECIFIC set(EXTENSION_NAME MyExtension) <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EXTENSION SPECIFIC set(EXTENSION_HOMEPAGE "http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Extensions/${EXTENSION_NAME}") <- - - - EXTENSION SPECIFIC set(EXTENSION_CATEGORY "Examples") <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EXTENSION SPECIFIC set(EXTENSION_CONTRIBUTORS "Jean-Christophe Fillion-Robin (Kitware)") <- - - - - - - - - - - - - - - - - - - - - - - - - - - EXTENSION SPECIFIC set(EXTENSION_DESCRIPTION "This is an example of extension bundling a CLI, a loadable and a scripted module") <- - - - - - - EXTENSION SPECIFIC set(EXTENSION_ICONURL "http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/Extensions/Testing/LoadableExtensionTemplate/Resources/Icons/LoadableExtensionTemplate.png?revision=19437&view=co") endif() <- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EXTENSION SPECIFIC #----------------------------------------------------------------------------- if(NOT Slicer_SOURCE_DIR) find_package(Slicer REQUIRED) include(${Slicer_USE_FILE}) endif() #----------------------------------------------------------------------------- add_subdirectory(MyCLIModule) add_subdirectory(MyLoadableModule) [...] #----------------------------------------------------------------------------- if(NOT Slicer_SOURCE_DIR) <- - - - - - - - - - - EXTENSION SPECIFIC include(${Slicer_EXTENSION_CPACK}) <- - - - - EXTENSION SPECIFIC endif() <- - - - - - - - - - - - - - - - - - - - EXTENSION SPECIFIC
Possible tweak of Module level CMakeLists.txt
During the development process, it could be useful to be able to build each module against a given slicer build tree without having to build the complete extensions, to do so the CMakeLists.txt
of each module could include find_package(Slicer REQUIRED)
.
For example, the CMakeLists.txt
of MyCLIModule
module that would be bundled into MyExtension
could include the following code:
cmake_minimum_required(VERSION 2.8.9) #----------------------------------------------------------------------------- set(MODULE_NAME MyCLIModule) # Do not use 'project()' #----------------------------------------------------------------------------- if(NOT Slicer_SOURCE_DIR) find_package(Slicer REQUIRED) include(${Slicer_USE_FILE}) endif() [...]
Additional documentation