CamiTKPackaging.cmake 18.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#------------------
# CamiTK packaging
#------------------

# Do not forget to change the version variables in CamiTKBuild.cmake
#
# To make a source tar ball, just use the custom target camitk_package_source, e.g. "make camitk_package_source"
#
# To make an executable/installable, you will have to properly set a specific CAMITK_INSTALL_ROOT
#
# CAMITK_INSTALL_ROOT will be used as the root installation directory on the targeted plateform
# Usual values for unix are /usr or /usr/local
#
# Therefore, in order to produce a proper deb for system-wide install, you can run something like:
15
16
17
18
19
# cd tmp
# mkdir camitk
# cd camitk
# svn checkout svn://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk
# mkdir build
20
# cd build
21
22
23
24
25
# cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCAMITK_INSTALL_ROOT:PATH=/usr -DTOOL_CORESCHEMA:BOOL=ON -DTOOL_LML:BOOL=TRUE -DTOOL_PML:BOOL=TRUE         -DMML_GENERATE_GUI:BOOL=ON -DTOOL_MML:BOOL=TRUE -DMML_GENERATE_XSD_LIB:BOOL=TRUE -DACTION_ITKSEGMENTATION:BOOL=TRUE -DACTION_ITKFILTERS:BOOL=TRUE -DAPPLICATION_WIZARD:BOOL=TRUE -DCOMPONENT_VTKMESH:BOOL=TRUE -DCOMPONENT_DICOM:BOOL=TRUE -DCOMPONENT_ITKIMAGE:BOOL=TRUE -DCOMPONENT_PHYSICALMODEL:BOOL=TRUE -DCOMPONENT_MML:BOOL=TRUE -DAPIDOC_GENERATE_FOR_CAMITK_CORE:BOOL=TRUE -DACTION_MML:BOOL=TRUE ../camitk
# (you can add -DMAKECOMMAND:STRING="/usr/bin/make -i -j5")
# make VERBOSE=1
# (or make -j5 VERBOSE=1 )
# make camitk_package VERBOSE=1
26
#
27
28
#
# To build source package
29
30
31
# make camitk_package_source
# (it generates the correct CamiTKVersion.h)
#
32
33
34
35
36
37
38
39
# Once CAMITK_INSTALL_ROOT is properly defined, type "make camitk_package"
# 
# To check the content of a deb package:
# dpkg --contents package.deb
# To install the content of a deb in a subdirectory instead of system-wide:
# dpkg --vextract package.deb subdirectory
#
# To produce a window installer with NSIS from linux, you need to install the nsis package (on ubuntu, type "sudo apt-get install nsis")
40
# Be sure to use the makensisw.exe and not makensis.exe as the value of the MAKENSIS variable.
41
42
43
44
45
#
# To generate different components that can be opt out at install time, see
# http://www.itk.org/Wiki/CMake:Component_Install_With_CPack
#
# More generally see http://www.itk.org/Wiki/CMake:CPackConfiguration
46

47
48
49
50
51
52
53
54
55
# package name
string(TOLOWER ${CAMITK_PROJECT_NAME} CPACK_PACKAGE_NAME)
set(CPACK_PACKAGE_VERSION_MAJOR ${CAMITK_VER_MAJ})
set(CPACK_PACKAGE_VERSION_MINOR ${CAMITK_VER_MIN})
set(CPACK_PACKAGE_VERSION_PATCH ${CAMITK_VER_PACKAGE_PAT})
string(TOLOWER "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CAMITK_VER_NICKNAME}-${LSB_DISTRIB}_${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_FILE_NAME)

# contact information
set(CPACK_PACKAGE_VENDOR "UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525")
56
57
set(CPACK_PACKAGE_CONTACT "http://camitk.imag.fr")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "CamiTK Developers <camitk-developers@lists.forge.imag.fr>")
58
59
60

# resource files
set(CPACK_RESOURCE_FILE_README "${CAMITK_SOURCE_DIR}/README")
61
set(CPACK_RESOURCE_FILE_LICENSE "${CAMITK_SOURCE_DIR}/COPYRIGHT")
62
63

