Computer Assited Medical Intervention Tool Kit  version 5.0
+ Collaboration diagram for camitk:

Modules

 cdash
 
 packaging
 
 test
 

Functions

 camitk_add_subdirectory ()
 
 camitk_application ()
 
 camitk_extension ()
 
 camitk_extension_project ()
 
 camitk_install_all_headers ()
 
 camitk_library ()
 
 camitk_translate ()
 

Detailed Description

The CMake macros especially defined to configure CMake projects using CamiTK.

Function Documentation

◆ camitk_add_subdirectory()

camitk_add_subdirectory ( )

camitk_add_subdirectory is a utility macro that add a source subdirectory only if:

  1. it exists
  2. it contains a CMakeLists This can avoid CMake warning (see cmake –help-policy CMP0014), but do the opposite: it prints out an information message when it succeed including the directory.

Usage:

Parameters
subdir(required) the name of the source subdirectory to include

◆ camitk_application()

camitk_application ( )

macro camitk_application simplify writing a CMakeLists.txt for CamiTK application extension

Note
After the execution of this macro, the variable APPLICATION_TARGET_NAME holds the name of the CMake target produced by this macro. The target name itself is equals to camitk-name, where name is the name of the current folder in lowercase.

On Unix additional system resources can also be automatically installed or configured: man pages, desktop file and XPM icons.

To write a simple man page, please refer to SDK application examples. If you need to generate a simple manpage or analyze the command line arguments, the CamiTK team recommands to use Code Synthesis CLI configuration (see http://codesynthesis.com/projects/cli)

usage:

[DISABLED]
[NO_GUI]
[NEEDS_ITK]
[NEEDS_PYTHON]
[NEEDS_CEP_LIBRARIES CEPLib1 CEPLib12 ...]
[NEEDS_COMPONENT_EXTENSION component1 component2 ...]
[NEEDS_ACTION_EXTENSION ation1 action2 ...]
[NEEDS_VIEWER_EXTENSION viewer1 viewer2 ...]
[DEFINES flag1 flag2 ...]
[CXX_FLAGS flag1 flag2 ...]
[ADDITIONAL_SOURCES source.cxx source.cpp ...]
[INCLUDE_DIRECTORIES dir1 dir2 ...]
[EXTERNAL_LIBRARIES lib1 lib2 ...]
[EXTRA_TRANSLATE_LANGUAGE]
)
Parameters
DISABLEDmeans this is a default application is NOT to be compiled automatically
NO_GUImeans this application doesn't require a GUI and it will be compile to be ran into a console mode
NEEDS_ITKmeans this application requires ITK to be compiled / run.
NEEDS_CEP_LIBRARIESlist of needed camitk CEP libraries
NEEDS_COMPONENT_EXTENSIONlist of needed component extensions
NEEDS_ACTION_EXTENSIONlist of needed action extensions
NEEDS_VIEWER_EXTENSIONlist of needed viewer extensions
DEFINESlist of define flags to add at compilation time
CXX_FLAGSlist of compiler flags to add (such as warning levels (-Wall ...)).
ADDITIONAL_SOURCESlist of additional sources (that cannot be automatically found by gather_headers_and_sources macro)
CEP_NAMEspecify the CEP_NAME, which is used to categorized the application for packaging purpose No CEP_NAME provided will result in default categorization (generic application).
DESCRIPTIONSimple description of the application. Used for packaging presentation for instance.
INCLUDE_DIRECTORIESadditional include directories
EXTERNAL_LIBRARIESexternal libraries to add to the link command
EXTRA_TRANSLATE_LANGUAGEAdditionnal extra language to translate the application

◆ camitk_extension()

camitk_extension ( )

Macro camitk_extension simplifies writing a camitk extension (component, action, viewer)

The name of the extension is automatically the name of the directory from where this macro is called, unless it is overriden by the TARGET_NAME parameter.

Note
To be more precise, after the execution of this macro, the variable type_TARGET_NAME (i.e., ACTION_TARGET_NAME, COMPONENT_TARGET_NAME, or VIEWER_TARGET_NAME) holds the name of the CMake target produced by this macro. The target name itself is equal to either action-name, component-name or viewer-name (depending on the type of the extension), where name is the name of the current folder in lowercase, unless TARGET_NAME is provided On windows, the - (dash) is replaced by _ (underscore)

