Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSetupCPack.cmake
Go to the documentation of this file.
1 #
2 # First, set the generator variable
3 #
4 if(NOT CPACK_GENERATOR)
5  if(WIN32)
6  find_program(NSIS_MAKENSIS NAMES makensis
7  PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
8  DOC "Where is makensis.exe located"
9  )
10 
11  if(NOT NSIS_MAKENSIS)
12  set(CPACK_GENERATOR ZIP)
13  else()
14  set(CPACK_GENERATOR "NSIS;ZIP")
15 
16  endif(NOT NSIS_MAKENSIS)
17  else()
18  if(APPLE)
19  set(CPACK_GENERATOR DragNDrop)
20  else()
21  set(CPACK_GENERATOR TGZ)
22  endif()
23  endif()
24 endif(NOT CPACK_GENERATOR)
25 
26 # Set Redistributable information for windows
27 if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
30  set(CPACK_VISUAL_STUDIO_VERSION_MAJOR "${VISUAL_STUDIO_VERSION_MAJOR}")
31  set(CPACK_VISUAL_STUDIO_PRODUCT_NAME "${VISUAL_STUDIO_PRODUCT_NAME}")
32  set(CPACK_LIBRARY_ARCHITECTURE "${CMAKE_LIBRARY_ARCHITECTURE}")
33  set(CMAKE_${CPACK_VISUAL_STUDIO_PRODUCT_NAME}_REDISTRIBUTABLE "" CACHE FILEPATH "Path to the appropriate Microsoft Visual Studio Redistributable")
34 endif()
35 
36 if(EXISTS ${CMAKE_${CPACK_VISUAL_STUDIO_PRODUCT_NAME}_REDISTRIBUTABLE} )
37  install(PROGRAMS ${CMAKE_${CPACK_VISUAL_STUDIO_PRODUCT_NAME}_REDISTRIBUTABLE}
38  DESTINATION thirdpartyinstallers)
39 endif()
40 
41 # On windows set default install directory appropriately for 32 and 64 bit
42 # installers if not already set
43 if(WIN32 AND NOT CPACK_NSIS_INSTALL_ROOT)
44  if(CMAKE_CL_64)
45  set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
46  else()
47  set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
48  endif()
49 endif()
50 
51 # By default, do not warn when built on machines using only VS Express
52 if(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
53  set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
54 endif()
55 
56 # include required mfc libraries
57 include(InstallRequiredSystemLibraries)
58 
59 set(CPACK_PACKAGE_NAME "MITK")
60 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MITK is a medical image processing tool")
61 set(CPACK_PACKAGE_VENDOR "German Cancer Research Center (DKFZ)")
62 set(CPACK_PACKAGE_DESCRIPTION_FILE "${MITK_SOURCE_DIR}/LICENSE.txt")
63 set(CPACK_RESOURCE_FILE_LICENSE "${MITK_SOURCE_DIR}/LICENSE.txt")
64 set(CPACK_PACKAGE_VERSION_MAJOR "${MITK_VERSION_MAJOR}")
65 set(CPACK_PACKAGE_VERSION_MINOR "${MITK_VERSION_MINOR}")
66 
67 # tell cpack to strip all debug symbols from all files
68 set(CPACK_STRIP_FILES ON)
69 
70 # append revision number if available
71 if(MITK_REVISION_ID AND MITK_VERSION_PATCH STREQUAL "99")
72  if(MITK_WC_TYPE STREQUAL "git")
73  set(git_hash ${MITK_REVISION_ID})
74  string(LENGTH "${git_hash}" hash_length)
75  if(hash_length GREATER 6)
76  string(SUBSTRING ${git_hash} 0 6 git_hash)
77  endif()
78  set(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${git_hash}")
79  else()
80  set(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}_r${MITK_REVISION_ID}")
81  endif()
82 else()
83  set(CPACK_PACKAGE_VERSION_PATCH "${MITK_VERSION_PATCH}")
84 endif()
85 
86 # set version
87 set(CPACK_PACKAGE_VERSION
88  "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
89 
90 # determine possible system specific extension
91 set(CPACK_PACKAGE_ARCH "unkown-architecture")
92 
93 if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
94  if(CMAKE_CL_64)
95  set(CPACK_PACKAGE_ARCH "win64")
96  elseif(MINGW)
97  set(CPACK_PACKAGE_ARCH "mingw32")
98  elseif(WIN32)
99  set(CPACK_PACKAGE_ARCH "win32")
100  endif()
101 endif(${CMAKE_SYSTEM_NAME} MATCHES Windows)
102 
103 if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
104  if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686)
105  set(CPACK_PACKAGE_ARCH "linux32")
106  elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64)
107  if(${CMAKE_CXX_FLAGS} MATCHES " -m32 ")
108  set(CPACK_PACKAGE_ARCH "linux32")
109  else()
110  set(CPACK_PACKAGE_ARCH "linux64")
111  endif(${CMAKE_CXX_FLAGS} MATCHES " -m32 ")
112  else()
113  set(CPACK_PACKAGE_ARCH "linux")
114  endif()
115 endif(${CMAKE_SYSTEM_NAME} MATCHES Linux)
116 
117 if(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
118  set(CPACK_PACKAGE_ARCH "mac64")
119 endif(${CMAKE_SYSTEM_NAME} MATCHES Darwin)
120 
121 set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_PACKAGE_ARCH}")
122 
123 
124 
#define MITK_VERSION_MAJOR
Definition: mitkVersion.h:6
#define MITK_VERSION_PATCH
Definition: mitkVersion.h:8
#define MITK_VERSION_MINOR
Definition: mitkVersion.h:7
mitkFunctionGetMSVCVersion()
Get diverse visual studio ids not directly provided by CMake.