# executable
64
set(CPACK_PACKAGE_EXECUTABLES "camitk-imp" "camitk-imp" "camitk-actionstatemachine" "camitk-actionstatemachine")
65

66
# CamiTK package description
67
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CamiTK stands for Computer Assisted Medical Intervention Tool Kit and aims at providing an easy way to protype medical applications. CamiTK functionnalities are extendable thanks to plugins. This package includes the IMP application with main plugins that allow users to interact with medical images (2D, 3D), process them and simulate biomechanichal deformations. It also includes the actionstatemachine application that allows user to easily run a pipelines of algorithms on images.")
68
69
70
71

# Files to ignore during generation of the package
set(CPACK_SOURCE_IGNORE_FILES
"~$"
72
73
"/CVS/"
"tags"
74
75
76
77
"/\\\\.svn/"
"/\\\\.git/"
"/kdev4$/"
"/build/"
78
79
80
81
"\\\\.kdevses$"
"\\\\.kdev4$"
"\\\\.kdevelop\\\\.pcs$"
".DS_Store"
82
83
84
${CPACK_SOURCE_IGNORE_FILES}
)

85
set(CPACK_SOURCE_GENERATOR "TGZ" "ZIP" )
86
87


88
89
90
# ----------------------------------
# Unix packages (Ubuntu and Debian)
# ----------------------------------
91
if (UNIX AND NOT WIN32)
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
   
   message(STATUS "Packaging CamiTK for UNIX systems")
   # Try to find architecture
   execute_process(COMMAND uname -m OUTPUT_VARIABLE CPACK_PACKAGE_ARCHITECTURE)
   string(STRIP "${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_ARCHITECTURE)
   # Try to find distro name and distro-specific arch
   execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE LSB_ID)
   execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE LSB_RELEASE)
   string(STRIP "${LSB_ID}" LSB_ID)
   string(STRIP "${LSB_RELEASE}" LSB_RELEASE)
   set(LSB_DISTRIB "${LSB_ID}${LSB_RELEASE}")
   if(NOT LSB_DISTRIB)
      set(LSB_DISTRIB "unix")
   endif(NOT LSB_DISTRIB)
   message(STATUS "Packager architecture : ${LSB_DISTRIB}")

   #Find DPKG
   find_program(DPKG
      NAMES dpkg-deb
      PATHS "/usr/bin" #Add paths here
   )
   if ( DPKG )
      get_filename_component(DPKG_PATH ${DPKG} ABSOLUTE)
      message(STATUS "Packaging deb using ${DPKG_PATH}: OK")
      set(DPKG_FOUND "YES")
   else() 
      set(DPKG_FOUND "NO")
   endif()
120
121
122
123
124
   
   # Packaging requires ITK
   find_package(ITK REQUIRED)
   include(${ITK_USE_FILE})
   
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
   # For Debian-based distribs we want to create DEB packages.
   if("${LSB_DISTRIB}" MATCHES "Ubuntu|Debian")

      # We need to alter the architecture names as per distro rules
      if("${CPACK_PACKAGE_ARCHITECTURE}" MATCHES "i[3-6]86")
         set(CPACK_PACKAGE_ARCHITECTURE i386)
      endif()
      if("${CPACK_PACKAGE_ARCHITECTURE}" MATCHES "x86_64")
         set(CPACK_PACKAGE_ARCHITECTURE amd64)
      endif()
      # Set the dependencies based on the distrib version

      # Installation path
      # Set the install location to "/usr"
      # PLEASE, set the CamiTK install root path in your CMake command line / GUI (and not directly here)      
      set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
      set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
      set(CPACK_SET_DESTDIR TRUE)

      # Dependencies depending on the Operating System.
      # Ubuntu11.10
      if("${LSB_DISTRIB}" MATCHES "Ubuntu11.10")
147
         set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.6-qt4, libxerces-c3.1 ")
