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