usage:

[DISABLED]
[NEEDS_ITK]
[NEEDS_LIBXML2]
[NEEDS_OPENCV]
[NEEDS_IGSTK]
[NEEDS_XSD]
[NEEDS_GDCM]
[NEEDS_ACTION_EXTENSION action1 action2 ...]
[NEEDS_VIEWER_EXTENSION viewer1 viewer2 ...]
[NEEDS_COMPONENT_EXTENSION component1 component2 ...]
[NEEDS_CEP_LIBRARIES CEPLib1 CEPLib2 ...]
[INCLUDE_DIRECTORIES dir1 dir2 ...]
[DEFINES flag1 flag2 ...]
[CXX_FLAGS flag1 flag2 ...]
[EXTERNAL_SOURCES file1 file2 ...]
[EXTERNAL_LIBRARIES lib1 lib2 ...]
[HEADERS_TO_INSTALL header1.h header2.h ...]
[INSTALL_ALL_HEADERS]
[TARGET_NAME non-default-targetname]
[DESCRIPTION description]
[EXTRA_TRANSLATE_LANGUAGE]
[ENABLE_AUTO_TEST]
[TEST_FILES file1 file2 ...]
[AUTO_TEST_LEVEL 1]
[AUTO_TEST_LEVEL 2]
[ENABLE_INTEGRATION_TEST]
)
Parameters
<type>REQUIRED. The selected type of extension you wish to build. possible values : ACTION_EXTENSION, COMPONENT_EXTENSION or VIEWER_EXTENSION.
DISABLEDmeans this is a not a default extension, it will not be compiled automatically
NEEDS_ITKadd this if your extension needs ITK. Do not forget to add the needed list of ITK libraries in the LIBRARIES parameter
NEEDS_LIBXML2add this if your extension needs libxml2
NEEDS_XSDadd this if your extension needs Codesynthesis xsd cxx (xml schema compiler)
NEEDS_OPENCVadd this if your extension needs OpenCV
NEEDS_IGSTKadd this if your extension needs IgsTK
NEEDS_XERCESCadd this if your extension needs XercesC library
NEEDS_GDCMAdd this if your extension requires GDCM library
NEEDS_CEP_LIBRARIESlist of needed CEP libraries (not external dependencies)
NEEDS_COMPONENT_EXTENSIONlist of needed component extensions
NEEDS_ACTION_EXTENSIONlist of needed action extensions
NEEDS_VIEWER_EXTENSIONlist of needed viewer extensions
INCLUDE_DIRECTORIESadditional include directories
DEFINESlist of define flags to add at compilation time.
CXX_FLAGSlist of compiler flags to add (such as warning levels (-Wall ...)).
EXTERNAL_SOURCESlist of extra source/headers files (external to the current directory) that needed to be added to the SOURCES variable. Note: EXTERNAL_SOURCES are not installed
EXTERNAL_LIBRARIESexternal libraries to add to the link command
HEADERS_TO_INSTALLlist of headers to install, if present this will automatically create an "install-EXTENSION_NAME" target, that can be used anywhere else to manage dependencies to this extension. The headers are installed ${CAMITK_BUILD_INCLUDE_DIR}/EXTENSION_TYPE/EXTENSION_NAME when the target "install-EXTENSION_NAME" is called.
INSTALL_ALL_HEADERSinstall all of the headers (this is the lazy solution, please consider making a list and using HEADERS_TO_INSTALL parameter instead. Only the files matching the regex *.h will be install. If you need to add other files, you need to use the HEADERS_TO_INSTALL option.
TARGET_NAMEspecify a target name different than the default (default is the extension source code directory name) this can be very useful for example when you have an extension source code directory in your CEP that has the same name as one in the camitk community edition.
CEP_NAMEspecify the CEP_NAME, which is used to categorized the extension for packaging purpose No CEP_NAME provided will result in default categorization (generic extension).
DESCRIPTIONSimple description of the extension. Used for packaging presentation for instance.
EXTRA_TRANSLATE_LANGUAGEAdditionnal extra language to translate the application
ENABLE_AUTO_TESTCreate automatic test with either testactions or testcomponents. By default, auto test are run at the highlest level (level 3) unless AUTO_TEST_LEVEL is specified See also TEST_FILES and AUTO_TEST_LEVEL options
TEST_FILESList of files to use for testing. If provided, only the filenames are required (not the absolute paths), each of them should be found in the testdata build dir. If no test files are provided:
  • for component extension auto test: all the files in the component testdata subdir are used by default
  • for action extension auto test: all the files available in the testdata build dir (i.e., all the component testdata) are used by default (which might be too many!).
AUTO_TEST_LEVELi for automatic test of component extensions: set the highest level of automatic test to perform:
  • level 1: load the component extension, open and close a testdata component file
  • level 2: same as level 1, but save the component before closing it.
  • level 3 (default): same as level 2, but also compare the saved component to the input.
ENABLE_INTEGRATION_TESTadd a specific integration test (see camitk_add_integration_test) CamiTK CMake macro. Since CamiTK 4.1 It does add an integration test using the action-state-machine to process a chain of actions (requires that subdirectory integration-testdata exists, and contains a file called "asm-input.scxml" and at least one file name "output-*.*") Check the wiki for more information about integration test

◆ camitk_extension_project()

camitk_extension_project ( )

macro camitk_extension_project creates an optional (disabled by default) CEP (CamiTK Extension Project) subdirectory the build.

Usage:

[ENABLED]
[NAME cepName]
[DESCRIPTION longDescription]
[DEFAULT_APPLICATION exeName]
[NEEDS_CEP cep1 cep2...]
[LICENSE licenseName]
[ENABLE_TESTING]
[ENABLE_TEST_COVERAGE]
)
Parameters
CONTACTMandatory, this is the person(s) to contact to get more information about the CEP
ENABLEDIf used, this CEP is forced by default (otherwise the user as to tick the option in CMake GUI or defined a -DCEP_<cepName>:BOOL=TRUE on the command line
NAMEBy default the name of a CEP is given automatically by the name of the top level source directory If you specify a name here, the directory name will be ignored
DESCRIPTIONA (not so) small description of this CEP (objective, content, implementation information)
DEFAULT_APPLICATIONThe default application to run (for MSVC launchers), default is camitk-imp
LICENSEThe name of the license for this CEP, default is LGPL-v3
ENABLE_TESTINGEnable the testing framework ("make test" will run all the test)
ENABLE_TEST_COVERAGEEnable the test coverage report ("make camitk-ce-test-coverage" will run all the test and generate a report in the camitk-ce-test-coverage subdirectory. Only works with the g++ compiler.
NEEDS_CEP(TODO) Dependencies to other CEP

◆ camitk_install_all_headers()

camitk_install_all_headers ( )

camitk_install_all_headers is a macro that install all header files of a project at build and install time

Duplicate headers installation:

  • one is used at compiled time and puts everything in ${CMAKE_BINARY_DIR}/include/${CAMITK_SHORT_VERSION_STRING}/${GroupName}/${ComponentName}/...
  • the other one is used at installation time and puts everything in ${CMAKE_INSTALL_PREFIX}/include/${CAMITK_SHORT_VERSION_STRING}/${GroupName}/${ComponentName}/...

This macro keeps header files directories tree structure at installation. In other words, if your extension has its header files located in subdirectories, this tree structure will be kept the same at installation.

Note that only file matching regex "*.h" in the source dir and subdir are considered headers. If you need to add other files, you need to use the HEADERS_TO_INSTALL option.

Usage:

camitk_install_all_headers( COMPONENT ComponentName
[GROUP GroupName]
)
Parameters
COMPONENT(required) Name of the component to use. This is also the include subdirectory name used for copying the file
GROUP(optional) Name of the group this install should be using group will be prepend to the component name. This is either actions, components, viewers or libraries.

Example invocation:

#--------------
# installation
#--------------
camitk_install_headers( COMPONENT ${MYPROJECT_NAME}
GROUP libraries
)

Here, in this example, we will install all the header files, in the ${CAMITK_INCLUDE_DIR}/include/libraries/${MYPROJECT_NAME} directories (at build and installation times) If my header files are located in some subdirectories, this structure will be kept the same at build and installation times.

◆ camitk_library()

camitk_library ( )

macro camitk_library simplifies the declaration of a library inside CamiTK and is to be used for all inner project libraries

The name of the CEP library is automatically deduced from the name of the directory, unless LIBNAME is provided

Note
To be more precise, after the execution of this macro, the variable LIBRARY_TARGET_NAME holds the name of the CMake target produced by this macro. The target name itself is equals to library-name, wherenameis the name of the current folder in lowercase unlessLIBNAME` is provided.

If the library is compiled as shared, it adds the needed library properties If it needs relocation flag fPIC (on some plateforms), this macro should determine if this is the case and specify this flag.

usage:

SHARED|STATIC
SOURCES source1.cpp source1.h...
[LIBNAME libname]
[PUBLIC]
[NEEDS_CEP_LIBRARIES lib1 lib2...]
[NEEDS_ITK]
[NEEDS_LIBXML2]
[NEEDS_XERCESC]
[NEEDS_XSD]
[NEEDS_QT]
[NEEDS_CAMITKCORE]
[DEFINES flag1 flag2 ...]
[EXTERNAL_LIBRARIES lib1 lib2... ]
[INCLUDE_DIRECTORIES dir1 dir2...]
[LINK_DIRECTORIES dir1 dir2...]
[HEADERS_TO_INSTALL]
[CEP_NAME]
[DESCRIPTION]
[EXTRA_TRANSLATE_LANGUAGE lang1 lang2...]
[CXX_FLAGS flag1 flag2 ...]
)
Parameters
SHAREDoptional, if the library should be compiled as shared
SOURCESall sources to be included in the library
INCLUDE_DIRECTORIESall needed include directories (${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} are automatically added)
EXTERNAL_LIBRARIESall the libraries to be used during the link (shared or static)
NEEDS_CEP_LIBRARIESall the libraries to be used during the link (shared or static)
NEEDS_ITKadd this if your component needs ITK.
NEEDS_LIBXML2add this if the CEP library needs libxml2
NEEDS_XERCESCadd this if your action / component needs XercesC library
NEEDS_XSDadd this if your action needs Codesynthesis xsd cxx (xml schema compiler)
NEEDS_QTadd this if your library depends on Qt 5.x
NEEDS_CAMITKCOREadd this if your library depends on CamiTK
LIBNAMEforce the CEP library name to be different from the directory it is in
LINK_DIRECTORIESadditional directories to use in link_directories(...)
DEFINESlist of define flags to add at compilation time
PUBLICThe library is a public library that has to be loaded directly by the operating system. It is generally only needed for SDK library. A public library should not be installed in the lib/${CAMITK_SHORT_VERSION_STRING} but directly in lib/ (on Unix/MacOS) or bin/ (on windows)
HEADERS_TO_INSTALLlist of header files to install. File would be copied at build and installation time in the ./include/libraries/library-name subdirectory. Note that, if no header files are provided, all header files (*.h) will be install.
CEP_NAMEspecify the CEP_NAME, which is used to categorized the extension for packaging purpose No CEP_NAME provided will result in default categorization (generic extension).
DESCRIPTIONSimple description of the extension. Used for packaging presentation for instance.
EXTRA_TRANSLATE_LANGUAGEAdditionnal extra language to translate the application
CXX_FLAGSlist of compiler flags to add (such as warning levels (-Wall ...)).

References a, endif(), get_directory_name(), if(), include(), and set().

+ Here is the call graph for this function:

◆ camitk_translate()

camitk_translate ( )

macro camitk_translate allows to perform the translation of any project (action, component, application and libraries) in several languages.

usage:

[EXTRA_LANGUAGE lang1 lang2...]
[USE_FLAGS]
)
Parameters
EXTRA_LANGUAGEoptional, allows the translation of this additional language
USE_FLAGSoptional, use the flag directory to associate a flag per language
camitk_add_subdirectory
camitk_add_subdirectory()
Definition: CamiTKAddSubDirectory.h:18
camitk_translate
camitk_translate()
Definition: CamiTKTranslate.h:16
camitk_application
camitk_application()
Definition: CamiTKApplication.h:63
camitk_extension_project
camitk_extension_project()
Definition: CamiTKExtensionProject.h:34
description
const char * description
Definition: applications/cepgenerator/main.cpp:38
camitk_install_all_headers
camitk_install_all_headers()
Definition: CamiTKInstallAllHeaders.h:45
camitk_extension
camitk_extension()
Definition: CamiTKExtension.h:115
camitk_library
camitk_library()
Definition: CamiTKLibrary.h:75