148
149
150
      endif()
      # For Ubuntu12.xx 
      if("${LSB_DISTRIB}" MATCHES "Ubuntu12.04")
151
152
         set(LSB_DISTRIB "Ubuntu12.xx")
         set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.8-qt4, libxerces-c3.1 ")
153
154
      endif()
      if("${LSB_DISTRIB}" MATCHES "Ubuntu12.04.1")
155
156
         set(LSB_DISTRIB "Ubuntu12.xx")
         set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.8-qt4, libxerces-c3.1 ")
157
      endif()
158
      if("${LSB_DISTRIB}" MATCHES "Ubuntu12.10")
159
160
161
         set(LSB_DISTRIB "Ubuntu12.xx")
         set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-dev, libinsighttoolkit3.20, libxml2, libvtk5.8-qt4, libxerces-c3.1 ")
      endif()
162
                
163
164
165
      # TODO Debian dependencies
#     if("${LSB_DISTRIB}" MATCHES "Debian5.*")
#        set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk2.0-0, libsqlite3-0, libglade2-0, libgegl-0.0-0, libcairo2, libexiv2-5, liblcms1, libjpeg62, libpng12-0, liblensfun0, liblensfun-data")
166
# 
167
168
169
170
#     endif("${LSB_DISTRIB}" MATCHES "Debian5.*")
#     if("${LSB_DISTRIB}" MATCHES "Debiantesting")
#        set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk2.0-0, libsqlite3-0, libglade2-0, libgegl-0.0-0, libcairo2, libexiv2-5, liblcms1, libjpeg62, libpng12-0, liblensfun0, liblensfun-data")
#     endif("${LSB_DISTRIB}" MATCHES "Debiantesting")
171

172
      if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS)
173
         message(STATUS "Packaging for ${LSB_DISTRIB} not supported yet.\n")
174
      endif()
175

176
   endif()
177

178
179
180
   # package name
   string(TOLOWER "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}-${CAMITK_VER_NICKNAME}-${LSB_DISTRIB}_${CPACK_PACKAGE_ARCHITECTURE}" CPACK_PACKAGE_FILE_NAME)
   message(STATUS "CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}")
181

182
183
endif()

184
185


186
if(WIN32 AND NOT UNIX)
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
   # -----------------------
   # NSIS Windows installer
   # -----------------------
   
   # Update package name for windows release
   set(LSB_DISTRIB "win32")
   set(CPACK_PACKAGE_ARCHITECTURE i386)
   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)
   
   # Try to find Makensis on Linux distribution
   find_program(MAKENSIS
     NAMES makensis
     PATHS "/usr/bin"
   )

   if(MAKENSIS)
203
204
   
      set(ITK_ROOT_DIR "C:/dev/ITK/3.20.1")
205
      	
206
      # MinGW compiler
207
208
209
210
      if ("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles")
	  
         message(STATUS "Packaging nsis using ${MAKENSIS} with MinGW compiler")
		 
211
212
213
         set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS 
         ##TODO use GetPrerequisites.cmake (i.e. find a better way to list dependencies)
         ##get_prerequisites() is not well enough documented to justify the time investement - EP May 2011
214
         # Qt dependencies
215
216
217
218
219
220
221
         ${QT_BINARY_DIR}/QtCore4.dll 
         ${QT_BINARY_DIR}/QtGui4.dll
         ${QT_BINARY_DIR}/QtSvg4.dll
         ${QT_BINARY_DIR}/QtXml4.dll
         ${QT_BINARY_DIR}/QtNetwork4.dll
         ${QT_BINARY_DIR}/QtSql4.dll
         ${QT_BINARY_DIR}/QtWebKit4.dll
