forked from Slicer/Slicer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSlicerBlockCTKAppLauncherSettings.cmake
336 lines (296 loc) · 12 KB
/
SlicerBlockCTKAppLauncherSettings.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
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
336
################################################################################
#
# Program: 3D Slicer
#
# Copyright (c) Kitware Inc.
#
# See COPYRIGHT.txt
# or http://www.slicer.org/copyright/copyright.txt for details.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
# and was partially funded by NIH grant 3P41RR013218-12S1
#
################################################################################
#
# ------------------[ Slicer Launcher settings ] ------------------
#
# This file contains variables that can be grouped into two broad categories.
#
# There are the variables that are used to configure the launcher for a BUILD tree and also
# the ones for an INSTALLED tree.
#
# Each one of these categories contain: the PATHS, LIBRARY_PATHS and ENVVARS variables
#
# To summarize, you will find the following variables:
#
# SLICER_LIBRARY_PATHS_BUILD
# SLICER_PATHS_BUILD
# SLICER_ENVVARS_BUILD
# SLICER_ADDITIONAL_PATH_ENVVARS_BUILD
#
# SLICER_LIBRARY_PATHS_INSTALLED
# SLICER_PATHS_INSTALLED
# SLICER_ENVVARS_INSTALLED
# SLICER_ADDITIONAL_PATH_ENVVARS_INSTALLED
#
#
# Usually, if you are building on a system handling multiple build configurations
# (i.e Visual studio with Debug, Release, ...), the libraries and executables could be built in a
# subdirectory matching the active configuration.
#
# In case of a BUILD tree, each time a path containing such a sub directory should be considered,
# it's possible to rely on a special string: <CMAKE_CFG_INTDIR>
#
# At build time, <CMAKE_CFG_INTDIR> will be replaced by the active configuration name.
# This happens within the script "ctkAppLauncher-configure.cmake".
# Note also that script is executed each time the target '{Application_Name}ConfigureLauncher' is built.
#
# It means you could manually trigger the reconfiguration of the launcher settings file
# by building that target.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Settings specific to the build tree.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# LIBRARY_PATHS
#-----------------------------------------------------------------------------
set(SLICER_LIBRARY_PATHS_BUILD
<APPLAUNCHER_SETTINGS_DIR>/bin/<CMAKE_CFG_INTDIR>
)
if(NOT Slicer_USE_SYSTEM_QT)
if(WIN32)
list(APPEND SLICER_LIBRARY_PATHS_BUILD ${QT_BINARY_DIR})
else()
list(APPEND SLICER_LIBRARY_PATHS_BUILD ${QT_LIBRARY_DIR})
endif()
endif()
# The following lines allow Slicer to load a CLI module extension that depends
# on libraries (i.e a logic class) provided by a loadable module extension.
list(APPEND SLICER_LIBRARY_PATHS_BUILD ../${Slicer_QTLOADABLEMODULES_LIB_DIR})
if(CMAKE_CONFIGURATION_TYPES)
list(APPEND SLICER_LIBRARY_PATHS_BUILD ../${Slicer_QTLOADABLEMODULES_LIB_DIR}/<CMAKE_CFG_INTDIR>)
endif()
if(Slicer_BUILD_CLI_SUPPORT AND Slicer_BUILD_CLI)
list(APPEND SLICER_LIBRARY_PATHS_BUILD
<APPLAUNCHER_SETTINGS_DIR>/${Slicer_CLIMODULES_LIB_DIR}/<CMAKE_CFG_INTDIR>
)
endif()
if(Slicer_BUILD_QTLOADABLEMODULES)
list(APPEND SLICER_LIBRARY_PATHS_BUILD
<APPLAUNCHER_SETTINGS_DIR>/${Slicer_QTLOADABLEMODULES_LIB_DIR}/<CMAKE_CFG_INTDIR>
)
endif()
# External projects - library paths
foreach(varname IN LISTS Slicer_EP_LABEL_LIBRARY_PATHS_LAUNCHER_BUILD)
list(APPEND SLICER_LIBRARY_PATHS_BUILD ${${varname}})
endforeach()
#-----------------------------------------------------------------------------
# PATHS
#-----------------------------------------------------------------------------
set(SLICER_PATHS_BUILD
<APPLAUNCHER_SETTINGS_DIR>/bin/<CMAKE_CFG_INTDIR>
)
if(NOT Slicer_USE_SYSTEM_QT)
list(APPEND SLICER_PATHS_BUILD
${QT_BINARY_DIR}
)
endif()
if(Slicer_BUILD_CLI_SUPPORT AND Slicer_BUILD_CLI)
list(APPEND SLICER_PATHS_BUILD
<APPLAUNCHER_SETTINGS_DIR>/${Slicer_CLIMODULES_BIN_DIR}/<CMAKE_CFG_INTDIR>
)
endif()
# External projects - paths
foreach(varname IN LISTS Slicer_EP_LABEL_PATHS_LAUNCHER_BUILD)
list(APPEND SLICER_PATHS_BUILD ${${varname}})
endforeach()
#-----------------------------------------------------------------------------
# ENVVARS
#-----------------------------------------------------------------------------
set(SLICER_ENVVARS_BUILD
"SLICER_HOME=${Slicer_BINARY_DIR}" # See note below
"ITK_AUTOLOAD_PATH=<APPLAUNCHER_SETTINGS_DIR>/${Slicer_ITKFACTORIES_DIR}/<CMAKE_CFG_INTDIR>"
)
if(Slicer_USE_PYTHONQT)
list(APPEND SLICER_ENVVARS_BUILD
"PIP_REQUIRE_VIRTUALENV=0"
)
endif()
if(Slicer_USE_PYTHONQT_WITH_OPENSSL)
list(APPEND SLICER_ENVVARS_BUILD
"SSL_CERT_FILE=<APPLAUNCHER_SETTINGS_DIR>/${Slicer_SHARE_DIR}/Slicer.crt"
)
endif()
if(UNIX AND NOT APPLE)
# Disable Chromium Sandboxing on Linux because not all systems support it
# (see https://github.com/Slicer/Slicer/issues/6577)
list(APPEND SLICER_ENVVARS_BUILD
"QTWEBENGINE_DISABLE_SANDBOX=1"
)
endif()
# External projects - environment variables
foreach(varname IN LISTS Slicer_EP_LABEL_ENVVARS_LAUNCHER_BUILD)
list(APPEND SLICER_ENVVARS_BUILD ${${varname}})
endforeach()
#-----------------------------------------------------------------------------
# PATH ENVVARS
#-----------------------------------------------------------------------------
# QT_PLUGIN_PATH
set(SLICER_QT_PLUGIN_PATH_BUILD
"<APPLAUNCHER_SETTINGS_DIR>/bin"
"${CTK_DIR}/CTK-build/bin"
"${QT_PLUGINS_DIR}"
)
set(SLICER_ADDITIONAL_PATH_ENVVARS_BUILD
"QT_PLUGIN_PATH"
)
# Note: The addition of SLICER_HOME to the build environment has been motivated by
# EMSegmentCommandLine executable. Indeed, this CLI is instantiating
# qSlicerApplication which requires SLICER_HOME to be set so that it could
# properly initialize the python environment and execute both python and Tcl scripts.
# Please note that the environment variable is SLICER_HOME,
# CMake refers to the variable as Slicer_HOME, and the tcl variable is SlicerHome.
# PYTHONPATH
if(Slicer_USE_PYTHONQT)
set(SLICER_PYTHONPATH_BUILD
"<APPLAUNCHER_SETTINGS_DIR>/bin/<CMAKE_CFG_INTDIR>"
"<APPLAUNCHER_SETTINGS_DIR>/bin/Python"
)
if(Slicer_BUILD_QTLOADABLEMODULES)
list(APPEND SLICER_PYTHONPATH_BUILD
"<APPLAUNCHER_SETTINGS_DIR>/${Slicer_QTLOADABLEMODULES_LIB_DIR}/<CMAKE_CFG_INTDIR>"
"<APPLAUNCHER_SETTINGS_DIR>/${Slicer_QTLOADABLEMODULES_PYTHON_LIB_DIR}"
)
endif()
if(Slicer_USE_PYTHONQT)
list(APPEND SLICER_PYTHONPATH_BUILD
"<APPLAUNCHER_SETTINGS_DIR>/${Slicer_QTSCRIPTEDMODULES_LIB_DIR}"
)
endif()
# External projects - pythonpath
foreach(varname IN LISTS Slicer_EP_LABEL_PYTHONPATH_LAUNCHER_BUILD)
list(APPEND SLICER_PYTHONPATH_BUILD ${${varname}})
endforeach()
# External projects - path environment variables
list(APPEND SLICER_ADDITIONAL_PATH_ENVVARS_BUILD
"PYTHONPATH"
# Ensures "slicer_dll_directories.add()" can add relevant directories.
# See SuperBuild/python_configure_python_launcher.cmake
"LibraryPaths"
)
endif()
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Settings specific to the install tree.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Note(s):
#
# Do not use Slicer_INSTALL_* variables
# -------------------------------------
#
# Indeed, on macOS, since Slicer_INSTALL_* variables already includes
# Slicer_BUNDLE_LOCATION (<appname>.app/Contents) they can *NOT*
# be used to reference paths from <APPLAUNCHER_SETTINGS_DIR> which is itself
# set to /path/to/<appname>.app/Contents/bin.
#
#-----------------------------------------------------------------------------
# LIBRARY_PATHS
#-----------------------------------------------------------------------------
set(SLICER_LIBRARY_PATHS_INSTALLED
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_BIN_DIR}
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_LIB_DIR}
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_CLIMODULES_LIB_DIR}
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_QTLOADABLEMODULES_LIB_DIR}
)
# The following lines allow Slicer to load a CLI module extension that depends
# on libraries (i.e a logic class) provided by a loadable module extension.
list(APPEND SLICER_LIBRARY_PATHS_INSTALLED ../${Slicer_QTLOADABLEMODULES_LIB_DIR})
if(CMAKE_CONFIGURATION_TYPES)
list(APPEND SLICER_LIBRARY_PATHS_INSTALLED ../${Slicer_QTLOADABLEMODULES_LIB_DIR}/<CMAKE_CFG_INTDIR>)
endif()
# External projects - library paths
foreach(varname IN LISTS Slicer_EP_LABEL_LIBRARY_PATHS_LAUNCHER_INSTALLED)
list(APPEND SLICER_LIBRARY_PATHS_INSTALLED ${${varname}})
endforeach()
#-----------------------------------------------------------------------------
# PATHS
#-----------------------------------------------------------------------------
set(SLICER_PATHS_INSTALLED
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_BIN_DIR}
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_CLIMODULES_BIN_DIR}
<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_QTLOADABLEMODULES_BIN_DIR}
)
# External projects - paths
foreach(varname IN LISTS Slicer_EP_LABEL_PATHS_LAUNCHER_INSTALLED)
list(APPEND SLICER_PATHS_INSTALLED ${${varname}})
endforeach()
#-----------------------------------------------------------------------------
# ENVVARS
#-----------------------------------------------------------------------------
set(SLICER_ENVVARS_INSTALLED
# SLICER_HOME might already be set on the machine, overwrite it because it
# could have unwanted side effects
"SLICER_HOME=<APPLAUNCHER_SETTINGS_DIR>/.."
"ITK_AUTOLOAD_PATH=<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_ITKFACTORIES_DIR}"
)
if(Slicer_USE_PYTHONQT)
list(APPEND SLICER_ENVVARS_INSTALLED
"PIP_REQUIRE_VIRTUALENV=0"
)
endif()
if(Slicer_USE_PYTHONQT_WITH_OPENSSL)
list(APPEND SLICER_ENVVARS_INSTALLED
"SSL_CERT_FILE=<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_SHARE_DIR}/Slicer.crt"
)
endif()
if(UNIX AND NOT APPLE)
# Disable Chromium Sandboxing on Linux because not all systems support it
# (see https://github.com/Slicer/Slicer/issues/6577)
list(APPEND SLICER_ENVVARS_INSTALLED
"QTWEBENGINE_DISABLE_SANDBOX=1"
)
endif()
# External projects - environment variables
foreach(varname IN LISTS Slicer_EP_LABEL_ENVVARS_LAUNCHER_INSTALLED)
list(APPEND SLICER_ENVVARS_INSTALLED ${${varname}})
endforeach()
#-----------------------------------------------------------------------------
# PATH ENVVARS
#-----------------------------------------------------------------------------
# QT_PLUGIN_PATH
set(SLICER_QT_PLUGIN_PATH_INSTALLED
"<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_QtPlugins_DIR}"
)
set(SLICER_ADDITIONAL_PATH_ENVVARS_INSTALLED
"QT_PLUGIN_PATH"
)
# PYTHONPATH
if(Slicer_USE_PYTHONQT)
set(SLICER_PYTHONPATH_INSTALLED
"<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_LIB_DIR}"
"<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_QTSCRIPTEDMODULES_LIB_DIR}"
"<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_QTLOADABLEMODULES_LIB_DIR}"
"<APPLAUNCHER_SETTINGS_DIR>/../lib/vtkTeem"
"<APPLAUNCHER_SETTINGS_DIR>/../bin/Python"
"<APPLAUNCHER_SETTINGS_DIR>/../${Slicer_QTLOADABLEMODULES_PYTHON_LIB_DIR}"
)
# External projects - pythonpath
foreach(varname IN LISTS Slicer_EP_LABEL_PYTHONPATH_LAUNCHER_INSTALLED)
list(APPEND SLICER_PYTHONPATH_INSTALLED ${${varname}})
endforeach()
# External projects - path environment variables
list(APPEND SLICER_ADDITIONAL_PATH_ENVVARS_INSTALLED
"PYTHONPATH"
# Ensures "slicer_dll_directories.add()" can add relevant directories.
# See SuperBuild/python_configure_python_launcher.cmake
"LibraryPaths"
)
endif()