-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathCMakeLists.txt
526 lines (439 loc) · 22.6 KB
/
CMakeLists.txt
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
set(target_name OpenStudioApp)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${QT_INCLUDES})
# source files
set(${target_name}_SRC
main.cpp
OpenStudioApp.cpp
OpenStudioApp.hpp
StartupView.hpp
StartupView.cpp
StartupMenu.hpp
StartupMenu.cpp
LibraryDialog.hpp
LibraryDialog.cpp
ExternalToolsDialog.hpp
ExternalToolsDialog.cpp
../shared_gui_components/BusyWidget.cpp
../shared_gui_components/BusyWidget.hpp
../shared_gui_components/OSDialog.cpp
../shared_gui_components/OSDialog.hpp
../shared_gui_components/WaitDialog.cpp
../shared_gui_components/WaitDialog.hpp
)
# moc files
set(${target_name}_moc
OpenStudioApp.hpp
StartupView.hpp
StartupMenu.hpp
LibraryDialog.hpp
ExternalToolsDialog.hpp
../shared_gui_components/BusyWidget.hpp
../shared_gui_components/OSDialog.hpp
../shared_gui_components/WaitDialog.hpp
)
## Qt UI generation
qt6_wrap_cpp(${target_name}_moc_src ${${target_name}_moc})
# configure the AboutBox.hpp file
# this needs to be configured to embed the build number
CONFIGURE_FILE_WITH_CHECKSUM(AboutBox.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/AboutBox.hpp")
set(OPENSTUDIOAPPLICATION_ICON_FOLDER "${PROJECT_SOURCE_DIR}/icons")
if(WIN32)
remove_definitions(/bigobj)
CONFIGURE_FILE_WITH_CHECKSUM(OpenStudioApp.rc.in "${CMAKE_CURRENT_BINARY_DIR}/OpenStudioApp.rc")
set(ICON_SRC "${CMAKE_CURRENT_BINARY_DIR}/OpenStudioApp.rc")
elseif(APPLE)
# For Apple set the icns file containing icons
# set the name of the bundle icon
set(MACOSX_BUNDLE_ICON_FILE os.icns)
# set all icons
set(ICON_SRC
${OPENSTUDIOAPPLICATION_ICON_FOLDER}/os.icns
${OPENSTUDIOAPPLICATION_ICON_FOLDER}/osm.icns
${OPENSTUDIOAPPLICATION_ICON_FOLDER}/osc.icns
)
set_source_files_properties(${ICON_SRC}
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${OPENSTUDIOAPPLICATION_VERSION}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${OPENSTUDIOAPPLICATION_LONG_VERSION}")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright © 2020-2022, OpenStudio Coalition and other contributors. All rights reserved.")
set(MACOSX_BUNDLE_EXECUTABLE_NAME ${target_name})
# PROJECT_VERSION_BUILD = Git SHA. This makes it globally unique, and is what we want to avoid CFBUndleIdenfitied collision
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.openstudiocoalition.${PROJECT_VERSION_BUILD}.openstudioapplication")
set(MACOSX_BUNDLE_BUNDLE_NAME "OpenStudioApplication")
CONFIGURE_FILE_WITH_CHECKSUM(${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
elseif(UNIX)
# Install the icons
# Cf. http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#directory_layout
# NOTE: Instead, to avoid dpkg issuing conflicts when installing several different versions, we use a post-installation script
# So install them to a temp directory that we'll remove later
install(DIRECTORY ${OPENSTUDIOAPPLICATION_ICON_FOLDER} DESTINATION Temp
FILES_MATCHING PATTERN "*.png")
#foreach(_size 16 32 48 64 128 256)
## Copy OS App icons:
#install(
#FILES "${OPENSTUDIOAPPLICATION_ICON_FOLDER}/os_${_size}.png"
#DESTINATION "/usr/share/icons/hicolor/${_size}x${_size}/apps"
#RENAME openstudioapp.png
#)
## Install OSM mimetypes icons
#install(
#FILES "${OPENSTUDIOCORE_ICON_FOLDER}/osm_${_size}.png"
#DESTINATION "/usr/share/icons/hicolor/${_size}x${_size}/mimetypes"
#RENAME application-x-openstudio.png
#)
## Install OSC
#install(
#FILES "${OPENSTUDIOCORE_ICON_FOLDER}/osc_${_size}.png"
#DESTINATION "/usr/share/icons/hicolor/${_size}x${_size}/mimetypes"
#RENAME application-x-openstudio-component.png
#)
#endforeach()
## OS App has a 512 and 1024 too
#foreach(_size 512 1024)
## Copy OS App icons
#install(
#FILES "${OPENSTUDIOAPPLICATION_ICON_FOLDER}/os_${_size}.png"
#DESTINATION "/usr/share/icons/hicolor/${_size}x${_size}/apps"
#RENAME openstudioapp.png
#)
#endforeach()
endif()
add_executable(${target_name}
WIN32
MACOSX_BUNDLE
${${target_name}_SRC}
${${target_name}_moc_src}
${${target_name}_moc}
${ICON_SRC}
)
if (NINJA)
target_compile_definitions(${target_name} PRIVATE NINJA=1)
endif()
if(WIN32)
# increase stack size
target_link_options(${target_name} PRIVATE /STACK:8388608)
endif()
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/platforms/
)
if(WIN32)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/styles/
)
endif()
if(UNIX AND NOT APPLE)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/
)
endif()
if( APPLE )
# Note: JM: Qt 6.3.0, I can no longer access $<TARGET_FILE:Qt6::QCocoaIntegrationPlugin>
find_library(QT_QCOCOA NAMES libqcocoa.dylib PATHS "${QT_INSTALL_DIR}/plugins/platforms" NO_DEFAULT_PATH)
add_custom_command(TARGET ${target_name}
POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt6::QCocoaIntegrationPlugin> $<TARGET_FILE_DIR:${target_name}>/platforms/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_QCOCOA} $<TARGET_FILE_DIR:${target_name}>/platforms/
VERBATIM
)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "${openstudio_ROOT_DIR}/lib/" $<TARGET_FILE:${target_name}>
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "${QT_INSTALL_DIR}/lib/" $<TARGET_FILE:${target_name}>
# This is because Apple has app bundles for .apps.
# We copy the openstudio cli into the app bundle in an effort
# to be self contained. It also makes it easy to find the cli since
# it will be sitting next to the app executable.
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:openstudio::openstudio> $<TARGET_FILE_DIR:${target_name}>/$<TARGET_FILE_NAME:openstudio::openstudio>
# Local dev: find them in the actual OpenStudio root dir
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "${openstudio_ROOT_DIR}/lib/" $<TARGET_FILE_DIR:${target_name}>/$<TARGET_FILE_NAME:openstudio::openstudio>
# Runtime: it's already going to find them in in OpenStudioApp.app/Contents/Frameworks
)
#add_custom_command(TARGET ${target_name}
# POST_BUILD
# COMMAND ${QT_MACDEPLOY_QT} $<TARGET_BUNDLE_DIR:${target_name}> -verbose=2
#)
elseif( UNIX )
foreach(LIB ${QT_LIBS} ${QT_WEB_LIBS})
get_property(LIB_LOCATION TARGET ${LIB} PROPERTY LOCATION)
list(APPEND QT_LIB_LOCATIONS "${LIB_LOCATION}")
endforeach()
foreach(LIB_LOCATION ${QT_LIB_LOCATIONS} ${QT_EXTRA_LIBS})
# In case we grabed "xx.so", it'll be resolved to "xx.so.X.Y.Z" as we expect
get_filename_component(LIB_LOCATION_RESOLVED "${LIB_LOCATION}" REALPATH)
get_filename_component(LIB_BASE_NAME ${LIB_LOCATION_RESOLVED} NAME)
string(REGEX REPLACE "\\.[^.]*$" "" LIB_MAJOR_MINOR_NAME ${LIB_BASE_NAME})
string(REGEX REPLACE "\\.[^.]*$" "" LIB_MAJOR_NAME ${LIB_MAJOR_MINOR_NAME})
list(APPEND QT_LIB_SYMLINKS "${LIB_MAJOR_MINOR_NAME}" "${LIB_MAJOR_NAME}")
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_LOCATION_RESOLVED} $<TARGET_FILE_DIR:${target_name}>/
COMMAND ln -sf "${LIB_BASE_NAME}" "$<TARGET_FILE_DIR:${target_name}>/${LIB_MAJOR_MINOR_NAME}"
COMMAND ln -sf "${LIB_BASE_NAME}" "$<TARGET_FILE_DIR:${target_name}>/${LIB_MAJOR_NAME}"
COMMAND patchelf --set-rpath "$ORIGIN/." $<TARGET_FILE_DIR:${target_name}>/${LIB_BASE_NAME}
VERBATIM
)
endforeach()
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QtWebEngineProcess} $<TARGET_FILE_DIR:${target_name}>/
COMMAND chrpath -r "$ORIGIN/." $<TARGET_FILE_DIR:${target_name}>/QtWebEngineProcess
VERBATIM
)
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/qt.conf $<TARGET_FILE_DIR:${target_name}>
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${icudtl} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_devtools} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_100} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_200} $<TARGET_FILE_DIR:${target_name}>/resources/
#COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_v8_context_snapshot} $<TARGET_FILE_DIR:${target_name}>/resources/
)
# Note: JM: Qt 6.3.0, I can no longer access $<TARGET_FILE:Qt6::QXcbIntegrationPlugin>
find_library(QT_QXCB NAMES libqxcb.so PATHS "${QT_INSTALL_DIR}/plugins/platforms" NO_DEFAULT_PATH)
add_custom_command(TARGET ${target_name}
POST_BUILD
# Note: JM: Qt 6.3.0, I can no longer access $<TARGET_FILE:Qt6::QXcbIntegrationPlugin>
# COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt6::QXcbIntegrationPlugin> $<TARGET_FILE_DIR:${target_name}>/platforms/
# COMMAND patchelf --set-rpath "$ORIGIN/.." $<TARGET_FILE_DIR:${target_name}>/platforms/$<TARGET_FILE_NAME:Qt6::QXcbIntegrationPlugin>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_QXCB} $<TARGET_FILE_DIR:${target_name}>/platforms/
COMMAND patchelf --set-rpath "$ORIGIN/.." $<TARGET_FILE_DIR:${target_name}>/platforms/libqxcb.so
VERBATIM
)
find_library(QT_QXCB_GLX NAMES libqxcb-glx-integration.so PATHS "${QT_INSTALL_DIR}/plugins/xcbglintegrations" NO_DEFAULT_PATH)
add_custom_command(TARGET ${target_name}
POST_BUILD
# Note: JM: Qt 6.3.0, I can no longer access $<TARGET_FILE:Qt6::QXcbGlxIntegrationPlugin>
# COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt6::QXcbGlxIntegrationPlugin> $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/
# COMMAND chrpath -r "$ORIGIN/." $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/$<TARGET_FILE_NAME:Qt6::QXcbGlxIntegrationPlugin>
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_QXCB_GLX} $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/
COMMAND patchelf --set-rpath "$ORIGIN/.." $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/libqxcb-glx-integration.so
VERBATIM
)
elseif( WIN32 )
target_link_libraries(${target_name} optimized ${QT_ENTRYPOINT_LIB} debug ${QT_ENTRYPOINT_LIB_D})
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${QT_WINDEPLOY_QT} --dir $<TARGET_FILE_DIR:${target_name}> $<TARGET_FILE:${target_name}> )
add_custom_command(TARGET ${target_name}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/qt.conf $<TARGET_FILE_DIR:${target_name}>
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${icudtl} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_devtools} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_100} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_200} $<TARGET_FILE_DIR:${target_name}>/resources/
#COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_v8_context_snapshot} $<TARGET_FILE_DIR:${target_name}>/resources/
)
# On Windows, we must copy the DLLs inside the build folder or it won't find them
# TODO: IMPORTED_SONAME_RELEASE now contains @rpath so it fails
# get_target_property(LIBOSLIB openstudio::openstudiolib IMPORTED_LOCATION_RELEASE)
# add_custom_command(TARGET ${target_name}
# POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBOSLIB} $<TARGET_FILE_DIR:${target_name}>/ )
add_custom_command(TARGET ${target_name}
PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:openstudio::openstudio> $<TARGET_FILE_DIR:${target_name}>/
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:openstudio::openstudiolib> $<TARGET_FILE_DIR:${target_name}>/
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:openstudio::rubyengine> $<TARGET_FILE_DIR:${target_name}>/
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:openstudio::pythonengine> $<TARGET_FILE_DIR:${target_name}>/
)
endif()
set(depends
openstudio_lib
openstudio_bimserver
openstudio_modeleditor
openstudioapp_utilities
openstudio::openstudiolib
${QT_WEB_LIBS}
)
target_link_libraries(${target_name} ${depends})
#AddPCH(${target_name})
#------------------------------------------------------------------------------
# Installation
#------------------------------------------------------------------------------
if(APPLE)
set_target_properties(${target_name} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
set(plugin_dest_dir OpenStudioApp.app/Contents/MacOS)
set(APPS "\${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app")
elseif(WIN32)
set(plugin_dest_dir bin)
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/OpenStudioApp.exe")
else()
set_target_properties(${target_name} PROPERTIES INSTALL_RPATH "$ORIGIN:$ORIGIN/../lib/")
set(plugin_dest_dir bin)
set(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/OpenStudioApp")
endif()
if( APPLE )
install(TARGETS ${target_name}
DESTINATION .
COMPONENT "OpenStudioApp"
)
else()
install(TARGETS ${target_name}
DESTINATION bin
COMPONENT "OpenStudioApp"
)
endif()
# directories to look for dependencies
get_target_property(os_lib_location openstudio::openstudiolib LOCATION)
get_filename_component(os_lib_dir ${os_lib_location} DIRECTORY)
set(DIRS "${QT_INSTALL_DIR}/bin" "${QT_INSTALL_DIR}/lib" "${os_lib_dir}")
if(APPLE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/openstudio_app/Resources/
DESTINATION OpenStudioApp.app/Contents/Resources
COMPONENT "Resources"
)
elseif(WIN32)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/openstudio_app/Resources/
DESTINATION Resources
COMPONENT "Resources"
)
else()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/openstudio_app/Resources/
DESTINATION Resources
COMPONENT "Resources"
)
endif()
# since on apple the whole app bundle is installed (including these webkit components) we can exclude apple
if( NOT APPLE )
install(FILES $<TARGET_FILE_DIR:${target_name}>/qt.conf DESTINATION bin COMPONENT OpenStudioApp)
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/platforms/ DESTINATION bin/platforms/ COMPONENT OpenStudioApp)
if (WIN32)
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/styles/ DESTINATION bin/styles/ COMPONENT OpenStudioApp)
endif()
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/translations/ DESTINATION bin/translations/ COMPONENT OpenStudioApp)
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/resources/ DESTINATION bin/resources/ COMPONENT OpenStudioApp)
if(WIN32)
install(TARGETS OpenStudioApp DESTINATION bin COMPONENT OpenStudioApp )
# Done at top level CMakeLists.txt
# install(PROGRAMS $<TARGET_FILE:openstudio::openstudiolib> DESTINATION bin COMPONENT OpenStudioApp )
install(PROGRAMS ${QtWebEngineProcess} DESTINATION bin COMPONENT OpenStudioApp )
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/D3Dcompiler_47.dll DESTINATION bin/ COMPONENT OpenStudioApp)
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/opengl32sw.dll DESTINATION bin/ COMPONENT OpenStudioApp)
foreach(LIB ${QT_LIBS} ${QT_WEB_LIBS})
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/$<TARGET_FILE_NAME:${LIB}> DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()
list(APPEND QT_DIRS iconengines)
list(APPEND QT_DIRS imageformats)
list(APPEND QT_DIRS networkinformation)
list(APPEND QT_DIRS position)
list(APPEND QT_DIRS tls)
foreach(DIR ${QT_DIRS})
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/${DIR} DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()
elseif(UNIX)
# Let fixup_bundle do that for us
#install(PROGRAMS $<TARGET_FILE:openstudio::openstudiolib> DESTINATION bin COMPONENT OpenStudioApp )
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/QtWebEngineProcess DESTINATION bin/ COMPONENT OpenStudioApp)
install(DIRECTORY $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/ DESTINATION bin/xcbglintegrations/ COMPONENT OpenStudioApp)
# install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/xcbglintegrations/$<TARGET_FILE_NAME:Qt6::QXcbGlxIntegrationPlugin> DESTINATION bin/xcbglintegrations/ COMPONENT OpenStudioApp)
foreach(LIB ${QT_LIBS} ${QT_WEB_LIBS})
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/$<TARGET_FILE_NAME:${LIB}> DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()
foreach(LIB_LOCATION ${QT_EXTRA_LIBS})
get_filename_component(LIB_LOCATION_RESOLVED "${LIB_LOCATION}" REALPATH)
get_filename_component(LIB_BASE_NAME ${LIB_LOCATION_RESOLVED} NAME)
install(PROGRAMS $<TARGET_FILE_DIR:${target_name}>/${LIB_BASE_NAME} DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()
foreach(LINK ${QT_LIB_SYMLINKS})
install(FILES $<TARGET_FILE_DIR:${target_name}>/${LINK} DESTINATION bin/ COMPONENT OpenStudioApp)
endforeach()
endif()
endif()
if( APPLE )
list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/platforms/libqcocoa.dylib")
#list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/sceneparsers/libgltfsceneparser.dylib")
#list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/${plugin_dest_dir}/sceneparsers/libassimpsceneparser.dylib")
install(DIRECTORY ${QtWebEngineProcess} DESTINATION "OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/A/Helpers/" COMPONENT OpenStudioApp USE_SOURCE_PERMISSIONS)
# TODO: this is definitely a shot in the dark and is unlikely to work. The WebEngine .paks in particular probably need to live somewhere else
install(DIRECTORY $<TARGET_FILE_DIR:openstudio_lib>/translations/ DESTINATION "OpenStudioApp.app/Contents/translations/" COMPONENT OpenStudioApp)
list(APPEND QTPLUGINS "\${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app/Contents/MacOS/QtWebEngineProcess")
# Create a new symlink at OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app/Contents/Frameworks
# That point to OpenStudioApp.app/Contents/Frameworks. `cmake -E create_symlink old new - create a symbolic link new -> old`
# TODO: Somewhere there is something that copies the openstudio CLI into the OpenStudioApp.app/Contents/MacOS which is useless.
# TODO: We can also just symlink libopenstudio.lib into the OpenStudioApp.app/Contents/Frameworks directory instead of copying
install(CODE [[
execute_process(
COMMAND echo "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../../../../../../Frameworks"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/QtWebEngineCore.framework/Versions/A/Helpers/QtWebEngineProcess.app/Contents/Frameworks"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../EnergyPlus"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/EnergyPlus"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../Radiance"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Radiance"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../../lib/$<TARGET_FILE_NAME:openstudio::rubyengine>"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/$<TARGET_FILE_NAME:openstudio::rubyengine>"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../../lib/$<TARGET_FILE_NAME:openstudio::pythonengine>"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/$<TARGET_FILE_NAME:openstudio::pythonengine>"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../../lib/$<TARGET_FILE_NAME:openstudio::openstudiolib>"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/$<TARGET_FILE_NAME:openstudio::openstudiolib>"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_INSTALL_PREFIX}/bin"
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../OpenStudioApp.app/Contents/MacOS/$<TARGET_FILE_NAME:openstudio::openstudio>"
"${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:openstudio::openstudio>"
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY
)
]]
COMPONENT OpenStudioApp
)
endif()
# TODO: We used to run fixup_bundle on all plaforms before on 5.15.0...
if(UNIX)
# This does some "magic" **including on Linux** (cf #345) (On linux it will install in ./bin/ the libicu* stuff)
install(CODE "
# APPS might be a symbolic link which does not work with fixup_bundle
# expand APPS to a real path
get_filename_component(APPS_EXPANDED ${APPS} REALPATH)
include(BundleUtilities)
# This file defines some libs we are excluding. Some like concrt140.dll are installed already via InstallRequiredSystemLibraries
include(\"${CMAKE_SOURCE_DIR}/CMake/FixupBundleOverrides.cmake\")
fixup_bundle(\"\${APPS_EXPANDED}\" \"${QTPLUGINS}\" \"${DIRS}\")
" COMPONENT "OpenStudioApp"
)
endif()
if(APPLE)
# This is kinda gross, but I can't seem to manage to get fixup_bundle to not trash the RPATH of Contents/MacOS/openstudio... But it will copy at Contents/Frameworks/libopenstudiolib.dylib
# So here I just override it with a symlink.
install(CODE [[
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink
"../../../lib/$<TARGET_FILE_NAME:openstudio::openstudiolib>"
"${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/$<TARGET_FILE_NAME:openstudio::openstudiolib>"
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY
)
]]
COMPONENT OpenStudioApp
)
endif()
set(${target_name}_test_src
test/OpenStudioAppFixture.hpp
test/OpenStudioAppFixture.cpp
test/Resources_GTest.cpp
test/Units_GTest.cpp
)
CREATE_SRC_GROUPS("${${target_name}_test_src}")
if(BUILD_TESTING)
set(${target_name}_test_depends
${depends}
)
CREATE_TEST_TARGETS(${target_name} "${${target_name}_test_src}" "${${target_name}_test_depends}")
#add_dependencies("${target_name}_tests"
# openstudio_app_resources
#)
endif()