222
         # VTK dependencies
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
         ${VTK_LIBRARY_DIRS}/libQVTK.dll 
         ${VTK_LIBRARY_DIRS}/libvtkCommon.dll 
         ${VTK_LIBRARY_DIRS}/libvtksys.dll 
         ${VTK_LIBRARY_DIRS}/libvtkFiltering.dll 
         ${VTK_LIBRARY_DIRS}/libvtkGraphics.dll 
         ${VTK_LIBRARY_DIRS}/libvtkHybrid.dll 
         ${VTK_LIBRARY_DIRS}/libvtkIO.dll 
         ${VTK_LIBRARY_DIRS}/libvtkImaging.dll
         ${VTK_LIBRARY_DIRS}/libvtkRendering.dll 
         ${VTK_LIBRARY_DIRS}/libvtkVolumeRendering.dll
         ${VTK_LIBRARY_DIRS}/libvtkverdict.dll 
         ${VTK_LIBRARY_DIRS}/libvtkDICOMParser.dll 
         ${VTK_LIBRARY_DIRS}/libvtkNetCDF.dll 
         ${VTK_LIBRARY_DIRS}/libvtkNetCDF_cxx.dll
         ${VTK_LIBRARY_DIRS}/libvtkexpat.dll 
         ${VTK_LIBRARY_DIRS}/libvtkjpeg.dll 
         ${VTK_LIBRARY_DIRS}/libvtkmetaio.dll 
         ${VTK_LIBRARY_DIRS}/libvtkpng.dll 
         ${VTK_LIBRARY_DIRS}/libvtktiff.dll 
         ${VTK_LIBRARY_DIRS}/libvtkzlib.dll 
         ${VTK_LIBRARY_DIRS}/libvtkInfovis.dll 
         ${VTK_LIBRARY_DIRS}/libvtkfreetype.dll 
         ${VTK_LIBRARY_DIRS}/libvtkftgl.dll
         ${VTK_LIBRARY_DIRS}/libvtkalglib.dll 
         ${VTK_LIBRARY_DIRS}/libvtklibxml2.dll 
         ${VTK_LIBRARY_DIRS}/libvtkViews.dll 
         ${VTK_LIBRARY_DIRS}/libvtkexoIIc.dll
250
         ${VTK_LIBRARY_DIRS}/libvtkWidgets.dll
251
252
253
         ${VTK_LIBRARY_DIRS}/vtkhdf5.dll 
         ${VTK_LIBRARY_DIRS}/vtkhdf5_hl.dll 
         ${VTK_LIBRARY_DIRS}/libLSDyna.dll      		 
254
         # Xerces-c dependency
255
         # ${XERCESC_ROOT_DIR}/bin/xerces-c_3_1.dll 
256
         # Libxml2 dependencies
257
         # ${LIBXML2_INCLUDE_DIR}/../bin/iconv.dll
258
         C:/dev/libxml2/2.8/bin/libxml2-2.dll
259
         # ${LIBXML2_INCLUDE_DIR}/../bin/zlib1.dll
260
         # ITK dependency 
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
         ${ITK_ROOT_DIR}/bin/libITKCommon.dll
         ${ITK_ROOT_DIR}/bin/libITKBasicFilters.dll
         ${ITK_ROOT_DIR}/lib/InsightToolkit/libitksys.dll
         ${ITK_ROOT_DIR}/bin/libitkvnl.dll
         ${ITK_ROOT_DIR}/bin/libitkvnl_algo.dll
         ${ITK_ROOT_DIR}/bin/libITKIO.dll
         ${ITK_ROOT_DIR}/bin/libitkv3p_lsqr.dll
         ${ITK_ROOT_DIR}/bin/libitkv3p_netlib.dll
         ${ITK_ROOT_DIR}/bin/libITKDICOMParser.dll
         ${ITK_ROOT_DIR}/bin/libITKEXPAT.dll
         ${ITK_ROOT_DIR}/bin/libitkgdcm.dll
         ${ITK_ROOT_DIR}/bin/libitkjpeg8.dll
         ${ITK_ROOT_DIR}/bin/libITKMetaIO.dll
         ${ITK_ROOT_DIR}/bin/libITKniftiio.dll
         ${ITK_ROOT_DIR}/bin/libITKNrrdIO.dll
         ${ITK_ROOT_DIR}/bin/libitkpng.dll
         ${ITK_ROOT_DIR}/bin/libitktiff.dll
         ${ITK_ROOT_DIR}/bin/libitkzlib.dll
         ${ITK_ROOT_DIR}/bin/libitkjpeg12.dll
         ${ITK_ROOT_DIR}/bin/libitkjpeg16.dll
         ${ITK_ROOT_DIR}/bin/libitkopenjpeg.dll
         ${ITK_ROOT_DIR}/bin/libITKznz.dll
