GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — solvespace/src/CMakeLists.txt at Android · solvespace/solvespace

Expand file tree

/

CMakeLists.txt

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
590 lines (522 loc) · 20.8 KB
/

CMakeLists.txt

Copy path

File metadata and controls

590 lines (522 loc) · 20.8 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
include(GNUInstallDirs)
# configuration
set(HAVE_SPACEWARE ${SPACEWARE_FOUND})
if(NOT WIN32 OR APPLE)
if(GTKMM_gtkmm-3.0_VERSION VERSION_LESS "3.24.0")
set(HAVE_GTK_FILECHOOSERNATIVE 0)
else()
set(HAVE_GTK_FILECHOOSERNATIVE 1)
endif()
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
if(USE_QT_GUI)
set(CMAKE_AUTOMOC ON)
find_package(Qt6 COMPONENTS Core Gui OpenGLWidgets Widgets REQUIRED)
# find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
qt_add_resources(RESOURCE_FILES ../res/qt-resources.qrc)
endif()
# solvespace dependencies
add_library(slvs_deps INTERFACE)
target_include_directories(slvs_deps SYSTEM INTERFACE
${OPENGL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${PNG_PNG_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${MIMALLOC_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIRS})
target_link_libraries(slvs_deps INTERFACE
dxfrw
${ZLIB_LIBRARY}
${PNG_LIBRARY}
${FREETYPE_LIBRARY}
mimalloc-static)
if(NOT USE_QT_GUI AND NOT ANDROID OR ENABLE_CLI)
target_include_directories(slvs_deps SYSTEM INTERFACE ${CAIRO_INCLUDE_DIRS})
target_link_libraries(slvs_deps INTERFACE ${CAIRO_LIBRARIES})
endif()
if(Backtrace_FOUND)
target_include_directories(slvs_deps SYSTEM INTERFACE
${Backtrace_INCLUDE_DIRS})
target_link_libraries(slvs_deps INTERFACE
${Backtrace_LIBRARY})
endif()
if(SPACEWARE_FOUND)
target_include_directories(slvs_deps SYSTEM INTERFACE
${SPACEWARE_INCLUDE_DIR})
target_link_libraries(slvs_deps INTERFACE
${SPACEWARE_LIBRARIES})
endif()
if(ENABLE_OPENMP)
target_link_libraries(slvs_deps INTERFACE slvs_openmp)
endif()
target_compile_options(slvs_deps
INTERFACE ${COVERAGE_FLAGS})
# platform utilities
if(APPLE)
target_link_libraries(slvs_deps INTERFACE
${APPKIT_LIBRARY})
endif()
# Solver
add_library(slvs-solver INTERFACE)
target_sources(slvs-solver INTERFACE
dsc.h
expr.h
handle.h
param.h
platform/platform.h
solvespace.h
constrainteq.cpp
entity.cpp
expr.cpp
platform/platformbase.cpp
system.cpp
util.cpp
)
target_include_directories(slvs-solver SYSTEM INTERFACE
${MIMALLOC_INCLUDE_DIR}
${EIGEN3_INCLUDE_DIRS})
target_include_directories(slvs-solver INTERFACE
${CMAKE_CURRENT_SOURCE_DIR})
# Needed for CI
file(WRITE ${CMAKE_BINARY_DIR}/version.env "\
VERSION_MAJOR=${PROJECT_VERSION_MAJOR}\n\
VERSION_MINOR=${PROJECT_VERSION_MINOR}\n\
VERSION_PATCH=0\n\
VERSION_GIT_HASH=${solvespace_GIT_HASH}\n\
")
if(ENABLE_GUI OR ENABLE_CLI)
set(every_platform_SOURCES
platform/guiwin.cpp
platform/guigtk.cpp
platform/guimac.mm
platform/guihtml.cpp
platform/guidroid.cpp)
# solvespace library
set(solvespace_core_gl_SOURCES
solvespace.cpp)
add_library(solvespace-core STATIC
polygon.h
sketch.h
ui.h
render/render.h
srf/surface.h
bsp.cpp
clipboard.cpp
confscreen.cpp
constraint.cpp
describescreen.cpp
draw.cpp
drawconstraint.cpp
drawentity.cpp
export.cpp
exportstep.cpp
exportvector.cpp
file.cpp
generate.cpp
graphicswin.cpp
group.cpp
groupmesh.cpp
importdxf.cpp
importidf.cpp
importmesh.cpp
mesh.cpp
modify.cpp
mouse.cpp
polyline.cpp
polygon.cpp
resource.cpp
request.cpp
style.cpp
textscreens.cpp
textwin.cpp
toolbar.cpp
ttf.cpp
undoredo.cpp
view.cpp
platform/platform.cpp
platform/gui.cpp
render/render.cpp
render/render2d.cpp
srf/boolean.cpp
srf/curve.cpp
srf/merge.cpp
srf/ratpoly.cpp
srf/raycast.cpp
srf/shell.cpp
srf/surface.cpp
srf/surfinter.cpp
srf/triangulate.cpp)
target_include_directories(solvespace-core PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(solvespace-core PRIVATE slvs-solver)
target_link_libraries(solvespace-core PUBLIC slvs_deps)
if(ANDROID)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set_target_properties(solvespace-core PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_link_libraries(solvespace-core
PUBLIC
${droid-lib}
${log-lib})
endif()
# solvespace translations
if(HAVE_GETTEXT)
get_target_property(solvespace_core_SOURCES solvespace-core SOURCES)
set(inputs
${solvespace_core_SOURCES}
${every_platform_SOURCES}
${solvespace_core_gl_SOURCES})
set(templ_po ${CMAKE_CURRENT_BINARY_DIR}/../res/messages.po)
set(output_pot ${CMAKE_CURRENT_SOURCE_DIR}/../res/messages.pot)
set(output_po ${CMAKE_CURRENT_SOURCE_DIR}/../res/locales/en_US.po)
file(GLOB locale_pos ${CMAKE_CURRENT_SOURCE_DIR}/../res/locales/*.po)
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
gen_output_pot ${output_pot}.gen)
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
gen_output_po ${output_po}.gen)
foreach(locale_po ${locale_pos})
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
gen_locale_po ${locale_po}.gen)
list(APPEND gen_locale_pos ${gen_locale_po})
endforeach()
add_custom_command(
OUTPUT ${gen_output_pot}
COMMAND ${XGETTEXT}
--language=C++
--keyword --keyword=_ --keyword=N_ --keyword=C_:2,1c --keyword=CN_:2,1c
--force-po --width=100 --sort-by-file
--package-name=SolveSpace
--package-version=${PROJECT_VERSION}
"--copyright-holder=the PACKAGE authors"
[email protected]
--from-code=utf-8 --output=${gen_output_pot} ${inputs}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${gen_output_pot} ${output_pot}
DEPENDS ${inputs}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Extracting translations"
VERBATIM)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../res/locales)
# en_US is a bit special; we pre-fill the msgstrs from msgids, instead of (as would normally
# happen) leaving them empty.
add_custom_command(
OUTPUT ${gen_output_po}
COMMAND ${MSGINIT}
--locale=en_US --no-translator
--output=${templ_po} --input=${gen_output_pot}
COMMAND ${MSGMERGE}
--force-po --no-fuzzy-matching
--output=${gen_output_po} ${output_po} ${templ_po}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${gen_output_po} ${output_po}
DEPENDS ${gen_output_pot}
COMMENT "Updating en_US translations"
VERBATIM)
foreach(locale_po ${locale_pos})
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}
gen_locale_po ${locale_po}.gen)
get_filename_component(locale_name ${locale_po} NAME_WE)
if(locale_name STREQUAL "en_US")
continue()
endif()
add_custom_command(
OUTPUT ${gen_locale_po}
COMMAND ${MSGMERGE}
--no-fuzzy-matching
--output=${gen_locale_po} ${locale_po} ${gen_output_pot}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${gen_locale_po} ${locale_po}
DEPENDS ${gen_output_pot}
COMMENT "Updating ${locale_name} translations"
VERBATIM)
endforeach()
add_custom_target(translate_solvespace
DEPENDS ${gen_output_pot} ${gen_output_po} ${gen_locale_pos})
endif()
endif()
# solvespace graphical executable
if(ENABLE_GUI)
if(ANDROID)
add_library(solvespace
SHARED
${solvespace_core_gl_SOURCES}
$<TARGET_PROPERTY:resources,EXTRA_SOURCES>)
else()
add_executable(solvespace WIN32 MACOSX_BUNDLE
${solvespace_core_gl_SOURCES}
$<TARGET_PROPERTY:resources,EXTRA_SOURCES>)
endif()
if(NOT USE_QT_GUI AND NOT ANDROID)
target_sources(solvespace PRIVATE platform/entrygui.cpp)
endif()
add_dependencies(solvespace
resources)
target_link_libraries(solvespace
PRIVATE
solvespace-core
${OPENGL_LIBRARIES})
# OpenGL version
if(OPENGL STREQUAL 3)
target_sources(solvespace PRIVATE
render/gl3shader.cpp
render/rendergl3.cpp)
elseif(OPENGL STREQUAL 1)
target_sources(solvespace PRIVATE
render/rendergl1.cpp)
else()
message(FATAL_ERROR "Unsupported OpenGL version ${OPENGL}")
endif()
# Platform-specific
if(WIN32 AND NOT USE_QT_GUI)
target_sources(solvespace PRIVATE
platform/guiwin.cpp)
target_link_libraries(solvespace PRIVATE comctl32)
elseif(APPLE)
target_compile_options(solvespace PRIVATE -fobjc-arc)
target_compile_definitions(solvespace PRIVATE GL_SILENCE_DEPRECATION)
target_sources(solvespace PRIVATE
platform/guimac.mm)
set_target_properties(solvespace PROPERTIES
OUTPUT_NAME SolveSpace
XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES"
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.solvespace"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
elseif(EMSCRIPTEN)
# Due to the response file hack below, we need a version of Emscripten that
# passes arguments via a response file to the `file_packager` utility, but
# this was not the case prior to version 4.0.8 of Emscripten.
# See https://github.com/emscripten-core/emscripten/pull/24107
if(NOT EMSCRIPTEN_VERSION OR EMSCRIPTEN_VERSION VERSION_LESS "4.0.8")
message(FATAL_ERROR "The Emscripten build requires at least version 4.0.8")
endif()
target_compile_features(solvespace PRIVATE cxx_std_17)
set(SHELL "${CMAKE_CURRENT_SOURCE_DIR}/platform/html/emshell.html")
# Add internal quotes to paths used in the response file to ensure that paths
# that contain spaces are handled correctly
set(RESP_LINK_FLAGS
--bind --shell-file "\"${SHELL}\"" --no-heap-copy
"-s ALLOW_MEMORY_GROWTH=1" "-s WASM=1"
"-s ASYNCIFY=1" "-s DYNCALLS=1" "-s ASSERTIONS=1"
"-s TOTAL_STACK=33554432" "-s TOTAL_MEMORY=134217728")
get_target_property(resource_list resources SOURCES)
foreach(resource ${resource_list})
# Strip everything before `res/...`, and map the source path to the stripped
# path in the virtual Emscripten fileystem
file(RELATIVE_PATH target_path "${CMAKE_SOURCE_DIR}" "${resource}")
list(APPEND RESP_LINK_FLAGS "--preload-file \"${resource}\"@\"${target_path}\"")
endforeach()
if(CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND RESP_LINK_FLAGS
--emrun --emit-symbol-map
"-s DEMANGLE_SUPPORT=1"
"-s SAFE_HEAP=1")
endif()
target_sources(solvespace PRIVATE
platform/guihtml.cpp)
# Pass arguments through a response file in order to avoid exceeding the maximum
# command line length (the Emscripten tools on Windows are all wrapped by batch
# scripts, and as such are subject to the CMD length limit of 8KiB).
set(resp_file_path "${CMAKE_CURRENT_BINARY_DIR}/emscripten_flags.rsp")
file(GENERATE OUTPUT "${resp_file_path}" CONTENT "$<JOIN:${RESP_LINK_FLAGS},\n>")
# NOTE: it would be ideal if we could portably specify that linking depends on the
# response file (and the files that are specified in it), but unfortunately there
# is no way to reliably trigger a relink like that without using LINK_DEPENDS,
# which only works with the Ninja and Makefile generators.
# This means that using e.g. the Visual Studio of Xcode generators will not work
# correctly when any of the link time dependencies changes, so the output artefact
# needs to be explicitly deleted in order to trigger a relink.
set_target_properties(solvespace PROPERTIES
SUFFIX ".html"
LINK_FLAGS "@${resp_file_path}"
LINK_DEPENDS "${SHELL};${resp_file_path};${resource_list}")
add_custom_command(
TARGET solvespace POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/platform/html/solvespaceui.css
${EXECUTABLE_OUTPUT_PATH}/solvespaceui.css
COMMENT "Copying UI stylesheet"
VERBATIM)
add_custom_command(
TARGET solvespace POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/platform/html/solvespaceui.js
${EXECUTABLE_OUTPUT_PATH}/solvespaceui.js
COMMENT "Copying UI script solvespaceui.js"
VERBATIM)
add_custom_command(
TARGET solvespace POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/platform/html/filemanagerui.js
${EXECUTABLE_OUTPUT_PATH}/filemanagerui.js
COMMENT "Copying UI script filemanagerui.sj"
VERBATIM)
elseif(USE_QT_GUI)
set_target_properties(solvespace PROPERTIES
OUTPUT_NAME solvespace-qt)
target_sources(solvespace PRIVATE
platform/guiqt.cpp
platform/guiqt.h
${RESOURCE_FILES})
target_include_directories(solvespace SYSTEM PRIVATE
${FONTCONFIG_INCLUDE_DIRS})
target_link_directories(solvespace PRIVATE
${FONTCONFIG_LIBRARY_DIRS})
target_link_libraries(solvespace PRIVATE
${FONTCONFIG_LIBRARIES}
Qt6::Core Qt6::Gui Qt6::OpenGLWidgets Qt6::Widgets
# Qt5::Core Qt5::Gui Qt5::Widgets
)
elseif(ANDROID)
target_sources(solvespace PRIVATE
platform/guidroid.cpp)
file(GLOB_RECURSE java_src platform/java/*.java)
set(LIBDIR lib/${ANDROID_ABI})
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(HOME $ENV{USERPROFILE})
set(LIST_CLS dir /s /b classes\\*.class)
else()
set(HOME $ENV{HOME})
set(LIST_CLS find classes -name *.class)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
set(strip ${CMAKE_STRIP} -s ${LIBDIR}/libsolvespace.so)
else()
set(strip "")
endif()
file(TO_NATIVE_PATH ${HOME}/.android/debug.keystore kspath)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/cls.txt
COMMAND javac -cp ${ANDROID_JAR} -source 1.8 -target 1.8
-d classes
${java_src} gen/com/solvespace/R.java
COMMAND ${LIST_CLS} > cls.txt
DEPENDS ${java_src} aapt_pre
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Compiling java"
VERBATIM)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/classes.dex
COMMAND ${BUILD_TOOL}/d8 --output ./ --lib ${ANDROID_JAR} --min-api 21 @cls.txt
DEPENDS ${CMAKE_BINARY_DIR}/cls.txt
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Dexing classes to dex"
VERBATIM)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/bin/app.apk
COMMAND ${strip}
COMMAND jar -u -f bin/res.apk classes.dex ${LIBDIR}/libsolvespace.so
COMMAND ${BUILD_TOOL}/zipalign -f -p 4 bin/res.apk bin/app.apk
COMMAND ${BUILD_TOOL}/apksigner sign --ks ${kspath} --ks-pass pass:android --v2-signing-enabled false bin/app.apk
DEPENDS ${CMAKE_BINARY_DIR}/classes.dex solvespace
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Packaging"
VERBATIM)
add_custom_target(gen_apk ALL
DEPENDS ${CMAKE_BINARY_DIR}/bin/app.apk)
set_directory_properties(PROPERTIES ADDITIONAL_CLEAN_FILES
${CMAKE_BINARY_DIR}/classes/)
else()
target_sources(solvespace PRIVATE
platform/guigtk.cpp)
target_include_directories(solvespace SYSTEM PRIVATE
${GTKMM_INCLUDE_DIRS}
${JSONC_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS})
target_link_directories(solvespace PRIVATE
${GTKMM_LIBRARY_DIRS}
${JSONC_LIBRARY_DIRS}
${FONTCONFIG_LIBRARY_DIRS})
target_link_libraries(solvespace PRIVATE
${GTKMM_LIBRARIES}
${JSONC_LIBRARIES}
${FONTCONFIG_LIBRARIES})
endif()
if(WIN32)
if(MSVC)
set_target_properties(solvespace PROPERTIES
LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /INCREMENTAL:NO /OPT:REF")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND MSVC_VERSION)
# Hack to fix broken build with clang (not clang-cl) on Windows with CMake >= 3.22
# which unconditionally adds "-Xlinker /MANIFEST:EMBED" to the command line
# for non-MSVC and non-MINGW compilers, and breaks the clang build where
# manifest are specified through resource files.
# See:
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6929
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6534
# https://gitlab.kitware.com/cmake/cmake/-/issues/22611
string(REPLACE " -Xlinker /MANIFEST:EMBED" ""
CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}")
target_link_options(solvespace PRIVATE
"SHELL:-Xlinker /MANIFEST:NO")
endif()
endif()
endif()
if(ENABLE_CLI)
# solvespace headless library
add_library(solvespace-headless STATIC EXCLUDE_FROM_ALL
${solvespace_core_gl_SOURCES}
platform/guinone.cpp
render/rendercairo.cpp)
target_compile_definitions(solvespace-headless
PRIVATE HEADLESS)
target_include_directories(solvespace-headless
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${EIGEN3_INCLUDE_DIRS})
target_link_libraries(solvespace-headless
PRIVATE
solvespace-core)
# solvespace command-line executable
add_executable(solvespace-cli
platform/entrycli.cpp
$<TARGET_PROPERTY:resources,EXTRA_SOURCES>)
target_link_libraries(solvespace-cli
solvespace-core
solvespace-headless)
add_dependencies(solvespace-cli
resources)
if(MSVC)
set_target_properties(solvespace-cli PROPERTIES
LINK_FLAGS "/INCREMENTAL:NO /OPT:REF")
endif()
endif()
# solvespace unix package
if(NOT (WIN32 OR APPLE OR EMSCRIPTEN))
if(ENABLE_GUI)
install(TARGETS solvespace
COMPONENT solvespace
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
if(ENABLE_CLI)
install(TARGETS solvespace-cli
COMPONENT solvespace
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
# solvespace macOS package
if(APPLE)
set(LIBOMP_LIB_PATH ${OpenMP_CXX_INCLUDE_DIRS}/../lib/libomp.dylib)
set(LIBOMP_LINK_PATH "@executable_path/../Resources/libomp.dylib")
set(LIBOMP_LINK_PATH_UTILS "@executable_path/SolveSpace.app/Contents/Resources/libomp.dylib")
if(ENABLE_GUI)
add_custom_command(TARGET solvespace POST_BUILD
COMMAND cp -r ${CMAKE_BINARY_DIR}/Resources $<TARGET_BUNDLE_CONTENT_DIR:solvespace>
)
if(ENABLE_OPENMP)
execute_process(COMMAND install_name_tool -id ${LIBOMP_LINK_PATH} ${LIBOMP_LIB_PATH})
message("FROM " ${${LIBOMP_LIB_PATH}} "TO" $<TARGET_BUNDLE_CONTENT_DIR:solvespace>/Resources/libomp.dylib)
add_custom_command(TARGET solvespace POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMP_LIB_PATH} $<TARGET_BUNDLE_CONTENT_DIR:solvespace>/Resources/libomp.dylib
COMMAND install_name_tool -change ${LIBOMP_LINK_PATH} ${LIBOMP_LINK_PATH_UTILS} $<TARGET_FILE:solvespace-debugtool>
)
endif()
endif()
if(ENABLE_TESTS AND ENABLE_OPENMP)
add_custom_command(TARGET solvespace POST_BUILD
COMMAND install_name_tool -change ${LIBOMP_LINK_PATH} ${LIBOMP_LINK_PATH_UTILS} $<TARGET_FILE:solvespace-testsuite>)
endif()
if(ENABLE_CLI)
add_custom_command(TARGET solvespace POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:solvespace-cli> $<TARGET_FILE_DIR:solvespace>
COMMENT "Bundling executable solvespace-cli"
VERBATIM)
endif()
endif()
add_subdirectory(slvs)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.