forked from Slicer/SlicerGitSVNArchive
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SlicerCPack.cmake
139 lines (116 loc) · 5.87 KB
/
SlicerCPack.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
if(Slicer_USE_PYTHONQT)
# Python install rules are common to both 'bundled' and 'regular' package
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallPython.cmake)
endif()
if(Slicer_USE_PYTHONQT_WITH_TCL)
# Tcl install rules are common to both 'bundled' and 'regular' package
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallTcl.cmake)
endif()
set(SlicerBlockInstallQtPlugins_subdirectories imageformats sqldrivers)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQtPlugins.cmake)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallDCMTKApps.cmake)
set(CPACK_INSTALL_CMAKE_PROJECTS)
# Install CTK Apps and Plugins (PythonQt modules, QtDesigner plugins ...)
if(NOT "${CTK_DIR}" STREQUAL "" AND EXISTS "${CTK_DIR}/CTK-build/CMakeCache.txt")
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${CTK_DIR}/CTK-build;CTK;RuntimeApplications;/")
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${CTK_DIR}/CTK-build;CTK;RuntimePlugins;/")
endif()
if(NOT APPLE)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallQt.cmake)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallPythonQt.cmake)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallLibArchive.cmake)
include(InstallRequiredSystemLibraries)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallCMakeProjects.cmake)
else()
if(Slicer_USE_PYTHONQT)
include(${Slicer_CMAKE_DIR}/SlicerBlockInstallExternalPythonModules.cmake)
endif()
# Generate qt.conf
file(WRITE ${Slicer_BINARY_DIR}/Utilities/LastConfigureStep/qt.conf-to-install
"[Paths]
Plugins = ${Slicer_QtPlugins_DIR}")
# .. and install
install(FILES ${Slicer_BINARY_DIR}/Utilities/LastConfigureStep/qt.conf-to-install
DESTINATION ${Slicer_INSTALL_ROOT}Resources
COMPONENT Runtime
RENAME qt.conf)
set(executable_path @executable_path)
set(slicer_complete_bundle_directory ${Slicer_BINARY_DIR}/Utilities/LastConfigureStep/SlicerCompleteBundles)
configure_file(
"${Slicer_SOURCE_DIR}/Utilities/LastConfigureStep/SlicerCompleteBundles.cmake.in"
"${slicer_complete_bundle_directory}/SlicerCompleteBundles.cmake"
@ONLY)
# HACK - For a given directory, "install(SCRIPT ...)" rule will be evaluated first,
# let's make sure the following install rule is evaluated within its own directory.
# Otherwise, the associated script will be executed before any other relevant install rules.
file(WRITE ${slicer_complete_bundle_directory}/CMakeLists.txt
"install(SCRIPT \"${slicer_complete_bundle_directory}/SlicerCompleteBundles.cmake\")")
add_subdirectory(${slicer_complete_bundle_directory} ${slicer_complete_bundle_directory}-binary)
endif()
# Install Slicer
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${Slicer_BINARY_DIR};Slicer;ALL;/")
# -------------------------------------------------------------------------
# Package properties
# -------------------------------------------------------------------------
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Medical Visualization and Processing Environment for Research")
set(CPACK_MONOLITHIC_INSTALL ON)
set(CPACK_PACKAGE_VENDOR "NA-MIC")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${Slicer_SOURCE_DIR}/README.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${Slicer_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${Slicer_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${Slicer_MINOR_VERSION}")
set(CPACK_PACKAGE_VERSION_PATCH "${Slicer_PATCH_VERSION}")
set(CPACK_SYSTEM_NAME "${Slicer_PLATFORM}-${Slicer_ARCHITECTURE}")
if(APPLE)
set(CPACK_PACKAGE_ICON "${Slicer_SOURCE_DIR}/Applications/SlicerQT/Resources/Slicer.icns")
endif()
# Slicer does *NOT* require setting the windows path
set(CPACK_NSIS_MODIFY_PATH OFF)
set(APPLICATION_NAME "Slicer")
set(EXECUTABLE_NAME "Slicer")
set(CPACK_PACKAGE_EXECUTABLES "..\\\\${EXECUTABLE_NAME}" "${APPLICATION_NAME}")
# -------------------------------------------------------------------------
# File extensions
# -------------------------------------------------------------------------
set(FILE_EXTENSIONS .mrml .xcat)
if(FILE_EXTENSIONS)
# For NSIS (Win32) now, we will add MacOSX support later (get back to Wes)
if(WIN32 AND NOT UNIX)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS)
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS)
foreach(ext ${FILE_EXTENSIONS})
string(LENGTH "${ext}" len)
math(EXPR len_m1 "${len} - 1")
string(SUBSTRING "${ext}" 1 ${len_m1} ext_wo_dot)
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
"${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}
WriteRegStr HKCR \\\"${APPLICATION_NAME}\\\" \\\"\\\" \\\"${APPLICATION_NAME} supported file\\\"
WriteRegStr HKCR \\\"${APPLICATION_NAME}\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$\\\\\\\"$INSTDIR\\\\${EXECUTABLE_NAME}.exe$\\\\\\\" $\\\\\\\"%1$\\\\\\\"\\\"
WriteRegStr HKCR \\\"${ext}\\\" \\\"\\\" \\\"${APPLICATION_NAME}\\\"
WriteRegStr HKCR \\\"${ext}\\\" \\\"Content Type\\\" \\\"application/x-${ext_wo_dot}\\\"
")
set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
DeleteRegKey HKCR \\\" ${APPLICATION_NAME}\\\"
DeleteRegKey HKCR \\\"${ext}\\\"
")
endforeach()
endif()
endif()
# -------------------------------------------------------------------------
# Disable source generator enabled by default
# -------------------------------------------------------------------------
set(CPACK_SOURCE_TBZ2 OFF CACHE BOOL "Enable to build TBZ2 source packages" FORCE)
set(CPACK_SOURCE_TGZ OFF CACHE BOOL "Enable to build TGZ source packages" FORCE)
set(CPACK_SOURCE_TZ OFF CACHE BOOL "Enable to build TZ source packages" FORCE)
# -------------------------------------------------------------------------
# Enable generator
# -------------------------------------------------------------------------
if(UNIX)
set(CPACK_GENERATOR "TGZ")
if(APPLE)
set(CPACK_GENERATOR "DragNDrop")
endif()
elseif(WIN32)
set(CPACK_GENERATOR "NSIS")
endif()
include(CPack)