283
284
285
286
         # MinGW Dependencies
         C:/dev/MinGW/bin/libgcc_s_dw2-1.dll
         C:/dev/MinGW/bin/libstdc++-6.dll
         C:/dev/MinGW/bin/mingwm10.dll
287
288
         )
         
saubatn's avatar
saubatn committed
289
      endif()
290
291
      
      # MSVC compiler
292
293
294
295
      if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 2008")
	  
         message(STATUS "Packaging nsis using ${MAKENSIS} with MSVC compiler")
		 
296
297
298
         set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS 
         ##TODO use GetPrerequisites.cmake (i.e. find a better way to list dependencies)
         ##get_prerequisites() is not well enough documented to justify the time investement - EP May 2011
299
		 # Qt dependencies
300
301
302
303
304
305
306
         ${QT_BINARY_DIR}/QtCore4.dll 
         ${QT_BINARY_DIR}/QtGui4.dll
         ${QT_BINARY_DIR}/QtSvg4.dll
         ${QT_BINARY_DIR}/QtXml4.dll
         ${QT_BINARY_DIR}/QtNetwork4.dll
         ${QT_BINARY_DIR}/QtSql4.dll
         ${QT_BINARY_DIR}/QtWebKit4.dll
307
         # VTK dependencies
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
         ${VTK_LIBRARY_DIRS}/Release/QVTK.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkCommon.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtksys.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkFiltering.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkGraphics.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkHybrid.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkIO.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkImaging.dll
         ${VTK_LIBRARY_DIRS}/Release/vtkRendering.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkVolumeRendering.dll
         ${VTK_LIBRARY_DIRS}/Release/vtkverdict.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkDICOMParser.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkNetCDF.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkNetCDF_cxx.dll
         ${VTK_LIBRARY_DIRS}/Release/vtkexpat.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkjpeg.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkmetaio.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkpng.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtktiff.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkzlib.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkInfovis.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkfreetype.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkftgl.dll
         ${VTK_LIBRARY_DIRS}/Release/vtkalglib.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtklibxml2.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkViews.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkexoIIc.dll
         ${VTK_LIBRARY_DIRS}/Release/vtkWidgets.dll  
336
337
338
         ${VTK_LIBRARY_DIRS}/Release/vtkhdf5.dll 
         ${VTK_LIBRARY_DIRS}/Release/vtkhdf5_hl.dll 
         ${VTK_LIBRARY_DIRS}/Release/LSDyna.dll
339
340
         # Xerces-c dependency
         ${XERCESC_ROOT_DIR}/bin/xerces-c_3_1.dll 
341
342
343
344
         # Libxml2 dependencies
         ${LIBXML2_INCLUDE_DIR}/../bin/iconv.dll
         ${LIBXML2_INCLUDE_DIR}/../bin/libxml2.dll
         ${LIBXML2_INCLUDE_DIR}/../bin/zlib1.dll
345
         # ITK dependency 
346
         ${ITK_ROOT_DIR}/bin/ITKCommon.dll
347
         )
348
		 
saubatn's avatar
saubatn committed
349
      endif()
