forked from Slicer/Slicer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlicerApplicationOptions.cmake
192 lines (172 loc) · 9.96 KB
/
SlicerApplicationOptions.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#-----------------------------------------------------------------------------
# Main application
#-----------------------------------------------------------------------------
# Slicer supports more than one application (i.e. an application
# "OtherApp" in addition to "APPLICATION_NAMEApp").
#
# In that specific case, it is required to differentiate the two applications
# and specify which one should be considered as the *Main* one.
#
# This is usually done within the top level CMakeLists.txt file by setting the variable
# Slicer_MAIN_PROJECT.
#
if(NOT DEFINED Slicer_MAIN_PROJECT)
set(Slicer_MAIN_PROJECT SlicerApp CACHE STRING "Main project name")
endif()
mark_as_superbuild(Slicer_MAIN_PROJECT:STRING)
#-----------------------------------------------------------------------------
# Applications directory
#-----------------------------------------------------------------------------
if(NOT DEFINED Slicer_APPLICATIONS_DIR)
set(Slicer_APPLICATIONS_DIR "${Slicer_SOURCE_DIR}/Applications")
endif()
mark_as_superbuild(Slicer_APPLICATIONS_DIR:PATH)
#-----------------------------------------------------------------------------
# Read application properties
#-----------------------------------------------------------------------------
include(SlicerReadApplicationProperties)
SlicerReadApplicationProperties(
PROJECT_NAME "${Slicer_MAIN_PROJECT}"
PROPERTIES_VAR application_properties
)
#-----------------------------------------------------------------------------
# Set Slicer_MAIN_PROJECT_* variables for each application properties
#-----------------------------------------------------------------------------
foreach(property IN LISTS application_properties)
set(Slicer_MAIN_PROJECT_${property} "${${Slicer_MAIN_PROJECT}_${property}}")
endforeach()
#-----------------------------------------------------------------------------
# Terminal support
#-----------------------------------------------------------------------------
if(WIN32)
option(Slicer_BUILD_WIN32_CONSOLE "Build ${PROJECT_NAME} executable as a console app on windows (allows capturing console output)" ON)
option(Slicer_BUILD_WIN32_CONSOLE_LAUNCHER "Build ${PROJECT_NAME} launcher executable as a console app on windows (displays console at application start)" ON)
else()
set(Slicer_BUILD_WIN32_CONSOLE OFF)
set(Slicer_BUILD_WIN32_CONSOLE_LAUNCHER OFF)
endif()
mark_as_superbuild(Slicer_BUILD_WIN32_CONSOLE:BOOL)
mark_as_superbuild(Slicer_BUILD_WIN32_CONSOLE_LAUNCHER:BOOL)
#-----------------------------------------------------------------------------
# Organization name
#-----------------------------------------------------------------------------
if(NOT DEFINED Slicer_ORGANIZATION_DOMAIN)
set(Slicer_ORGANIZATION_DOMAIN "slicer.org" CACHE STRING "Organization domain associated with Qt settings")
mark_as_advanced(Slicer_ORGANIZATION_DOMAIN)
endif()
mark_as_superbuild(Slicer_ORGANIZATION_DOMAIN)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} organization domain [${Slicer_ORGANIZATION_DOMAIN}]")
if(NOT DEFINED Slicer_ORGANIZATION_NAME)
set(Slicer_ORGANIZATION_NAME "slicer.org" CACHE STRING "Organization name associated with Qt settings")
mark_as_advanced(Slicer_ORGANIZATION_NAME)
endif()
mark_as_superbuild(Slicer_ORGANIZATION_NAME)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} organization name [${Slicer_ORGANIZATION_NAME}]")
#-----------------------------------------------------------------------------
# Settings
#-----------------------------------------------------------------------------
set(SLICER_REVISION_SPECIFIC_USER_SETTINGS_FILEBASENAME "")
mark_as_superbuild(SLICER_REVISION_SPECIFIC_USER_SETTINGS_FILEBASENAME:STRING)
#-----------------------------------------------------------------------------
# Home and favorite modules
#-----------------------------------------------------------------------------
if(NOT DEFINED Slicer_DEFAULT_HOME_MODULE)
set(Slicer_DEFAULT_HOME_MODULE "Welcome" CACHE STRING "Name of the module that Slicer activates on start-up by default")
mark_as_advanced(Slicer_DEFAULT_HOME_MODULE)
endif()
mark_as_superbuild(Slicer_DEFAULT_HOME_MODULE)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} default home module [${Slicer_DEFAULT_HOME_MODULE}]")
if(NOT DEFINED Slicer_DEFAULT_FAVORITE_MODULES)
set(Slicer_DEFAULT_FAVORITE_MODULES "Data, Volumes, Models, Transforms, Markups, SegmentEditor"
CACHE STRING "Name of the modules shown on the toolbar by default (comma-separated list)")
mark_as_advanced(Slicer_DEFAULT_FAVORITE_MODULES)
endif()
mark_as_superbuild(Slicer_DEFAULT_FAVORITE_MODULES)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} default favorite modules [${Slicer_DEFAULT_FAVORITE_MODULES}]")
#-----------------------------------------------------------------------------
# Disclaimer popup
#-----------------------------------------------------------------------------
if(NOT DEFINED Slicer_DISCLAIMER_AT_STARTUP)
set(Slicer_DISCLAIMER_AT_STARTUP "Thank you for using %1!<br><br>This software is not intended for clinical use." CACHE STRING "Text displayed at the first startup of Slicer in a popup window")
# Note: %1 is replaced by the application name and version. Add <br> for newline.
# If the disclaimer text is set to empty then no disclaimer popup is displayed.
mark_as_advanced(Slicer_DISCLAIMER_AT_STARTUP)
endif()
mark_as_superbuild(Slicer_DISCLAIMER_AT_STARTUP)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} text of disclaimer at startup [${Slicer_DISCLAIMER_AT_STARTUP}]")
#-----------------------------------------------------------------------------
# Set Slicer_MAIN_PROJECT_SOURCE_DIR
#-----------------------------------------------------------------------------
# Propagate source directory to support building Slicer-based application
# that (1) includes Slicer as an external project or (2) add Slicer source
# tree using 'add_subdirectory()'.
# Source directory it then used in 'SlicerConfigureVersionHeaderTarget' module.
if(NOT DEFINED Slicer_MAIN_PROJECT_SOURCE_DIR)
set(Slicer_MAIN_PROJECT_SOURCE_DIR ${CMAKE_SOURCE_DIR})
endif()
mark_as_superbuild(Slicer_MAIN_PROJECT_SOURCE_DIR)
#-----------------------------------------------------------------------------
# Set application bundle identifier for macOS
#-----------------------------------------------------------------------------
if(APPLE)
if(NOT DEFINED Slicer_MACOSX_BUNDLE_GUI_IDENTIFIER)
set(Slicer_MACOSX_BUNDLE_GUI_IDENTIFIER "org.slicer.slicer")
endif()
mark_as_superbuild(Slicer_MACOSX_BUNDLE_GUI_IDENTIFIER)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} application bundle identifier [${Slicer_MACOSX_BUNDLE_GUI_IDENTIFIER}]")
endif()
#-----------------------------------------------------------------------------
# Set default installation folder and admin account requirement for Windows
#-----------------------------------------------------------------------------
if(WIN32)
if(NOT DEFINED Slicer_CPACK_NSIS_INSTALL_REQUIRES_ADMIN_ACCOUNT)
set(Slicer_CPACK_NSIS_INSTALL_REQUIRES_ADMIN_ACCOUNT OFF CACHE BOOL
"Require administrator account to install the application. Must be enabled if Slicer_CPACK_NSIS_INSTALL_ROOT is only writable by administrators.")
mark_as_advanced(Slicer_CPACK_NSIS_INSTALL_REQUIRES_ADMIN_ACCOUNT)
endif()
mark_as_superbuild(Slicer_CPACK_NSIS_INSTALL_REQUIRES_ADMIN_ACCOUNT:BOOL)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} requires admin account [${Slicer_CPACK_NSIS_INSTALL_REQUIRES_ADMIN_ACCOUNT}]")
if(NOT DEFINED Slicer_CPACK_NSIS_INSTALL_ROOT)
# Set default install directory (displayed to end user during installation)
if(Slicer_CPACK_NSIS_INSTALL_REQUIRES_ADMIN_ACCOUNT)
# User has administrative privileges, therefore we can install to shared folder
# "C:\Program Files" or "c:\Program Files (x86)".
if(CMAKE_CL_64)
set(_install_root_default "$PROGRAMFILES64")
else()
set(_install_root_default "$PROGRAMFILES")
endif()
else()
# We do not require administrative privileges, therefore we install to user folder
# "C:\Users\<username>\AppData\Local".
set(_install_root_default "$LOCALAPPDATA/${Slicer_ORGANIZATION_NAME}")
endif()
set(Slicer_CPACK_NSIS_INSTALL_ROOT ${_install_root_default} CACHE STRING
"Default installation location. $LOCALAPPDATA, $APPDATA, $PROGRAMFILES, $PROGRAMFILES64 predefined values may be used as basis.")
mark_as_advanced(Slicer_CPACK_NSIS_INSTALL_ROOT)
endif()
mark_as_superbuild(Slicer_CPACK_NSIS_INSTALL_ROOT:STRING)
message(STATUS "Configuring ${Slicer_MAIN_PROJECT_APPLICATION_NAME} install root [${Slicer_CPACK_NSIS_INSTALL_ROOT}]")
endif()
#-----------------------------------------------------------------------------
# Set Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR
#-----------------------------------------------------------------------------
#
# If Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR is enabled (default) then revision-specific
# settings (such as Slicer-12345.ini) and extensions are stored in application
# home directory, within (OrganizationName) subdirectory.
# Non-revision-specific settings (such as Slicer.ini) is still stored in
# the user profile directory and shared between all installed applications,
# unless a setting file is found in the application home (in which case settings
# are stored in this local file, making the installation fully self-contained).
#
# If Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR is disabled then all settings and extensions
# are always written in the the user profile, which is useful if application
# home directory is read-only.
#
# Since Python packages are always installed in the application home directory,
# it is recommended to install the application in a writeable directory and
# enable Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR.
#
option(Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR "Store all settings in the application home directory (makes the application portable)" ON)
mark_as_superbuild(Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR:BOOL)