2 #! \brief Create a provisioning file 4 #! \param FILE <provisioning-file> (required) An absolute filename for 5 #! the new provisioning file. 6 #! \param INCLUDE <file-list> (optional) A list of additional provisioning files 7 #! which should be included. 8 #! \param PLUGINS <plugin-list> (optional) A list of target names for which provisioning 9 #! entries should be created. The entries must be valid targets or 10 #! be of the form [subdir/]target_name:OFF (this is the same form as 11 #! passed to the ctkMacroSetupPlugins macro) If the list is empty, 12 #! all known plug-in targets (external or internal) are considered. 13 #! \param EXCLUDE_PLUGINS <plugin-list> (optional) A list of plug-in symbolic names which should be excluded 14 #! from the provisioning entries. 15 #! \param NO_INSTALL (option) Suppress the creation of an additional provisioning file suitable for packaging. 17 #! This function creates a provisioning file which can be used to provision a BlueBerry 18 #! application. The syntax of entries in the file is 20 #! (READ|INSTALL|START) <file-url> 22 #! READ includes the file at <file-url> and interprets it as a provisioning file, INSTALL installs <file-url>, 23 #! and START installs and starts <file-url> as a plug-in in the framework. 26 #! For example the following provisioning file instructs the BlueBerry framework to read the entries in 27 #! a file called SomeApp.provisioning and subsequently INSTALL and START the plug-in com.mycompany.plugin 34 #! An example invocation of this macro may look like: 36 #! set(_my_prov_file "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/MyApp.provisioning") 38 #! com.mycompany.plugin 39 #! org.mitk.gui.qt.extapplication 41 #! FunctionCreateProvisioningFile(FILE ${_my_prov_file} PLUGINS ${_my_plugins}) 44 #! \note This function will automatically create entries for all plug-in 45 #! dependencies of the specified plug-ins. 49 cmake_parse_arguments(_PROV
"NO_INSTALL" "FILE" "INCLUDE;PLUGINS;EXCLUDE_PLUGINS" ${ARGN})
52 message(SEND_ERROR
"FILE argument must not be empty")
64 # Include other provisioning files 65 foreach(incl ${_PROV_INCLUDE})
66 get_filename_component(incl_filename
"${incl}" NAME)
67 set(out_var
"${out_var}READ ${file_url}${incl}\n")
68 set(out_var_install
"${out_var_install}READ ${file_url}@EXECUTABLE_DIR/${incl_filename}\n")
72 set(out_var "${out_var}\n
") 73 set(out_var_install "${out_var_install}\n
") 78 foreach(_plugin ${_PROV_PLUGINS}) 79 string(REPLACE ".
" "_
" _plugin_target ${_plugin}) 80 list(APPEND _plugin_list ${_plugin_target}) 82 # get all plug-in dependencies 83 ctkFunctionGetPluginDependencies(_plugin_deps PLUGINS ${_plugin_list} ALL) 84 # add the dependencies to the list of plug-ins 85 list(APPEND _plugin_list ${_plugin_deps}) 87 # Fill the _plugin_list variable with external and internal plug-in target names. 88 ctkFunctionGetAllPluginTargets(_plugin_list) 92 list(REMOVE_DUPLICATES _plugin_list) 95 set(_exclude_targets ) 96 if(_PROV_EXCLUDE_PLUGINS) 97 # Convert the plug-in symbolic names to valid target names 98 foreach(_exclude_entry ${_PROV_EXCLUDE_PLUGINS}) 99 string(REPLACE ".
" "_
" _exclude_target ${_exclude_entry}) 100 list(APPEND _exclude_targets ${_exclude_target}) 102 list(REMOVE_ITEM _plugin_list ${_exclude_targets}) 105 # Go through the list of plug-ins 106 foreach(plugin ${_plugin_list}) 109 # The entry already is a valid target (either imported or declared in the current project) 110 set(_plugin_target ${plugin}) 111 elseif(${plugin} MATCHES "^[- :/A-Za-z0-9._]+:(ON|OFF)$
") 112 # Check if the entry if of the form "Some/Dir/org.my.plugin:OPTION
" 113 ctkFunctionExtractOptionNameAndValue(${plugin} plugin_name_with_dirs plugin_value) 114 string(REPLACE "/
" ";
" _tokens ${plugin_name_with_dirs}) 115 list(GET _tokens -1 plugin_name) 116 string(REPLACE ".
" "_
" _plugin_target_name ${plugin_name}) 117 if(TARGET ${_plugin_target_name}) 118 # Check if the extracted last directory entry is a valid target 119 set(_plugin_target ${_plugin_target_name}) 124 # We got a valid target, either imported or from this project. 125 set(_plugin_location) 126 get_target_property(_is_imported ${_plugin_target} IMPORTED) 128 get_target_property(_plugin_location ${_plugin_target} IMPORTED_LOCATION) 129 if(NOT _plugin_location) 130 get_target_property(_plugin_configs ${_plugin_target} IMPORTED_CONFIGURATIONS) 131 foreach(_plugin_config ${_plugin_configs}) 132 get_target_property(_plugin_location ${_plugin_target} IMPORTED_LOCATION_${_plugin_config}) 134 if(CMAKE_CONFIGURATION_TYPES) 135 # Strip the last directory and filename 136 string(REGEX REPLACE "(.*)/[^/]*/[^/]*$
" "\\1
" _plugin_location "${_plugin_location}
") 138 # Just strip the filename 139 get_filename_component(_plugin_location "${_plugin_location}
" PATH) 147 get_target_property(_plugin_location ${_plugin_target} RUNTIME_OUTPUT_DIRECTORY) 149 get_target_property(_plugin_location ${_plugin_target} LIBRARY_OUTPUT_DIRECTORY) 153 set(plugin_url "${file_url}${_plugin_location}/lib${_plugin_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
") 154 set(plugin_url_install "${file_url}@EXECUTABLE_DIR/plugins/lib${_plugin_target}${CMAKE_SHARED_LIBRARY_SUFFIX}
") 156 set(out_var "${out_var}START ${plugin_url}\n
") 157 set(out_var_install "${out_var_install}START ${plugin_url_install}\n
") 159 #message(WARNING "Ignoring
unknown plug-
in target \
"${plugin}\" for provisioning.")
164 file(WRITE ${_PROV_FILE}
"${out_var}")
166 if(NOT _PROV_NO_INSTALL)
167 file(WRITE ${_PROV_FILE}.install
"${out_var_install}")
static const unsigned int unknown
Unknown size marker.
mitkFunctionCreateProvisioningFile()
Create a provisioning file.
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)