350
351
352
353
354
355
356
357
358
      
            
      # Application icon
      set(CAMITK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\core\\\\resources\\\\appIcon.ico") #set here the current icon for CamiTK
      set(CPACK_PACKAGE_ICON ${CAMITK_PACKAGE_ICON}) #icon for the top bar NSIS installer
      set(CPACK_NSIS_MUI_ICON ${CAMITK_PACKAGE_ICON}) #icon for the generated install program (the .exe to run to install CamiTK).
      set(CPACK_NSIS_MUI_UNIICON ${CAMITK_PACKAGE_ICON}) #icon for the generated uninstall program (the .exe to run to uninstall CamiTK).
      
      # Create desktop icons, by forcing CPack to build an internal command, as 'set(CPACK_NSIS_MODIFY_PATH ON)' option setted in the additional page doesn't work.
359
      set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "CreateShortCut \\\"$DESKTOP\\\\${CAMITK_PROJECT_NAME}-imp.lnk\\\" \\\"$INSTDIR\\\\bin\\\\imp.exe\\\"")              
360
361
362
363
364
365
366
367
368
369
370
371
            
      # Tell CPack to remove the icons after uninstalling
      set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "Delete \\\"$DESKTOP\\\\${CAMITK_PROJECT_NAME}-imp.lnk\\\"")
            
      # Installer name
      set(CPACK_NSIS_DISPLAY_NAME "CamiTK ${CAMITK_VER_MAJ}.${CAMITK_VER_MIN}.${CAMITK_VER_PACKAGE_PAT}")
      set(CPACK_NSIS_INSTALLED_ICON_NAME ${CAMITK_PROJECT_NAME})
      
      set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CAMITK_PROJECT_NAME})
      set(CPACK_NSIS_HELP_LINK "http:\\\\\\\\camitk.imag.fr")
      set(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\camitk.imag.fr")
      set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
372
      # include(InstallRequiredSystemLibraries)
373
374
375
   else()
       message(STATUS "Can not find makensis: nsis packaging is not possible")
   endif()
ykeraval's avatar
ykeraval committed
376

377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
endif()

# ---------------
# Mac App Bundle
# ---------------
if(APPLE)
    # TODO test this!
    set(CPACK_GENERATOR "PackageMaker")
    # Libraries are bundled directly
    set(CPACK_COMPONENT_LIBRARIES_HIDDEN TRUE)
    # Bundle Properties
    set(MACOSX_BUNDLE_BUNDLE_NAME ${CPACK_PACKAGE_NAME})
    set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
    set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
    set(MACOSX_BUNDLE_LONG_VERSION_STRING "Version ${PROJECT_VERSION}")
endif()


# -------------------------------------
# System and dependencies requirements
# -------------------------------------
include(InstallRequiredSystemLibraries)

400

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# and here we go...
include(CPack)


# ----------------------------------
# CamiTK specific packaging targets
# ----------------------------------

# create specific target for package source
add_custom_target(camitk_package_source
    COMMAND ${CMAKE_COMMAND}
        -E copy ${CAMITK_BINARY_DIR}/CamiTKPackageVersion.h
                ${CAMITK_SOURCE_DIR}/core/CamiTKVersion.h
    COMMAND ${CMAKE_COMMAND}
        --build ${CMAKE_BINARY_DIR}
        --target package_source
    COMMAND ${CMAKE_COMMAND}
        -E remove ${CAMITK_SOURCE_DIR}/core/CamiTKVersion.h
)

# create specific target for binary package
add_custom_target(camitk_package
    COMMAND ${CMAKE_COMMAND}
        -E copy ${CAMITK_BINARY_DIR}/core/CamiTKVersion.h
                ${CAMITK_BINARY_DIR}/core/CamiTKVersion.h-backup
    COMMAND ${CMAKE_COMMAND}
        -E copy ${CAMITK_BINARY_DIR}/CamiTKPackageVersion.h
                ${CAMITK_BINARY_DIR}/core/CamiTKVersion.h
    COMMAND ${CMAKE_COMMAND}
        --build ${CMAKE_BINARY_DIR}
        --target package
    COMMAND ${CMAKE_COMMAND}
        -E copy ${CAMITK_BINARY_DIR}/core/CamiTKVersion.h-backup
                ${CAMITK_BINARY_DIR}/core/CamiTKVersion.h
)