2 #! Create a Command Line App. 4 #! \brief This function will create a command line executable and the scripts required to run it 6 #! \param NAME (required) Name of the algorithm / cmake target 7 #! \param DEPENDS (optional) Required MITK modules beyond MitkCommandLine 8 #! \param PACKAGE_DEPENDS (optional) list of "packages" this command line app depends on (e.g. ITK, VTK, etc.) 9 #! \param CPP_FILES (optional) list of cpp files, if it is not given NAME.cpp is assumed 10 #! \param INCLUDE_DIRS (optional): All directories that should be added as include dirs to the project 11 #! \param PROFILE (optional): The profile file that should be used for the algorithm. If not set it is "./<algname>.profile". 12 #! \param NO_PROFILE_GEN (optional): Flag. If set no profile resource will be generated. 13 #! \param ADDITIONAL_LIBS (optional) List of additional private libraries linked to this module. 14 #! The folder containing the library will be added to the global list of library search paths. 15 #! \param H_FILES (optional) List of public header files for this module. 16 #! Assuming that there exists a file called <code>MyApp.cpp</code>, an example call looks like: 18 #! mitkFunctionCreateCommandLineApp( 20 #! DEPENDS MitkCore MitkPlanarFigure 21 #! PACKAGE_DEPENDS ITK VTK 29 NAME # Name of the algorithm/target
30 PROFILE # Profile of the algorithm that should be used
33 set(_function_multiparams
34 DEPENDS # list of modules
this command
line app depends on
35 PACKAGE_DEPENDS # list of
"packages" this command
line app depends on (e.g. ITK, VTK, etc.)
36 CPP_FILES
# (optional) list of cpp files, if it is not given NAME.cpp is assumed 37 INCLUDE_DIRS # include directories: [PUBLIC|PRIVATE|INTERFACE] <list>
38 ADDITIONAL_LIBS # list of addidtional
private libraries linked to
this module.
39 H_FILES # list of header files: [PUBLIC|PRIVATE] <list>
43 NO_PROFILE_GEN #Flag that indicates that no profile resource should be generated.
46 cmake_parse_arguments(ALG
"${_function_options}" "${_function_params}" "${_function_multiparams}" ${ARGN})
48 if( NOT (DEFINED MITK_USE_MatchPoint) OR NOT (${MITK_USE_MatchPoint}))
49 message(FATAL_ERROR "Need package Matchpoint to deploy MatchPoint Algorithms.")
53 message(FATAL_ERROR "
NAME argument cannot be empty.")
56 SET(ALG_TARGET "MDRA_${ALG_NAME}
") 59 set(ALG_CPP_FILES "${ALG_NAME}.cpp
") 63 set(ALG_PROFILE "${ALG_NAME}.profile
") 64 ENDIF(NOT ALG_PROFILE) 66 IF(NOT ALG_NO_PROFILE_GEN) 67 MESSAGE(STATUS "... generate MDRA profile
for ${ALG_NAME} (from ${ALG_PROFILE})...
") 69 include(${MatchPoint_SOURCE_DIR}/CMake/mapFunctionCreateAlgorithmProfile.cmake) 70 CREATE_ALGORITHM_PROFILE(${ALG_NAME} ${ALG_PROFILE}) 72 MESSAGE(STATUS "... algorithm UID: ${ALGORITHM_PROFILE_UID}
") 73 ENDIF(NOT ALG_NO_PROFILE_GEN) 75 MESSAGE(STATUS "... deploy MDRA algorithm ${ALG_NAME}...
") 76 ADD_LIBRARY(${ALG_TARGET} SHARED ${ALG_CPP_FILES} ${ALGORITHM_PROFILE_FILE}) 78 SET_TARGET_PROPERTIES(${ALG_TARGET} PROPERTIES 79 OUTPUT_NAME "mdra-${MatchPoint_VERSION_MAJOR}-${MatchPoint_VERSION_MINOR}_${ALG_NAME}
" 80 OUTPUT_NAME_DEBUG "mdra-D-${MatchPoint_VERSION_MAJOR}-${MatchPoint_VERSION_MINOR}_${ALG_NAME}
" 82 FOLDER "${MITK_ROOT_FOLDER}/Modules/MatchPointAlgorithms
") 84 mitk_use_modules(TARGET ${ALG_TARGET} 85 MODULES ${ALG_DEPENDS} 86 PACKAGES PRIVATE ITK MatchPoint ${ALG_PACKAGE_DEPENDS} 89 target_include_directories(${ALG_TARGET} PRIVATE ${ALG_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) 91 if(ALG_ADDITIONAL_LIBS) 92 target_link_libraries(${ALG_TARGET} PRIVATE ${ALG_ADDITIONAL_LIBS}) 93 get_property(_mitk_additional_library_search_paths GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS) 94 foreach(_lib_filepath ${ALG_ADDITIONAL_LIBS}) 95 get_filename_component(_search_path "${_lib_filepath}
" PATH) 97 list(APPEND _mitk_additional_library_search_paths "${_search_path}
") 100 if(_mitk_additional_library_search_paths) 101 list(REMOVE_DUPLICATES _mitk_additional_library_search_paths) 102 set_property(GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS ${_mitk_additional_library_search_paths}) 106 MITK_INSTALL(TARGETS ${ALG_TARGET})
mitkFunctionCreateMatchPointDeployedAlgorithm()
This function will create a command line executable and the scripts required to run it...