Computer Assisted Medical Intervention Tool Kit  version 5.2
CamiTKCEPPackaging.h
Go to the documentation of this file.
1 # \param DESCRIPTION Some comments on what is this CEP package about
30 
31 # CEP Packaging only works for stand-alone CEP
32 if (NOT CAMITK_EXTENSION_PROJECT_SET)
33 
34 set(options "")
35 set(oneValueArgs NAME VENDOR CONTACT DESCRIPTION LICENSE)
36 set(multiValueArgs "")
37 cmake_parse_arguments(CAMITK_CEP_PACKAGING "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
38 
39 
40 # Clean list of targets by removing duplicates
41 # Those may appear if configuring more than once (i.e. by manually clicking more than once on the CMake configure
42 # button before generating
43 list(REMOVE_DUPLICATES CAMITK_ACTION_TARGETS)
44 list(REMOVE_DUPLICATES CAMITK_COMPONENT_TARGETS)
45 list(REMOVE_DUPLICATES CAMITK_CEP_LIBRARY_TARGETS)
46 list(REMOVE_DUPLICATES CAMITK_APPLICATION_TARGETS)
47 list(REMOVE_DUPLICATES CAMITK_VIEWER_TARGETS)
48 
49 # package named
50 if(CAMITK_CEP_PACKAGING_NAME)
51  set(PACKAGING_NAME ${CAMITK_CEP_PACKAGING_NAME})
52 else()
53  # package name is project name
54  set(PACKAGING_NAME ${CMAKE_PROJECT_NAME})
55 endif()
56 
57 # simply name so that the custom target name or file does not contains any space and are all lowercase
58 string(REGEX REPLACE " " "" ESCAPED_PACKAGING_NAME "${PACKAGING_NAME}")
59 string(TOLOWER "${ESCAPED_PACKAGING_NAME}" CPACK_PACKAGE_NAME)
60 
61 # set version number in case cep does not give any values
62 if(CAMITK_CEP_PACKAGING_VERSION_MAJOR)
63  set(CPACK_PACKAGE_VERSION_MAJOR ${CAMITK_CEP_PACKAGING_VERSION_MAJOR})
64 else()
65  set(CPACK_PACKAGE_VERSION_MAJOR ${CAMITK_VERSION_MAJOR})
66 endif()
67 if(CAMITK_CEP_PACKAGING_VERSION_MINOR)
68  set(CPACK_PACKAGE_VERSION_MINOR ${CAMITK_CEP_PACKAGING_VERSION_MINOR})
69 else()
70  set(CPACK_PACKAGE_VERSION_MINOR ${CAMITK_VERSION_MINOR})
71 endif()
72 if(CAMITK_CEP_PACKAGING_VERSION_PATCH)
73  set(CPACK_PACKAGE_VERSION_PATCH ${CAMITK_CEP_PACKAGING_VERSION_PATCH})
74 else()
75  set(CPACK_PACKAGE_VERSION_PATCH ${CAMITK_VERSION_PATCH})
76 endif()
77 
78 # contact information
79 if(CAMITK_CEP_PACKAGING_VENDOR)
80  set(CPACK_PACKAGE_VENDOR ${CAMITK_CEP_PACKAGING_VENDOR})
81 else()
82  set(CPACK_PACKAGE_VENDOR "Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525")
83 endif()
84 if (CAMITK_CEP_PACKAGING_CONTACT)
85  set(CPACK_PACKAGE_CONTACT ${CAMITK_CEP_PACKAGING_CONTACT})
86 else()
87  set(CPACK_PACKAGE_CONTACT "http://camitk.imag.fr")
88 endif()
89 
90 # resource files
91 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/README")
92  set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
93 endif()
94 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
95  set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
96 endif()
97 
98 # applications / executable
99 set(EXECUTABLES_TO_PACKAGE)
100 foreach(APPLICATION_TARGET_NAME ${CAMITK_APPLICATION_TARGETS})
101  # name and label are the same
102  set(EXECUTABLES_TO_PACKAGE ${EXECUTABLES_TO_PACKAGE} ${APPLICATION_TARGET_NAME} ${APPLICATION_TARGET_NAME})
103 endforeach()
104 set(CPACK_PACKAGE_EXECUTABLES ${EXECUTABLES_TO_PACKAGE})
105 
106 # package description
107 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CAMITK_CEP_PACKAGING_DESCRIPTION})
108 
109 # Files to ignore during generation of the package
110 set(CPACK_SOURCE_IGNORE_FILES
111 "~$"
112 "/CVS/"
113 "tags"
114 "/\\\\.svn/"
115 "/\\\\.git/"
116 "/\\\\.kdev4/"
117 "/kdev4$/"
118 "/build/"
119 "\\\\.kdevses$"
120 "\\\\.kdev4$"
121 "\\\\.kdevelop\\\\.pcs$"
122 ".DS_Store"
123 ${CPACK_SOURCE_IGNORE_FILES}
124 )
125 
126 set(CPACK_SOURCE_GENERATOR "TGZ" "ZIP" )
127 
128 # ----------------------------------
129 # Unix packages (Ubuntu and Debian)
130 # ----------------------------------
131 if (UNIX AND NOT WIN32)
132  message(STATUS "Packaging ${CPACK_PACKAGE_NAME} for UNIX systems")
133  # Try to find architecture
134  execute_process(COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
135  string(STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)
136  # Try to find distro name and distro-specific arch
137  execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE LSB_ID)
138  execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE LSB_RELEASE)
139  string(STRIP "${LSB_ID}" LSB_ID)
140  string(STRIP "${LSB_RELEASE}" LSB_RELEASE)
141  set(LSB_DISTRIB "${LSB_ID}${LSB_RELEASE}")
142  if(NOT LSB_DISTRIB)
143  set(LSB_DISTRIB "unix")
144  endif(NOT LSB_DISTRIB)
145  message(STATUS "Packager architecture : ${LSB_DISTRIB}")
146 
147  #Find DPKG
148  find_program(DPKG
149  NAMES dpkg-deb
150  PATHS "/usr/bin" #Add paths here
151  )
152  if ( DPKG )
153  get_filename_component(DPKG_PATH ${DPKG} ABSOLUTE)
154  message(STATUS "Packaging deb using ${DPKG_PATH}: OK")
155  set(DPKG_FOUND "YES")
156  else()
157  set(DPKG_FOUND "NO")
158  endif()
159 
160  # For Debian-based distribs we want to create DEB packages.
161  if("${LSB_DISTRIB}" MATCHES "Ubuntu|Debian")
162 
163  # We need to alter the architecture names as per distro rules
164  if("${CPACK_PACKAGE_ARCHITECTURE}" MATCHES "i[3-6]86")
165  set(CPACK_PACKAGE_ARCHITECTURE i386)
166  endif()
167  if("${CPACK_PACKAGE_ARCHITECTURE}" MATCHES "x86_64")
168  set(CPACK_PACKAGE_ARCHITECTURE amd64)
169  endif()
170  # Set the dependencies based on the distrib version
171 
172  # Installation path
173  # Set the install location to "/usr"
174  # set(CAMITK_INSTALL_ROOT "/usr") # Set the CamiTK install root path in your CMake command line / GUI.
175  set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
176  set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
177  set(CPACK_SET_DESTDIR TRUE)
178 
179  # Dependencies depending on the Operating System.
180  # Ubuntu11.10
181  if("${LSB_DISTRIB}" MATCHES "Ubuntu11.10")
182  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.6-qt4, libxerces-c3.1 ")
183  endif()
184  # For Ubuntu12.04
185  if("${LSB_DISTRIB}" MATCHES "Ubuntu12.04")
186  set(LSB_DISTRIB "Ubuntu12.xx")
187  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.8-qt4, libxerces-c3.1 ")
188  endif()
189  if("${LSB_DISTRIB}" MATCHES "Ubuntu12.04.1")
190  set(LSB_DISTRIB "Ubuntu12.xx")
191  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.8-qt4, libxerces-c3.1 ")
192  endif()
193  # For Ubuntu12.10
194  if("${LSB_DISTRIB}" MATCHES "Ubuntu12.10")
195  set(LSB_DISTRIB "Ubuntu12.xx")
196  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.8-qt4, libxerces-c3.1 ")
197  endif()
198 
199  # TODO Debian dependencies (see CamiTKPackaging.cmake)
200 
201  if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
202  message(STATUS "Packaging for ${LSB_DISTRIB} not supported yet, see CamiTKCEPPackaging.cmake")
203  # if you get this error, you need to set deps in CamiTKCEPPackaging.cmake first
204  endif()
205 
206  endif()
207 endif()
208 
209 
210 
211 if(WIN32 AND NOT UNIX)
212  # -----------------------
213  # NSIS Windows installer
214  # -----------------------
215 
216  # Update package name for windows release
217  set(LSB_DISTRIB "win32")
218  set(CPACK_PACKAGE_ARCHITECTURE i386)
219  string(TOLOWER "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CAMITK_VERSION_NICKNAME}-${LSB_DISTRIB}" CPACK_PACKAGE_FILE_NAME)
220 
221  # Try to find Makensis on Linux distribution
222  find_program(MAKENSIS
223  NAMES makensis
224  PATHS "/usr/bin"
225  )
226 
227  if(MAKENSIS)
228  set(ITK_ROOT_DIR "C:/dev/ITK/3.20.1")
229 
230  # MinGW compiler
231  if ("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles")
232  # NSIS Windows installer
233  message(STATUS "Packaging nsis using ${MAKENSIS} with MinGW compiler")
234  # Qt dependencies
235  set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
236  ##TODO use GetPrerequisites.cmake (i.e. find a better way to list dependencies)
237  ##get_prerequisites() is not well enough documented to justify the time investement - EP May 2011
238  ${QT_BINARY_DIR}/QtCore4.dll
239  ${QT_BINARY_DIR}/QtGui4.dll
240  ${QT_BINARY_DIR}/QtSvg4.dll
241  ${QT_BINARY_DIR}/QtXml4.dll
242  ${QT_BINARY_DIR}/QtNetwork4.dll
243  ${QT_BINARY_DIR}/QtSql4.dll
244  ${QT_BINARY_DIR}/QtWebKit4.dll
245  # VTK dependencies
246  ${VTK_LIBRARY_DIRS}/libQVTK.dll
247  ${VTK_LIBRARY_DIRS}/libvtkCommon.dll
248  ${VTK_LIBRARY_DIRS}/libvtksys.dll
249  ${VTK_LIBRARY_DIRS}/libvtkFiltering.dll
250  ${VTK_LIBRARY_DIRS}/libvtkGraphics.dll
251  ${VTK_LIBRARY_DIRS}/libvtkHybrid.dll
252  ${VTK_LIBRARY_DIRS}/libvtkIO.dll
253  ${VTK_LIBRARY_DIRS}/libvtkImaging.dll
254  ${VTK_LIBRARY_DIRS}/libvtkRendering.dll
255  ${VTK_LIBRARY_DIRS}/libvtkVolumeRendering.dll
256  ${VTK_LIBRARY_DIRS}/libvtkverdict.dll
257  ${VTK_LIBRARY_DIRS}/libvtkDICOMParser.dll
258  ${VTK_LIBRARY_DIRS}/libvtkNetCDF.dll
259  ${VTK_LIBRARY_DIRS}/libvtkNetCDF_cxx.dll
260  ${VTK_LIBRARY_DIRS}/libvtkexpat.dll
261  ${VTK_LIBRARY_DIRS}/libvtkjpeg.dll
262  ${VTK_LIBRARY_DIRS}/libvtkmetaio.dll
263  ${VTK_LIBRARY_DIRS}/libvtkpng.dll
264  ${VTK_LIBRARY_DIRS}/libvtktiff.dll
265  ${VTK_LIBRARY_DIRS}/libvtkzlib.dll
266  ${VTK_LIBRARY_DIRS}/libvtkInfovis.dll
267  ${VTK_LIBRARY_DIRS}/libvtkfreetype.dll
268  ${VTK_LIBRARY_DIRS}/libvtkftgl.dll
269  ${VTK_LIBRARY_DIRS}/libvtkalglib.dll
270  ${VTK_LIBRARY_DIRS}/libvtklibxml2.dll
271  ${VTK_LIBRARY_DIRS}/libvtkViews.dll
272  ${VTK_LIBRARY_DIRS}/libvtkexoIIc.dll
273  ${VTK_LIBRARY_DIRS}/libvtkWidgets.dll
274  ${VTK_LIBRARY_DIRS}/vtkhdf5.dll
275  ${VTK_LIBRARY_DIRS}/vtkhdf5_hl.dll
276  ${VTK_LIBRARY_DIRS}/libLSDyna.dll
277  # Xerces-c dependency
278  # ${XERCESC_ROOT_DIR}/bin/xerces-c_3_1.dll
279  # Libxml2 dependencies
280  # ${LIBXML2_INCLUDE_DIR}/../bin/iconv.dll
281  C:/dev/libxml2/2.8/bin/libxml2-2.dll
282  # ${LIBXML2_INCLUDE_DIR}/../bin/zlib1.dll
283  # ITK dependency
284  ${ITK_ROOT_DIR}/bin/libITKAlgorithms.dll
285  ${ITK_ROOT_DIR}/bin/libITKCommon.dll
286  ${ITK_ROOT_DIR}/bin/libITKBasicFilters.dll
287  ${ITK_ROOT_DIR}/lib/InsightToolkit/libitksys.dll
288  ${ITK_ROOT_DIR}/bin/libitkvnl.dll
289  ${ITK_ROOT_DIR}/bin/libitkvnl_algo.dll
290  ${ITK_ROOT_DIR}/bin/libITKIO.dll
291  ${ITK_ROOT_DIR}/bin/libitkv3p_lsqr.dll
292  ${ITK_ROOT_DIR}/bin/libitkv3p_netlib.dll
293  ${ITK_ROOT_DIR}/bin/libITKDICOMParser.dll
294  ${ITK_ROOT_DIR}/bin/libITKEXPAT.dll
295  ${ITK_ROOT_DIR}/bin/libitkgdcm.dll
296  ${ITK_ROOT_DIR}/bin/libitkjpeg8.dll
297  ${ITK_ROOT_DIR}/bin/libITKMetaIO.dll
298  ${ITK_ROOT_DIR}/bin/libITKniftiio.dll
299  ${ITK_ROOT_DIR}/bin/libITKNrrdIO.dll
300  ${ITK_ROOT_DIR}/bin/libitkpng.dll
301  ${ITK_ROOT_DIR}/bin/libitktiff.dll
302  ${ITK_ROOT_DIR}/bin/libitkzlib.dll
303  ${ITK_ROOT_DIR}/bin/libitkjpeg12.dll
304  ${ITK_ROOT_DIR}/bin/libitkjpeg16.dll
305  ${ITK_ROOT_DIR}/bin/libitkopenjpeg.dll
306  ${ITK_ROOT_DIR}/bin/libITKznz.dll
307  # MinGW Dependencies
308  C:/dev/MinGW/bin/libgcc_s_dw2-1.dll
309  C:/dev/MinGW/bin/libstdc++-6.dll
310  C:/dev/MinGW/bin/mingwm10.dll
311  )
312 
313  endif()
314 
315  # MSVC compiler
316  if (MSVC)
317 
318  message(STATUS "Packaging nsis using ${MAKENSIS} with MSVC compiler")
319 
320  set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS
321  ##TODO use GetPrerequisites.cmake (i.e. find a better way to list dependencies)
322  ##get_prerequisites() is not well enough documented to justify the time investement - EP May 2011
323  # Qt dependencies
324  ${QT_BINARY_DIR}/QtCore4.dll
325  ${QT_BINARY_DIR}/QtGui4.dll
326  ${QT_BINARY_DIR}/QtSvg4.dll
327  ${QT_BINARY_DIR}/QtXml4.dll
328  ${QT_BINARY_DIR}/QtNetwork4.dll
329  ${QT_BINARY_DIR}/QtSql4.dll
330  ${QT_BINARY_DIR}/QtWebKit4.dll
331  # VTK dependencies
332  ${VTK_DIR}/../../bin/QVTK.dll
333  ${VTK_DIR}/../../bin/vtkCommon.dll
334  ${VTK_DIR}/../../bin/vtksys.dll
335  ${VTK_DIR}/../../bin/vtkFiltering.dll
336  ${VTK_DIR}/../../bin/vtkGraphics.dll
337  ${VTK_DIR}/../../bin/vtkHybrid.dll
338  ${VTK_DIR}/../../bin/vtkIO.dll
339  ${VTK_DIR}/../../bin/vtkImaging.dll
340  ${VTK_DIR}/../../bin/vtkRendering.dll
341  ${VTK_DIR}/../../bin/vtkVolumeRendering.dll
342  ${VTK_DIR}/../../bin/vtkverdict.dll
343  ${VTK_DIR}/../../bin/vtkDICOMParser.dll
344  ${VTK_DIR}/../../bin/vtkNetCDF.dll
345  ${VTK_DIR}/../../bin/vtkNetCDF_cxx.dll
346  ${VTK_DIR}/../../bin/vtkexpat.dll
347  ${VTK_DIR}/../../bin/vtkjpeg.dll
348  ${VTK_DIR}/../../bin/vtkmetaio.dll
349  ${VTK_DIR}/../../bin/vtkpng.dll
350  ${VTK_DIR}/../../bin/vtktiff.dll
351  ${VTK_DIR}/../../bin/vtkzlib.dll
352  ${VTK_DIR}/../../bin/vtkInfovis.dll
353  ${VTK_DIR}/../../bin/vtkfreetype.dll
354  ${VTK_DIR}/../../bin/vtkftgl.dll
355  ${VTK_DIR}/../../bin/vtkalglib.dll
356  ${VTK_DIR}/../../bin/vtklibxml2.dll
357  ${VTK_DIR}/../../bin/vtkViews.dll
358  ${VTK_DIR}/../../bin/vtkexoIIc.dll
359  ${VTK_DIR}/../../bin/vtkWidgets.dll
360  ${VTK_DIR}/../../bin/vtkhdf5.dll
361  ${VTK_DIR}/../../bin/vtkhdf5_hl.dll
362  ${VTK_DIR}/../../bin/LSDyna.dll
363  # Xerces-c dependency
364  ${XERCESC_ROOT_DIR}/bin/xerces-c_3_1.dll
365  # Libxml2 dependencies
366  ${LIBXML2_INCLUDE_DIR}/../bin/iconv.dll
367  ${LIBXML2_INCLUDE_DIR}/../bin/libxml2.dll
368  ${LIBXML2_INCLUDE_DIR}/../bin/zlib1.dll
369  # ITK dependency
370  ${ITK_DIR}/../../bin/ITKCommon.dll
371  )
372  endif()
373 
374  # Copy those dependencies DLLs if packaging on Windows.
375  if (PACKAGING_NSIS)
376  include(InstallRequiredSystemLibraries)
377  endif()
378 
379  # Application icon
380  set(CAMITK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\core\\\\resources\\\\appIcon.ico") #set here the current icon for CamiTK apps
381  set(CPACK_PACKAGE_ICON ${CAMITK_PACKAGE_ICON}) #icon for the top bar NSIS installer
382  set(CPACK_NSIS_MUI_ICON ${CAMITK_PACKAGE_ICON}) #icon for the generated install program (the .exe to run to install CamiTK).
383  set(CPACK_NSIS_MUI_UNIICON ${CAMITK_PACKAGE_ICON}) #icon for the generated uninstall program (the .exe to run to uninstall CamiTK).
384 
385 
386  # Installer name
387  set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_NAME} ${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
388  set(CPACK_NSIS_INSTALLED_ICON_NAME ${CPACK_PACKAGE_NAME})
389 
390  set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
391  set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\camitk.imag.fr")
392  set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\camitk.imag.fr")
393  set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
394  include(InstallRequiredSystemLibraries)
395  else()
396  message(STATUS "Can not find makensis: nsis packaging is not possible")
397  endif()
398 
399 endif()
400 
401 # ---------------
402 # Mac App Bundle
403 # ---------------
404 if(APPLE)
405  # TODO test this!
406  set(CPACK_GENERATOR "PackageMaker")
407  # Libraries are bundled directly
408  set(CPACK_COMPONENT_LIBRARIES_HIDDEN TRUE)
409  # Bundle Properties
410  set(MACOSX_BUNDLE_BUNDLE_NAME ${CPACK_PACKAGE_NAME})
411  set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
412  set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
413  set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${PROJECT_VERSION}")
414 endif()
415 
416 # and here we go...
417 include(CPack)
418 
419 # ----------------------------
420 # CamiTK's own package (.cep)
421 # ----------------------------
422 # TODO install a CEP in CamiTK
423 # TODO CamiTK Market Place
424 
425 string(TOLOWER "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${LSB_DISTRIB}_${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_FILE_NAME)
426 
427 set(CEP_PACKAGE_FILENAME "${CPACK_PACKAGE_FILE_NAME}.cep")
428 
429 set(CEP_PACKAGING_DIR "${CMAKE_BINARY_DIR}/CamiTKPackaging")
430 
431 add_custom_target(camitk-${CPACK_PACKAGE_NAME}-package
432  # configure for packaging
433  COMMAND ${CMAKE_COMMAND} -DPACKAGING_NSIS:BOOL=ON ${CMAKE_BINARY_DIR}
434  # build first
435  COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR}
436  # clean CEP package structure
437  COMMAND ${CMAKE_COMMAND} -E remove_directory "${CEP_PACKAGING_DIR}"
438  COMMAND ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${CEP_PACKAGE_FILENAME}
439  COMMAND ${CMAKE_COMMAND} -E make_directory "${CEP_PACKAGING_DIR}"
440  COMMAND ${CMAKE_COMMAND} -E make_directory "${CEP_PACKAGING_DIR}/share/${CAMITK_SHORT_VERSION_STRING}/cep"
441  # copy all cep files
442  COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/lib" "${CEP_PACKAGING_DIR}/lib"
443  COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/bin" "${CEP_PACKAGING_DIR}/bin"
444  COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/include" "${CEP_PACKAGING_DIR}/include"
445  COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_BINARY_DIR}/share" "${CEP_PACKAGING_DIR}/share"
446  # copy cep manifest
447  COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/CEPPackageManifest.xml ${CEP_PACKAGING_DIR}/share/${CAMITK_SHORT_VERSION_STRING}/cep/${CPACK_PACKAGE_NAME}.xml
448  # compress
449  COMMAND ${CMAKE_COMMAND} -E tar cvj "${CMAKE_BINARY_DIR}/${CEP_PACKAGE_FILENAME}" "${CEP_PACKAGING_DIR}"
450  WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
451  # configure back for normal build
452  COMMAND ${CMAKE_COMMAND} -DPACKAGING_NSIS:BOOL=OFF ${CMAKE_BINARY_DIR}
453  COMMENT "Building cep package for ${CPACK_PACKAGE_NAME}"
454 )
455 
456 #-- Build Manifest
457 # get the time stamp
458 execute_process(COMMAND "${CAMITK_DIR}/bin/camitk-config" "--time-stamp"
459  RESULT_VARIABLE CAMITK_CONFIG_TIMESTAMP_RETURN_CODE
460  OUTPUT_VARIABLE CAMITK_CONFIG_TIMESTAMP_OUTPUT
461  ERROR_VARIABLE CAMITK_CONFIG_TIMESTAMP_OUTPUT_ERROR
462  OUTPUT_STRIP_TRAILING_WHITESPACE
463  ERROR_STRIP_TRAILING_WHITESPACE
464 )
465 
466 # Generate XML
467 set(CEP_PACKAGE_MANIFEST_XML "<?xml version=\"1.0\"?>\n<cep>")
468 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <!-- CamiTK Extension Project Manifest File -->")
469 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <name>${CPACK_PACKAGE_NAME}</name>")
470 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <contact>${CAMITK_CEP_PACKAGING_CONTACT}</contact>")
471 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <description>${CAMITK_CEP_PACKAGING_DESCRIPTION}</description>")
472 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <license>${CAMITK_CEP_PACKAGING_LICENSE}</license>")
473 if (NOT CAMITK_CONFIG_TIMESTAMP_RETURN_CODE)
474  set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <timeStamp>${CAMITK_CONFIG_TIMESTAMP_OUTPUT}</timeStamp>")
475 endif()
476 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <actions>")
477 foreach(TARGET_NAME_ITERATOR ${CAMITK_ACTION_TARGETS})
478  string(REPLACE "action-" "" TARGET_NAME ${TARGET_NAME_ITERATOR})
479  set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <action>${TARGET_NAME}</action>")
480 endforeach()
481 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " </actions>")
482 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <viewers>")
483 foreach(TARGET_NAME_ITERATOR ${CAMITK_VIEWER_TARGETS})
484  string(REPLACE "viewer-" "" TARGET_NAME ${TARGET_NAME_ITERATOR})
485  set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <viewer>${TARGET_NAME}</viewer>")
486 endforeach()
487 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " </viewers>")
488 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <components>")
489 foreach(TARGET_NAME_ITERATOR ${CAMITK_COMPONENT_TARGETS})
490  string(REPLACE "component-" "" TARGET_NAME ${TARGET_NAME_ITERATOR})
491  set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <component>${TARGET_NAME}</component>")
492 endforeach()
493 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " </components>")
494 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <libraries>")
495 foreach(TARGET_NAME_ITERATOR ${CAMITK_CEP_LIBRARY_TARGETS})
496  set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <library>${TARGET_NAME_ITERATOR}</library>")
497 endforeach()
498 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " </libraries>")
499 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <applications>")
500 foreach(TARGET_NAME_ITERATOR ${CAMITK_APPLICATION_TARGETS})
501  string(REPLACE "application-" "" TARGET_NAME ${TARGET_NAME_ITERATOR})
502  set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " <application>${TARGET_NAME}</application>")
503 endforeach()
504 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} " </applications>")
505 set(CEP_PACKAGE_MANIFEST_XML ${CEP_PACKAGE_MANIFEST_XML} "</cep>")
506 # replace all "" by \n
507 string (REGEX REPLACE "([^\\]|^)" "\\1\n" CEP_PACKAGE_MANIFEST_XML_TMP "${CEP_PACKAGE_MANIFEST_XML}")
508 string (REGEX REPLACE "[\\](.)" "\\1" CEP_PACKAGE_MANIFEST_XML_TEXT "${CEP_PACKAGE_MANIFEST_XML_TMP}") #fixes escaping
509 # write manifest
510 file(WRITE ${CMAKE_BINARY_DIR}/CEPPackageManifest.xml ${CEP_PACKAGE_MANIFEST_XML_TEXT})
511 message(STATUS "Generated CEP manifest in CEPPackageManifest.xml")
512 
513 
514 endif() # Standalone CEP
515 end(){)
if(${CMAKE_VERSION} VERSION_GREATER "3.3" OR ${CMAKE_VERSION} VERSION_EQUAL "3.3") option(CAMITK_INCLUDE_WHAT_YOU_USE "Enable the header analysis on you code
cmake modules macros camitk test endif() add_custom_target(camitk-ce-iwyu COMMAND $
Definition: CamiTKIncludeWhatYouUse.h:37
#define a
iwyu out CACHE PATH Output filename for include what you use set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${IWYU_EXECUTABLE}) if(NOT EXISTS $
Definition: CamiTKIncludeWhatYouUse.h:22
get_filename_component(OUTFILE ${CAMITK_TEST_PASS_FILE} NAME) set(CAMITK_TEST_COMMAND_OUTPUT_FILE $
This CMake file run a command that is supposed to produce an output file, and then compare this outpu...
Definition: CamiTKTestCompareFile.h:13
test result execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f ${CAMITK_TEST_COMMAND_FILE} ${CAMITK_TEST_COMMAND_RESULT_FILE} ${CAMITK_TEST_COMMAND_OUTPUT_FILE} ${CAMITK_TEST_PASS_FILE_COMMAND_FILE} ${CAMITK_TEST_PASS_FILE_OUTPUT_FILE} ${CAMITK_TEST_PASS_FILE_RESULT_FILE}) file(WRITE $
Definition: CamiTKTestPassFile.h:21
const char * description
Definition: applications/cepgenerator/main.cpp:38
static void include(QRect &r, const QRect &rect)
Definition: canvas_typed/qtcanvas.cpp:98
Describes the properties common to all structures and components.
Definition: Properties.h:59
camitk_cep_packaging()
CamiTK cep packaging allows you to build a package from a CEP If README and COPYRIGHT files exists at...
Definition: CamiTKCEPPackaging.h:29
imageReader Update()