forked from sandialabs/InterSpec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1543 lines (1366 loc) · 51.8 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
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
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This CMakeLists potentially defines two items, InterSpecLib and for all targets
# excpet iOS, Android, and Electron, InterSpecExe
cmake_policy(SET CMP0048 NEW)
project(InterSpec VERSION 1.0.7)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_COLOR_MAKEFILE ON CACHE BOOL "Color" FORCE)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
set(MSVC_RUNTIME "static")
set(TRY_TO_STATIC_LINK "ON")
include(cmake/ConfigureMsvc.txt)
configure_msvc_runtime()
set(BOOST_PREFIX "C:/install/msvc2017/x64/boost_1_65_1")
set(ZLIB_PREFIX "C:/install/msvc2017/x64/zlib")
list(APPEND PATH_SUFFIXES "C:/install/msvc2017/x64/wt-3.3.4")
set(EXECUTABLE_OUTPUT_PATH . CACHE PATH "Path to executables" FORCE)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} /bigobj -D_SCL_SECURE_NO_WARNINGS /MP /wd4996 /wd4267 /DWINVER=0x0601 /D_WIN32_WINNT=0x0601"
)
#0x0601==Win7, 0x0501==WinXP
else(WIN32)
set(EXECUTABLE_OUTPUT_PATH bin CACHE PATH "Path to executables" FORCE)
endif(WIN32)
SET(MYSQL_DATABASE_TO_USE "dev" CACHE STRING "Which mysql database to use (if applicable): dev/qc/prod")
option(BUILD_AS_OSX_APP "Build a OSX native app" OFF)
option(
BUILD_AS_ELECTRON_APP
"Configures the executable to be ran as a Electron app"
OFF
)
option(
BUILD_FOR_WEB_DEPLOYMENT
"Selects options appropriate for the web in the future"
OFF
)
option(
BUILD_AS_LOCAL_SERVER
"Build for use as a server for local computer (e.g. run from the command line and connect to with a browser on LOCALHOST)"
ON
)
option(
BUILD_AS_UNIT_TEST_SUITE
"Builds unit tests as well the analysis tests (aka end-to-end tests)"
OFF
)
option(
BUILD_AS_OFFLINE_ANALYSIS_TEST_SUITE
"Compiles so executable only does offline testing of the user test states in the database (e.g. end-to-end testing)"
OFF
)
set(TEST_SUITE_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/testing"
CACHE STRING
"Path to directory that contains the \"analysis_tests\" directory for saving N42 test states. Leave empty for CWD."
)
option(
BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT
"Build executable for use while testing new code, not running InterSpec"
OFF
)
option(
INCLUDE_ANALYSIS_TEST_SUITE
"Allow whether user can save and load test spectra"
OFF
)
option(
PERFORM_DEVELOPER_CHECKS
"Performs additional computationally expensive tests during execution"
off
)
option(
USE_OSX_NATIVE_MENU
"Mirrors WMenus with OSX native NSMenu (not fully implemented)"
off
)
option(
USE_ELECTRON_NATIVE_MENU
"Mirrors WMenus with Electrons native Menu (not fully implemented)"
OFF
)
option(
USE_ELECTRON_HTML_MENU
"Customizes WMenu to act closer to OS application menu, and reduces size of application titlebar (implementation in progress)"
OFF
)
option(
USE_HIGH_BANDWIDTH_INTERACTIONS
"Allow more interactiveness with the charts"
ON
)
option(
SUPPORT_ZIPPED_SPECTRUM_FILES
"(Work in progress) Allows opening zipped spectrum files"
ON
)
option(TRY_TO_STATIC_LINK "Try to link to static libs whenever possible" OFF)
option(
DRAW_GAMMA_LINES_LOG_AND_LIN
"Have gamma lines indicators be drawn in log mode when y-axis is log"
OFF
)
option(
ALLOW_URL_TO_FILESYSTEM_MAP
"Allows a file ID to be specified in the URL to open a file from the filesystem"
ON
)
option(USE_DB_TO_STORE_SPECTRA "Use the database to store spectra" ON)
option(
RENDER_REFERENCE_PHOTOPEAKS_SERVERSIDE
"Render photopeaks server-side rather than client side"
ON
)
option(
USE_SPECRUM_FILE_QUERY_WIDGET
"Enables compilation of the spectrum file query tool (not for web deployment)"
OFF
)
option(
USE_FEATURE_MARKER_WIDGET
"Use the feature marker widget to display feature marker options"
ON
)
option(
USE_SEARCH_MODE_3D_CHART
"Enable 3D chart or searchmode/passthrough data. Requires Wt >=3.3.4 compiled with WebGL/OpenGL support"
ON
)
option(USE_TERMINAL_WIDGET "Enables use of terminal widget" ON)
set(SpecUtils_ENABLE_D3_CHART ON
CACHE BOOL "Enables use of exporting D3 HTML files"
)
option(
USE_SPECTRUM_CHART_D3
"(experimental) Replaces Wt SpectrumChart with D3.js chart"
ON
)
option(
USE_SIMPLE_NUCLIDE_ASSIST
"Enable using of Mike E. gamma rays of interest to help with nuclide ID"
OFF
)
option(
USE_SQLITE3_DB
"Use SQLITE3 database to store user preferences and spectra"
ON
)
option(
USE_MYSQL_DB
"Use MySQL database to store user preferences and spectra"
OFF
)
option(USE_GOOGLE_MAP "Use google maps widget" ON)
option(
DECAY_CHART_ADD_IMAGE_DOWNLOAD_LINK
"Include support for downloading images of the displayed page"
OFF
)
set(MAX_SPECTRUM_MEMMORY_SIZE_MB 256
CACHE STRING
"Amount of memory to allow spectra to take up before trying to offload them onto disk when not in use"
)
set(GOOGLE_MAPS_KEY "" CACHE STRING "Google maps api key.")
set(GUI_TYPE "")
if(WIN32 OR BUILD_AS_OSX_APP OR BUILD_AS_ELECTRON_APP)
set(TRY_TO_STATIC_LINK "ON")
endif(WIN32 OR BUILD_AS_OSX_APP OR BUILD_AS_ELECTRON_APP)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
#Default to debug
SET(CMAKE_BUILD_TYPE Debug CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
# Set the possible values of build type for cmake-gui
set_property(
CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo"
)
endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
if(BUILD_AS_UNIT_TEST_SUITE)
set(BUILD_AS_OFFLINE_ANALYSIS_TEST_SUITE ON)
endif(BUILD_AS_UNIT_TEST_SUITE)
if(BUILD_AS_OFFLINE_ANALYSIS_TEST_SUITE)
set(INCLUDE_ANALYSIS_TEST_SUITE ON)
endif(BUILD_AS_OFFLINE_ANALYSIS_TEST_SUITE)
if(INCLUDE_ANALYSIS_TEST_SUITE)
set(USE_DB_TO_STORE_SPECTRA ON)
endif(INCLUDE_ANALYSIS_TEST_SUITE)
if(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
set(PERFORM_DEVELOPER_CHECKS ON)
endif(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
#get rid of a million warnings by Wt/Dbo/ptr_impl.h in VS2015
add_definitions("/wd4297")
add_definitions("/wd4244")
#set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
if(ANDROID)
set(BUILD_AS_LOCAL_SERVER OFF)
set(ALLOW_URL_TO_FILESYSTEM_MAP ON)
set(TRY_TO_STATIC_LINK ON)
set(MAX_SPECTRUM_MEMMORY_SIZE_MB 32)
set(USE_DB_TO_STORE_SPECTRA ON)
set(USE_HIGH_BANDWIDTH_INTERACTION ON)
set(USE_SPECRUM_FILE_QUERY_WIDGET OFF)
set(USE_TERMINAL_WIDGET OFF)
set(SpecUtils_ENABLE_D3_CHART OFF)
set(USE_SPECTRUM_CHART_D3 OFF)
set(INCLUDE_ANALYSIS_TEST_SUITE OFF)
set(SHARED_LIBS OFF)
add_definitions(-DANDROID -DWT_NO_STD_WSTRING=ON -DWT_NO_STD_LOCALE=ON)
#This is just painful. I cant get the find_* macros to work with the CMake
# included as part of Android Studio... After wasting what seems like an entire
# day, its time for the brute force solution
if(NOT BOOST_WT_PREFIX_BASE)
message(
fatal
"You must define BOOST_WT_PREFIX_BASE when building Android build"
)
endif(NOT BOOST_WT_PREFIX_BASE)
set(USRPREFIX "${BOOST_WT_PREFIX_BASE}/${ANDROID_ABI}")
set(BOOST_LIB_START "${USRPREFIX}/lib/libboost_")
set(BOOST_LIB_END "-clang-darwin-mt-1_65_1.a")
list(APPEND CMAKE_FIND_ROOT_PATH "${USRPREFIX}")
set(BOOST_PREFIX "${USRPREFIX}")
set(Boost_LIBRARY_DIR "${USRPREFIX}/lib")
set(Boost_INCLUDE_DIR "${USRPREFIX}/include")
set(Boost_ATOMIC_LIBRARY_RELEASE ${BOOST_LIB_START}atomic${BOOST_LIB_END})
set(Boost_CHRONO_LIBRARY_RELEASE ${BOOST_LIB_START}chrono${BOOST_LIB_END})
set(Boost_DATE_TIME_LIBRARY_RELEASE
${BOOST_LIB_START}date_time${BOOST_LIB_END}
)
set(Boost_FILESYSTEM_LIBRARY_RELEASE
${BOOST_LIB_START}filesystem${BOOST_LIB_END}
)
set(Boost_IOSTREAMS_LIBRARY_RELEASE
${BOOST_LIB_START}iostreams${BOOST_LIB_END}
)
set(Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE
${BOOST_LIB_START}program_options${BOOST_LIB_END}
)
set(Boost_RANDOM_LIBRARY_RELEASE ${BOOST_LIB_START}random${BOOST_LIB_END})
set(Boost_REGEX_LIBRARY_RELEASE ${BOOST_LIB_START}regex${BOOST_LIB_END})
set(Boost_SYSTEM_LIBRARY_RELEASE ${BOOST_LIB_START}system${BOOST_LIB_END})
set(Boost_THREAD_LIBRARY_RELEASE ${BOOST_LIB_START}thread${BOOST_LIB_END})
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE
${BOOST_LIB_START}unit_test_framework${BOOST_LIB_END}
)
set(Boost_SIGNALS_LIBRARY_RELEASE ${BOOST_LIB_START}signals${BOOST_LIB_END})
set(Boost_SERIALIZATION_LIBRARY_RELEASE
${BOOST_LIB_START}serialization${BOOST_LIB_END}
)
set(Wt_INCLUDE_DIR=${USRPREFIX}/include)
set(Wt_LIBRARY=${USRPREFIX}/lib/libwt.a)
set(Wt_TEST_LIBRARY=${USRPREFIX}/lib/libwttest.a)
set(Wt_HTTP_LIBRARY=${USRPREFIX}/lib/libwthttp.a)
set(Wt_DBO_LIBRARY=${USRPREFIX}/lib/libwtdbo.a)
set(Wt_DBOSQLITE3_LIBRARY=${USRPREFIX}/lib/libwtdbosqlite3.a)
endif(ANDROID)
if(IOS)
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "7.0"
CACHE STRING "Set the minimum deployment target value."
FORCE
)
#For iOS we have to use libtool instead of ar so that the platform (armv7, armv7s, arm64, etc) are kept track of in the archive
SET(CMAKE_AR "libtool" )
#CMake adds a cq after the archive command by default, we need to change this to "-static -o"
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -static -o <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -static -o <TARGET> <LINK_FLAGS> <OBJECTS>")
set(BUILD_AS_LOCAL_SERVER OFF)
set(ALLOW_URL_TO_FILESYSTEM_MAP ON)
set(INCLUDE_ANALYSIS_TEST_SUITE OFF)
set(PERFORM_DEVELOPER_CHECKS OFF)
set(TRY_TO_STATIC_LINK ON)
set(USE_SPECRUM_FILE_QUERY_WIDGET OFF)
set(MAX_SPECTRUM_MEMMORY_SIZE_MB "32")
set(FRAMEWORKDIR "${CMAKE_CURRENT_SOURCE_DIR}/target/ios")
set(CMAKE_SYSTEM_FRAMEWORK_PATH "${FRAMEWORKDIR}")
set(USE_BOOST_FRAMEWORK OFF)
set(DEFAULT_WT_BOOST_DISCOVERY TRUE)
set(CMAKE_FRAMEWORK_PATH "${FRAMEWORKDIR}")
set(BOOST_FRAMEWORK_PATH "${CMAKE_FRAMEWORK_PATH}/framework/boost.framework")
set(BOOST_PREFIX "${FRAMEWORKDIR}/prefix")
set(Boost_DIR "${FRAMEWORKDIR}/prefix")
set(Boost_INCLUDE_DIR "${Boost_DIR}/include")
set(Boost_LIBRARY_DIRS "${Boost_DIR}/lib")
set(BOOST_LIBRARYDIR "${Boost_DIR}/lib")
set(BOOST_ROOT "${Boost_DIR}")
SET(CMAKE_MODULE_PATH ${Boost_DIR} ${CMAKE_MODULE_PATH} )
set(SHARED_LIBS OFF)
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${Boost_DIR})
set(SUPPORT_ZIPPED_SPECTRUM_FILES ON)
set(SpecUtils_ENABLE_D3_CHART ON)
set(USE_SPECTRUM_CHART_D3 ON)
#if you change this IPHONEOS_DEPLOYMENT_TARGET also change the variable in
# iosbuild.rb everywhere, and in the Xcode project.
set(ENV{IPHONEOS_DEPLOYMENT_TARGET} 10.2)
#We know where Wt is for iOS, so just force it
if(NOT Wt_INCLUDE_DIR)
SET(Wt_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target/ios/prefix")
SET(Wt_INCLUDE_DIR "${Wt_DIR}/include")
endif(NOT Wt_INCLUDE_DIR)
endif(IOS)
if(BUILD_AS_OSX_APP)
set(ALLOW_URL_TO_FILESYSTEM_MAP ON)
set(USE_OSX_NATIVE_MENU ON)
set(USE_SPECRUM_FILE_QUERY_WIDGET ON)
set(SpecUtils_ENABLE_D3_CHART ON)
set(USE_SPECTRUM_CHART_D3 ON)
endif(BUILD_AS_OSX_APP)
if(BUILD_AS_ELECTRON_APP)
option(
INTERSPEC_LIBRARY_STATIC
"Builds the InterSpec library as a static library that will be statically linked into the electron module; disable this if you want to use the shared library to run InterSpec server from C, or Python, or something - this is a little bit of a hack for the moment, and a seperate target should probably be defined for this use-case."
ON
)
set(CMAKE_POSITION_INDEPENDENT_CODE ON
CACHE BOOL "Set PIC to make electron lib"
)
set(BUILD_AS_LOCAL_SERVER OFF)
set(ALLOW_URL_TO_FILESYSTEM_MAP ON)
set(USE_OSX_NATIVE_MENU OFF)
set(USE_SPECRUM_FILE_QUERY_WIDGET ON)
set(SpecUtils_ENABLE_D3_CHART ON)
set(USE_SPECTRUM_CHART_D3 ON)
if( (NOT USE_ELECTRON_NATIVE_MENU AND NOT USE_ELECTRON_HTML_MENU) OR (USE_ELECTRON_NATIVE_MENU AND USE_ELECTRON_HTML_MENU) )
if(APPLE)
set(USE_ELECTRON_NATIVE_MENU ON)
set(USE_ELECTRON_HTML_MENU OFF)
else(APPLE)
set(USE_ELECTRON_NATIVE_MENU ON)
set(USE_ELECTRON_HTML_MENU OFF)
endif(APPLE)
endif( (NOT USE_ELECTRON_NATIVE_MENU AND NOT USE_ELECTRON_HTML_MENU) OR (USE_ELECTRON_NATIVE_MENU AND USE_ELECTRON_HTML_MENU) )
set(INCLUDE_ANALYSIS_TEST_SUITE OFF)
endif(BUILD_AS_ELECTRON_APP)
if(BUILD_AS_UNIT_TEST_SUITE)
set(BUILD_AS_LOCAL_SERVER OFF)
set(USE_ENERGY_VS_TIME_PLOTS OFF)
set(USE_DB_TO_STORE_SPECTRA ON)
set(ALLOW_URL_TO_FILESYSTEM_MAP ON)
set(INCLUDE_ANALYSIS_TEST_SUITE ON)
set(TRY_TO_STATIC_LINK ON)
set(PERFORM_DEVELOPER_CHECKS ON)
set(USE_SPECRUM_FILE_QUERY_WIDGET ON)
set(SpecUtils_ENABLE_D3_CHART ON)
set(USE_SPECTRUM_CHART_D3 ON)
endif(BUILD_AS_UNIT_TEST_SUITE)
if(BUILD_FOR_WEB_DEPLOYMENT)
set(TRY_TO_STATIC_LINK ON)
set(CMAKE_BUILD_TYPE:STRING "Release")
set(ALLOW_URL_TO_FILESYSTEM_MAP OFF)
set(USE_DB_TO_STORE_SPECTRA ON)
# set( USE_SQLITE3_DB ON )
# set( USE_MYSQL_DB OFF )
set(DATABASE_PASSWORD_FILE "/path/to/passwords/databases.xml")
set(USE_GOOGLE_MAP OFF)
set(INCLUDE_ANALYSIS_TEST_SUITE OFF)
set(PERFORM_DEVELOPER_CHECKS OFF)
set(SUPPORT_ZIPPED_SPECTRUM_FILES ON)
set(USE_SPECRUM_FILE_QUERY_WIDGET OFF)
set(USE_TERMINAL_WIDGET OFF)
set(SpecUtils_ENABLE_D3_CHART ON)
set(USE_SPECTRUM_CHART_D3 ON)
endif(BUILD_FOR_WEB_DEPLOYMENT)
if(BUILD_AS_LOCAL_SERVER)
set(PERFORM_DEVELOPER_CHECKS ON)
endif(BUILD_AS_LOCAL_SERVER)
#check to make sure exactly one target is specified
set(NUM_TARGETS_SPECIFIED 0)
#if( BUILD_AS_OSX_APP )
# MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
#endif()
if(BUILD_AS_ELECTRON_APP)
MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
endif()
if(BUILD_FOR_WEB_DEPLOYMENT)
MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
endif()
if(BUILD_AS_LOCAL_SERVER)
MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
endif()
if(BUILD_AS_OFFLINE_ANALYSIS_TEST_SUITE)
MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
endif()
if(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
endif()
if(ANDROID OR IOS)
MATH( EXPR NUM_TARGETS_SPECIFIED "${NUM_TARGETS_SPECIFIED}+1" )
endif()
if(NOT ${NUM_TARGETS_SPECIFIED} EQUAL "1")
message(
FATAL
"You must specify exactly one target, you specified ${NUM_TARGETS_SPECIFIED}"
)
endif()
#try to link to static libraries whenever possible
# doing this to boost libraries only adds about 0.6 megabytes
if(TRY_TO_STATIC_LINK)
set(Boost_USE_STATIC_LIBS ON)
if(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif(WIN32)
else(TRY_TO_STATIC_LINK)
set(Boost_USE_STATIC_LIBS OFF)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .dylib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif(TRY_TO_STATIC_LINK)
INCLUDE(cmake/FindWt.cmake)
INCLUDE(cmake/WtFindZlib.txt) #ToDo: switch to using CMake privided FindZLIB.cmake, e.g. use find_package( ZLIB REQUIRED )
SET( Boost_ADDITIONAL_VERSIONS "1.55" "1.57" "1.65" "1.65_1" )
#find_package( Boost 1.41.0 COMPONENTS thread date_time system filesystem program_options regex random chrono atomic )
INCLUDE(cmake/WtFindBoost-cmake.txt)
if(NOT BOOST_WT_FOUND)
SET(ERR
"Could not find a boost installation in " ${BOOST_PREFIX} ".\n\n"
"There are two methods in Wt to find boost:"
)
MESSAGE(FATAL_ERROR ${ERR})
endif(NOT BOOST_WT_FOUND)
set(sources
src/InterSpecApp.cpp
src/DecayDataBaseServer.cpp
src/IsotopeSelectionAids.cpp
src/IsotopeId.cpp
src/MaterialDB.cpp
src/PhysicalUnits.cpp
src/MassAttenuationTool.cpp
src/DetectorPeakResponse.cpp
src/GammaInteractionCalc.cpp
src/ShieldingSourceDisplay.cpp
src/GammaXsGui.cpp
src/ReferenceLineInfo.cpp
src/ReferencePhotopeakDisplay.cpp
src/IsotopeNameFilterModel.cpp
src/ReactionGamma.cpp
src/IsotopeSearchByEnergy.cpp
src/IsotopeSearchByEnergyModel.cpp
src/SpectrumChart.cpp
src/SpectrumDataModel.cpp
src/SpectrumDisplayDiv.cpp
src/HelpSystem.cpp
src/InterSpec.cpp
src/PopupDiv.cpp
src/CanvasForDragging.cpp
src/SpecMeas.cpp
src/PeakFit.cpp
src/PeakDef.cpp
src/SpectraFileModel.cpp
src/AuxWindow.cpp
src/PeakFitChi2Fcn.cpp
src/PeakModel.cpp
src/PeakInfoDisplay.cpp
src/WarningWidget.cpp
src/SpecMeasManager.cpp
src/InterSpecUser.cpp
src/CompactFileManager.cpp
src/DetectorEdit.cpp
src/OneOverR2Calc.cpp
src/UnitsConverterTool.cpp
src/DecayWindow.cpp
src/DecayActivityDiv.cpp
src/DecayChainChart.cpp
src/DecaySelectNuclideDiv.cpp
src/SpecFileSummary.cpp
src/GammaCountDialog.cpp
src/PeakEdit.cpp
src/UseInfoWindow.cpp
src/LicenseAndDisclaimersWindow.cpp
src/LocalTimeDelegate.cpp
src/RowStretchTreeView.cpp
src/DataBaseVersionUpgrade.cpp
src/DataBaseUtils.cpp
src/Integrate.cpp
src/GadrasSpecFunc.cpp
src/DoseCalc.cpp
src/DoseCalcWidget.cpp
src/GadrasGamFileParser.cpp
src/ColorSelect.cpp
src/ColorTheme.cpp
src/ColorThemeWidget.cpp
src/ColorThemeWindow.cpp
src/PeakSearchGuiUtils.cpp
src/MakeDrf.cpp
src/MakeDrfSrcDef.cpp
src/MakeDrfChart.cpp
src/MakeDrfFit.cpp
src/FluxTool.cpp
src/NativeFloatSpinBox.cpp
src/EnergyCalTool.cpp
src/EnergyCal.cpp
src/EnergyCalGraphical.cpp
src/EnergyCalAddActions.cpp
src/EnergyCalPreserveWindow.cpp
src/EnergyCalMultiFile.cpp
src/SimpleDialog.cpp
src/ShowRiidInstrumentsAna.cpp
js/CanvasForDragging.js
js/SpectrumChart.js
js/InterSpec.js
)
set(headers
InterSpec/InterSpec_config.h.in
InterSpec/InterSpecApp.h
InterSpec/DecayDataBaseServer.h
InterSpec/IsotopeSelectionAids.h
InterSpec/IsotopeId.h
InterSpec/MaterialDB.h
InterSpec/PhysicalUnits.h
InterSpec/MassAttenuationTool.h
InterSpec/DetectorPeakResponse.h
InterSpec/GammaInteractionCalc.h
InterSpec/ShieldingSourceDisplay.h
InterSpec/GammaXsGui.h
InterSpec/ReferenceLineInfo.h
InterSpec/ReferencePhotopeakDisplay.h
InterSpec/IsotopeNameFilterModel.h
InterSpec/ReactionGamma.h
InterSpec/IsotopeSearchByEnergy.h
InterSpec/IsotopeSearchByEnergyModel.h
InterSpec/SpectrumChart.h
InterSpec/SpectrumDataModel.h
InterSpec/SpectrumDisplayDiv.h
InterSpec/HelpSystem.h
InterSpec/InterSpec.h
InterSpec/PopupDiv.h
InterSpec/CanvasForDragging.h
InterSpec/SpecMeas.h
InterSpec/PeakFit.h
InterSpec/PeakDef.h
InterSpec/SpectraFileModel.h
InterSpec/AuxWindow.h
InterSpec/PeakFitChi2Fcn.h
InterSpec/PeakModel.h
InterSpec/PeakInfoDisplay.h
InterSpec/WarningWidget.h
InterSpec/SpecMeasManager.h
InterSpec/InterSpecUser.h
InterSpec/CompactFileManager.h
InterSpec/DetectorEdit.h
InterSpec/OneOverR2Calc.h
InterSpec/UnitsConverterTool.h
InterSpec/DecayWindow.h
InterSpec/DecayActivityDiv.h
InterSpec/DecayChainChart.h
InterSpec/DecaySelectNuclideDiv.h
InterSpec/SpecFileSummary.h
InterSpec/GammaCountDialog.h
InterSpec/PeakEdit.h
InterSpec/UseInfoWindow.h
InterSpec/LicenseAndDisclaimersWindow.h
InterSpec/LocalTimeDelegate.h
InterSpec/RowStretchTreeView.h
InterSpec/DataBaseVersionUpgrade.h
InterSpec/DataBaseUtils.h
InterSpec/Integrate.h
InterSpec/GadrasSpecFunc.h
InterSpec/DoseCalc.h
InterSpec/DoseCalcWidget.h
InterSpec/GadrasGamFileParser.h
InterSpec/ColorSelect.h
InterSpec/ColorTheme.h
InterSpec/ColorThemeWidget.h
InterSpec/ColorThemeWindow.h
InterSpec/PeakSearchGuiUtils.h
InterSpec/MakeDrf.h
InterSpec/MakeDrfSrcDef.h
InterSpec/MakeDrfChart.h
InterSpec/MakeDrfFit.h
InterSpec/FluxTool.h
InterSpec/NativeFloatSpinBox.h
InterSpec/EnergyCalTool.h
InterSpec/EnergyCal.h
InterSpec/EnergyCalGraphical.h
InterSpec/EnergyCalAddActions.h
InterSpec/EnergyCalPreserveWindow.h
InterSpec/EnergyCalMultiFile.h
InterSpec/SimpleDialog.h
InterSpec/ShowRiidInstrumentsAna.h
)
if(USE_DB_TO_STORE_SPECTRA)
list(APPEND sources src/DbStateBrowser.cpp src/DbFileBrowser.cpp)
list(APPEND headers InterSpec/DbStateBrowser.h InterSpec/DbFileBrowser.h)
endif(USE_DB_TO_STORE_SPECTRA)
if(ALLOW_URL_TO_FILESYSTEM_MAP)
list(APPEND sources src/DbToFilesystemLink.cpp)
list(APPEND headers InterSpec/DbToFilesystemLink.h)
endif(ALLOW_URL_TO_FILESYSTEM_MAP)
if(NOT ANDROID AND NOT IOS)
list(APPEND sources src/FileDragUploadResource.cpp)
list(APPEND headers InterSpec/FileDragUploadResource.h)
endif(NOT ANDROID AND NOT IOS)
if(INCLUDE_ANALYSIS_TEST_SUITE)
list(APPEND sources src/SpectrumViewerTester.cpp)
list(APPEND headers InterSpec/SpectrumViewerTester.h)
endif(INCLUDE_ANALYSIS_TEST_SUITE)
if(DECAY_CHART_ADD_IMAGE_DOWNLOAD_LINK)
list(APPEND SRCS src/ChartToImageResource.cpp)
list(APPEND HEADRS InterSpec/ChartToImageResource.h)
endif(DECAY_CHART_ADD_IMAGE_DOWNLOAD_LINK)
if(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
list(APPEND sources testing/developcode.cpp src/DbUserState.cpp)
list(APPEND headers testing/developcode.h InterSpec/DbUserState.h)
endif(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
if(USE_OSX_NATIVE_MENU)
list(APPEND sources target/osx/NativeMenu.mm)
list(APPEND headers target/osx/NativeMenu.h)
endif(USE_OSX_NATIVE_MENU)
if(IOS)
list(APPEND sources target/ios/InterSpec/FileHandling.mm)
list(APPEND headers target/ios/InterSpec/FileHandling.h)
endif(IOS)
if(USE_GOOGLE_MAP)
list(APPEND sources src/GoogleMap.cpp)
list(APPEND headers InterSpec/GoogleMap.h)
endif(USE_GOOGLE_MAP)
if(USE_SEARCH_MODE_3D_CHART)
list(APPEND sources src/SearchMode3DChart.cpp src/SearchMode3DDataModel.cpp)
list(
APPEND
headers
InterSpec/SearchMode3DChart.h
InterSpec/SearchMode3DDataModel.h
)
endif(USE_SEARCH_MODE_3D_CHART)
if(USE_FEATURE_MARKER_WIDGET)
list(APPEND sources src/FeatureMarkerWidget.cpp)
list(APPEND headers InterSpec/FeatureMarkerWidget.h)
endif(USE_FEATURE_MARKER_WIDGET)
if(USE_TERMINAL_WIDGET)
list(
APPEND
sources
src/TerminalModel.cpp
src/TerminalWidget.cpp
js/TerminalWidget.js
)
list(APPEND headers InterSpec/TerminalModel.h InterSpec/TerminalWidget.h)
endif(USE_TERMINAL_WIDGET)
if(SUPPORT_ZIPPED_SPECTRUM_FILES)
list(APPEND sources src/ZipArchive.cpp)
list(APPEND headers InterSpec/ZipArchive.h)
endif(SUPPORT_ZIPPED_SPECTRUM_FILES)
if(USE_SIMPLE_NUCLIDE_ASSIST)
list(APPEND sources src/SimpleNuclideAssist.cpp)
list(APPEND headers InterSpec/SimpleNuclideAssist.h)
endif(USE_SIMPLE_NUCLIDE_ASSIST)
if(USE_SPECRUM_FILE_QUERY_WIDGET)
if(
BUILD_AS_OSX_APP
OR BUILD_AS_ELECTRON_APP
OR BUILD_AS_LOCAL_SERVER
OR BUILD_AS_UNIT_TEST_SUITE
)
list(
APPEND
sources
src/SpecFileQuery.cpp
src/SpecFileQueryWidget.cpp
src/SpecFileQueryDbCache.cpp
)
list(
APPEND
headers
InterSpec/SpecFileQuery.h
InterSpec/SpecFileQueryWidget.h
InterSpec/SpecFileQueryDbCache.h
)
list(APPEND sources js/SpecFileQueryWidget.js)
else()
message(
FATAL_ERROR
"The spectrum file query widget can not be enabled for web deployements."
)
endif()
endif(USE_SPECRUM_FILE_QUERY_WIDGET)
#Copy D3 resources into InterSpec_resources directory at compile time
include(cmake/DeployJsAndCss.cmake)
list(APPEND sources external_libs/SpecUtils/d3_resources/d3.v3.min.js)
deploy_js_resource("${CMAKE_CURRENT_SOURCE_DIR}/external_libs/SpecUtils/d3_resources/d3.v3.min.js"
"${CMAKE_CURRENT_BINARY_DIR}/InterSpec_resources/d3.v3.min.js"
)
if(USE_SPECTRUM_CHART_D3)
if(NOT RENDER_REFERENCE_PHOTOPEAKS_SERVERSIDE)
MESSAGE(FATAL_ERROR "You must enable RENDER_REFERENCE_PHOTOPEAKS_SERVERSIDE when enabling USE_SPECTRUM_CHART_D3")
endif()
list(
APPEND
sources
src/D3SpectrumDisplayDiv.cpp
external_libs/SpecUtils/d3_resources/SpectrumChartD3.js
external_libs/SpecUtils/d3_resources/SpectrumChartD3.css
external_libs/SpecUtils/d3_resources/SpectrumChartD3StandAlone.css
)
list(APPEND headers InterSpec/D3SpectrumDisplayDiv.h)
deploy_js_resource("${CMAKE_CURRENT_SOURCE_DIR}/external_libs/SpecUtils/d3_resources/SpectrumChartD3.js"
"${CMAKE_CURRENT_BINARY_DIR}/InterSpec_resources/SpectrumChartD3.js"
)
set(CSS_RESOURCES_TO_COPY
"SpectrumChartD3.css"
"SpectrumChartD3StandAlone.css"
)
foreach(_file ${CSS_RESOURCES_TO_COPY})
deploy_css_resource("${CMAKE_CURRENT_SOURCE_DIR}/external_libs/SpecUtils/d3_resources/${_file}"
"${CMAKE_CURRENT_BINARY_DIR}/InterSpec_resources/${_file}"
)
endforeach()
endif(USE_SPECTRUM_CHART_D3)
find_path(
WT_RESOURCES_DIRECTORY
form.css
${Wt_INCLUDE_DIR}/../share/Wt/resources
)
#Set SpecUtils compile options
set(SpecUtils_REBIN_FILES_TO_SINGLE_BINNING OFF
CACHE BOOL "Set Rebin spectrum to single energy cal"
)
set(SpecUtils_NO_BOOST_LIB OFF
CACHE BOOL "Use boost for threading primitives in SpecUtils"
)
set(SpecUtils_USE_WT_THREADPOOL ON CACHE BOOL "")
set(SpecUtils_EXTERNALLY_DEFINED_LOG_MESSAGE ON CACHE BOOL "")
set(SpecUtils_BUILD_UNIT_TESTS OFF CACHE BOOL "")
set(SpecUtils_BUILD_REGRESSION_TEST OFF CACHE BOOL "")
set(SpecUtils_PYTHON_BINDINGS OFF CACHE BOOL "")
set(SpecUtils_JAVA_SWIG OFF CACHE BOOL "")
set(SpecUtils_D3_SUPPORT_FILE_STATIC OFF CACHE BOOL "")
set(SpecUtils_D3_SCRIPTS_RUNTIME_DIR "InterSpec_resources" CACHE STRING "")
#add in all the subdirectories the project will always use
add_subdirectory(external_libs/Minuit2)
add_subdirectory(external_libs/Cuba-3.0)
add_subdirectory(external_libs/SpecUtils)
add_subdirectory(external_libs/SandiaDecay)
add_subdirectory(external_libs/muparserx-4.0.7)
#We should have figured out all the header and source files we need by here, so
# lets add the executable to the build
if(IOS)
list(APPEND sources src/InterSpecServer.cpp)
list(APPEND headers InterSpec/InterSpecServer.h)
add_library(InterSpecLib STATIC ${sources} ${headers})
elseif(ANDROID)
list(APPEND headers target/android/AndroidUtils.hpp)
add_library(
InterSpecLib
SHARED
main.cpp
${sources}
${headers}
)
elseif(BUILD_AS_OSX_APP)
list(APPEND sources src/InterSpecServer.cpp target/osx/macOsUtils.mm)
list(APPEND headers InterSpec/InterSpecServer.h target/osx/macOsUtils.h)
SET(MACOSX_BUNDLE_INFO_STRING "InterSpec - Sandia National Lab, Will Johnson")
SET(MACOSX_BUNDLE_ICON_FILE InterSpec )
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "" )
SET(MACOSX_BUNDLE_BUNDLE_NAME "InterSpec" )
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "InterSpec" )
SET(MACOSX_BUNDLE_BUNDLE_VERSION "0" )
SET(MACOSX_BUNDLE_COPYRIGHT "Sandia National Labs, Will Johnson" )
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "gov.sandia.macOS.InterSpec" )
SET( ${PRODUCT_NAME} "InterSpec" )
SET( MACOSX_BUNDLE_BUNDLE_NAME "InterSpec" )
FIND_LIBRARY(WEBKIT_LIBRARY WebKit)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
FIND_LIBRARY(COREDATA_LIBRARY CoreData)
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
FIND_LIBRARY(FOUNDATION_LIBRARY Foundation)
MARK_AS_ADVANCED(WEBKIT_LIBRARY COCOA_LIBRARY COREDATA_LIBRARY APPKIT_LIBRARY FOUNDATION_LIBRARY)
add_library(InterSpecLib STATIC ${sources} ${headers})
target_link_libraries(
InterSpecLib
PUBLIC
${WEBKIT_LIBRARY}
${COCOA_LIBRARY}
${APPKIT_LIBRARY}
${COREDATA_LIBRARY}
${FOUNDATION_LIBRARY}
)
set(app_sources
${CMAKE_CURRENT_SOURCE_DIR}/target/osx/InterSpec.icns
"target/osx/en.lproj/MainMenu.xib"
"target/osx/AppDelegate.mm"
"target/osx/main.m"
)
set(app_headers ${headers} "target/osx/AppDelegate.h")
# Xcode doesnt like having two bundles for some reason, so we will add the
# QuickLook project as an external project and add it to the final application
# at InterSpec.app/Contents/Library/QuickLook
include(ExternalProject)
ExternalProject_Add(SpecFilePreview
BINARY_DIR "${CMAKE_BINARY_DIR}/SpecFilePreview"
URL ${CMAKE_CURRENT_SOURCE_DIR}/target/macOsQuickLook/SpecFilePreview/SpecFilePreview/
CMAKE_GENERATOR "Unix Makefiles"
CMAKE_CACHE_ARGS -DWt_INCLUDE_DIR:PATH=${Wt_INCLUDE_DIR}
-DBOOST_ROOT:PATH=${Boost_INCLUDE_DIR}/..
-DBOOST_INCLUDEDIR:PATH=${Boost_INCLUDE_DIR}
-DCMAKE_BUILD_TYPE:STRING=RELEASE
-DSpecUtils_ENABLE_D3_CHART:BOOL=OFF
INSTALL_COMMAND ""
)
# Add dummy command to let cmake know SpecFilePreview.qlgenerator isnt available
# at configure time so it wont complain
add_custom_command(
OUTPUT
"${CMAKE_CURRENT_BINARY_DIR}/SpecFilePreview/SpecFilePreview.qlgenerator"
COMMAND ""
)
#In order to copy all the needed resources to the "Archive" builds of Xcode,
# we need to specify each individual file, and later set their MACOSX_PACKAGE_LOCATION properties...
file(GLOB_RECURSE DATA_RES_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
file(GLOB_RECURSE WT_RES_SOURCES "${WT_RESOURCES_DIRECTORY}/*")
file(
GLOB_RECURSE INTERSPEC_RES_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/InterSpec_resources/*"
)
file(
GLOB_RECURSE EXAMPLE_RES_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/example_spectra/*"
)
SET(EN_LOCALIZATION_FILES "${CMAKE_CURRENT_SOURCE_DIR}/target/osx/en.lproj/InfoPlist.strings" "${CMAKE_CURRENT_SOURCE_DIR}/target/osx/en.lproj/Credits.rtf")
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
if(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
message(SEND_ERROR "could fine ibtool to compile the .xib files")
endif()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/MainMenu.nib"
COMMAND
${IBTOOL} --errors --warnings --notices --output-format
human-readable-text --compile
"${CMAKE_CURRENT_BINARY_DIR}/MainMenu.nib"
"${CMAKE_CURRENT_SOURCE_DIR}/target/osx/en.lproj/MainMenu.xib"
COMMENT "Compiling MainMenu.xib"
)
ADD_EXECUTABLE(InterSpecExe MACOSX_BUNDLE ${app_sources} ${app_headers}
${DATA_RES_SOURCES} ${WT_RES_SOURCES} ${INTERSPEC_RES_SOURCES} ${EXAMPLE_RES_SOURCES} ${EN_LOCALIZATION_FILES}
"${CMAKE_CURRENT_BINARY_DIR}/MainMenu.nib"
"${CMAKE_CURRENT_BINARY_DIR}/SpecFilePreview/SpecFilePreview.qlgenerator"
)
SET_TARGET_PROPERTIES( InterSpecExe PROPERTIES MACOSX_BUNDLE TRUE )
#set_target_properties( InterSpecExe PROPERTIES SUFFIX "")
set_target_properties(InterSpecExe PROPERTIES OUTPUT_NAME "InterSpec")
target_link_libraries(InterSpecExe PUBLIC InterSpecLib)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/target/osx/InterSpec.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
add_dependencies(InterSpecExe SpecFilePreview)
#Set resources MACOSX_PACKAGE_LOCATION property so it is where we want in the app bundle
#ToDo: combine 5 loops below into a single loop...
# ToDo: Try to use: install(DIRECTORY InterSpec_resources DESTINATION $<TARGET_FILE_DIR:InterSpecExe>/../Resources/ )
# ToDo: Try using (something like):
# add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory
# "${CMAKE_SOURCE_DIR}/example_spectra" "$<TARGET_FILE_DIR:InterSpecExe>/Contents/Resources/")
# set( RES_SOURCES_DIRS DATA_RES_SOURCES WT_RES_SOURCES INTERSPEC_RES_SOURCES EXAMPLE_RES_SOURCES EN_LOCALIZATION_FILES )
# set( RES_DEST_DIRS data resources InterSpec_resources example_spectra en.lproj )
set_property(
SOURCE
${CMAKE_CURRENT_BINARY_DIR}/SpecFilePreview/SpecFilePreview.qlgenerator
PROPERTY
MACOSX_PACKAGE_LOCATION
"Library/QuickLook/"
)
foreach(RES_FILE ${DATA_RES_SOURCES})
#Get the relative path from the data-folder to the particular file
file(
RELATIVE_PATH
RES_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/data"
${RES_FILE}
)
get_filename_component(RES_PATH ${RES_PATH} DIRECTORY)
#Set it's location inside the app package (under Resources)
set_property(
SOURCE
${RES_FILE}
PROPERTY
MACOSX_PACKAGE_LOCATION
"Resources/data/${RES_PATH}"
)
endforeach(RES_FILE)
foreach(RES_FILE ${WT_RES_SOURCES})
file(RELATIVE_PATH RES_PATH "${WT_RESOURCES_DIRECTORY}" ${RES_FILE})
get_filename_component(RES_PATH ${RES_PATH} DIRECTORY)
set_property(
SOURCE
${RES_FILE}
PROPERTY
MACOSX_PACKAGE_LOCATION
"Resources/resources/${RES_PATH}"
)
endforeach(RES_FILE)
foreach(RES_FILE ${INTERSPEC_RES_SOURCES})
file(
RELATIVE_PATH
RES_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/InterSpec_resources"
${RES_FILE}
)
get_filename_component(RES_PATH ${RES_PATH} DIRECTORY)
set_property(