-
Notifications
You must be signed in to change notification settings - Fork 21
/
CMakeLists.txt
1001 lines (844 loc) · 32.3 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
cmake_minimum_required(VERSION 3.1...3.20 FATAL_ERROR)
project(InterSpec VERSION 1.0.13)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set( CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "Set PIC to make InterSpec static lib" )
if( InterSpec_FETCH_DEPENDENCIES )
include( cmake/FetchInterSpecDeps.txt )
endif( InterSpec_FETCH_DEPENDENCIES )
# If we are the top-level project, we'll build the local-server exe
get_directory_property(hasParent PARENT_DIRECTORY)
option(
BUILD_AS_ELECTRON_APP
"Configures the executable to be ran as a Electron app"
OFF
)
option(
BUILD_AS_WX_WIDGETS_APP
"Configures executable to be ran as a wxWidgets-based app"
OFF
)
option(
BUILD_FOR_WEB_DEPLOYMENT
"Selects options appropriate for the web in the future"
OFF
)
if( hasParent )
option( BUILD_AS_LOCAL_SERVER "Build for use as a server for localhost" OFF )
else( hasParent )
option( BUILD_AS_LOCAL_SERVER "Build for use as a server for localhost" ON )
endif( hasParent )
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
)
if( NOT DEFINED TRY_TO_STATIC_LINK )
if(WIN32)
set( TRY_TO_STATIC_LINK ON )
else(WIN32)
option(TRY_TO_STATIC_LINK "Try to link to static libs whenever possible" OFF)
endif(WIN32)
endif( NOT DEFINED TRY_TO_STATIC_LINK )
option(
DRAW_GAMMA_LINES_LOG_AND_LIN
"Have gamma lines indicators be drawn in log mode when y-axis is log"
OFF
)
option(USE_DB_TO_STORE_SPECTRA "Use the database to store spectra" ON)
option(
USE_SPECRUM_FILE_QUERY_WIDGET
"Enables compilation of the spectrum file query tool (not for web deployment)"
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)
option(USE_DETECTION_LIMIT_TOOL "Enables under-development detection limit tool" ON)
option(USE_QR_CODES "Enables generating QR codes for like DRFs" ON)
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" OFF)
set(GOOGLE_MAPS_KEY "" CACHE STRING "Google maps api key.")
option(USE_LEAFLET_MAP "Use leaflet-based maps widget" OFF)
set(LEAFLET_MAPS_KEY "n/a" CACHE STRING "Leaflet maps api key.")
option(
USE_CSS_FLEX_LAYOUT
"Use CSS Flex/Grid Layout in-place of Wts layouts were possible (work in progress)"
OFF
)
option(USE_REMOTE_RID "Enables using remote RID tool" ON)
option(USE_REL_ACT_TOOL "Enables Relative Activity tool - experimental" ON)
if( IOS OR ANDROID )
set( USE_BATCH_TOOLS OFF CACHE INTERNAL "")
else()
option( USE_BATCH_TOOLS "Enables (command line for now) batch processing." ON )
endif()
if(MSVC)
option(${PROJECT_NAME}_USE_MSVC_MultiThreadDLL "Use dynamically-link runtime library." OFF)
if( ${PROJECT_NAME}_USE_MSVC_MultiThreadDLL)
set(Boost_USE_STATIC_RUNTIME OFF)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set(Boost_USE_STATIC_RUNTIME ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
message(STATUS "Using CMAKE_MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY}")
endif()
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"
)
# If we are creating the normal InterSpec executable, and the InterSpec_batch executable,
# we will compile LibInterSpec as a shared library, so both exes can use it; otherwise
# we will create a static library, and statically link it into our final executable.
# (Electron doesnt need a separate exe for batch)
if( (USE_BATCH_TOOLS AND NOT BUILD_AS_ELECTRON_APP) OR BUILD_AS_OSX_APP )
set( INTERSPEC_LIB_TYPE SHARED )
else()
set( INTERSPEC_LIB_TYPE STATIC )
endif()
SET(MYSQL_DATABASE_TO_USE "dev" CACHE STRING "Which mysql database to use (if applicable): dev/qc/prod")
# I think requiring c++14 will require GCC>=5, but we'll double check anyway
if( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0 )
message( FATAL_ERROR, "GCC less than 5 not supported." )
endif()
# Make a cached variable available to parent cmake projects
set( INTERSPEC_VERSION "${PROJECT_VERSION}" CACHE STRING "InterSpec version" )
if(NOT CMAKE_BUILD_TYPE)
#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)
if(BUILD_FOR_WEB_DEPLOYMENT)
set(TRY_TO_STATIC_LINK ON)
set(CMAKE_BUILD_TYPE:STRING "Release")
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(PERFORM_DEVELOPER_CHECKS OFF CACHE INTERNAL "")
set(SpecUtils_ENABLE_EQUALITY_CHECKS OFF CACHE INTERNAL "")
set(USE_SPECRUM_FILE_QUERY_WIDGET OFF)
set(USE_TERMINAL_WIDGET OFF)
endif(BUILD_FOR_WEB_DEPLOYMENT)
if(BUILD_AS_LOCAL_SERVER)
set(PERFORM_DEVELOPER_CHECKS ON CACHE INTERNAL "")
set(SpecUtils_ENABLE_EQUALITY_CHECKS ON CACHE INTERNAL "")
endif(BUILD_AS_LOCAL_SERVER)
if(BUILD_FOR_WEB_DEPLOYMENT AND BUILD_AS_LOCAL_SERVER )
message( FATAL_ERROR "You can not buildfor both local webserver and web deployment" )
endif()
#try to link to static libraries whenever possible
if( TRY_TO_STATIC_LINK )
if(WIN32)
SET( ZLIB_USE_STATIC_LIBS "ON" )
SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
else(WIN32)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif(WIN32)
else(TRY_TO_STATIC_LINK)
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so .dylib ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif(TRY_TO_STATIC_LINK)
include( cmake/FindWt.cmake )
find_package( ZLIB REQUIRED )
find_package( Threads REQUIRED )
if( InterSpec_FETCH_DEPENDENCIES )
set( Wt_INCLUDE_DIR "${wt_SOURCE_DIR}/src" )
else( InterSpec_FETCH_DEPENDENCIES )
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.68 REQUIRED COMPONENTS thread date_time system filesystem program_options regex random )
if( USE_REL_ACT_TOOL )
find_package( Eigen3 3.4 REQUIRED NO_MODULE )
find_package( Ceres REQUIRED )
endif( USE_REL_ACT_TOOL )
endif( InterSpec_FETCH_DEPENDENCIES )
set(sources
src/InterSpecApp.cpp
src/DecayDataBaseServer.cpp
src/IsotopeSelectionAids.cpp
src/IsotopeId.cpp
src/MaterialDB.cpp
src/PhysicalUnits.cpp
src/PhysicalUnitsLocalized.cpp
src/MassAttenuationTool.cpp
src/DetectorPeakResponse.cpp
src/GammaInteractionCalc.cpp
src/ShieldingSourceDisplay.cpp
src/ShieldingSourceFitCalc.cpp
src/ShieldingSelect.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/HelpSystem.cpp
src/InterSpec.cpp
src/InterSpecServer.cpp
src/PopupDiv.cpp
src/SpecMeas.cpp
src/PeakFit.cpp
src/PeakFitUtils.cpp
src/PeakDef.cpp
src/PeakDists.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/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/FileDragUploadResource.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/DrfSelect.cpp
src/DrfChart.cpp
src/MakeDrf.cpp
src/MakeDrfSrcDef.cpp
src/MakeDrfChart.cpp
src/MakeDrfFit.cpp
src/MakeFwhmForDrf.cpp
src/FluxTool.cpp
src/NativeFloatSpinBox.cpp
src/SwitchCheckbox.cpp
src/EnergyCalTool.cpp
src/EnergyCal.cpp
src/EnergyCalGraphical.cpp
src/EnergyCalAddActions.cpp
src/EnergyCalPreserveWindow.cpp
src/EnergyCalMultiFile.cpp
src/SimpleDialog.cpp
src/FeatureMarkerWidget.cpp
src/ShowRiidInstrumentsAna.cpp
src/D3SpectrumDisplayDiv.cpp
external_libs/SpecUtils/d3_resources/SpectrumChartD3.js
external_libs/SpecUtils/d3_resources/SpectrumChartD3.css
src/D3TimeChart.cpp
src/ZipArchive.cpp
src/MultimediaDisplay.cpp
src/MoreNuclideInfo.cpp
src/MoreNuclideInfoDisplay.cpp
src/UndoRedoManager.cpp
src/AppUtils.cpp
src/ExportSpecFile.cpp
src/EnterAppUrlWindow.cpp
src/NuclideSourceEnter.cpp
src/AddNewPeakDialog.cpp
src/UserPreferences.cpp
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/PhysicalUnitsLocalized.h
InterSpec/MassAttenuationTool.h
InterSpec/DetectorPeakResponse.h
InterSpec/GammaInteractionCalc.h
InterSpec/ShieldingSourceDisplay.h
InterSpec/ShieldingSourceFitCalc.h
InterSpec/ShieldingSelect.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/HelpSystem.h
InterSpec/InterSpec.h
InterSpec/InterSpecServer.h
InterSpec/PopupDiv.h
InterSpec/SpecMeas.h
InterSpec/PeakFit.h
InterSpec/PeakFitUtils.h
InterSpec/PeakDef.h
InterSpec/PeakDists.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/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/FileDragUploadResource.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/DrfSelect.h
InterSpec/DrfChart.h
InterSpec/MakeDrf.h
InterSpec/MakeDrfSrcDef.h
InterSpec/MakeDrfChart.h
InterSpec/MakeDrfFit.h
InterSpec/MakeFwhmForDrf.h
InterSpec/FluxTool.h
InterSpec/NativeFloatSpinBox.h
InterSpec/SwitchCheckbox.h
InterSpec/EnergyCalTool.h
InterSpec/EnergyCal.h
InterSpec/EnergyCalGraphical.h
InterSpec/EnergyCalAddActions.h
InterSpec/EnergyCalPreserveWindow.h
InterSpec/EnergyCalMultiFile.h
InterSpec/SimpleDialog.h
InterSpec/FeatureMarkerWidget.h
InterSpec/ShowRiidInstrumentsAna.h
InterSpec/D3SpectrumDisplayDiv.h
InterSpec/D3TimeChart.h
InterSpec/ZipArchive.h
InterSpec/MultimediaDisplay.h
InterSpec/MoreNuclideInfo.h
InterSpec/MoreNuclideInfoDisplay.h
InterSpec/UndoRedoManager.h
InterSpec/AppUtils.h
InterSpec/ExportSpecFile.h
InterSpec/EnterAppUrlWindow.h
InterSpec/NuclideSourceEnter.h
InterSpec/AddNewPeakDialog.h
InterSpec/UserPreferences.h
)
if(USE_DB_TO_STORE_SPECTRA)
list(APPEND sources src/DbFileBrowser.cpp)
list(APPEND headers InterSpec/DbFileBrowser.h)
endif(USE_DB_TO_STORE_SPECTRA)
if(INCLUDE_ANALYSIS_TEST_SUITE)
set(TEST_SUITE_BASE_DIR "." CACHE STRING "Directory containing a 'analysis_tests' directory containing N42 analyst test files.")
list(APPEND sources src/SpectrumViewerTester.cpp)
list(APPEND headers InterSpec/SpectrumViewerTester.h)
endif(INCLUDE_ANALYSIS_TEST_SUITE)
#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_LEAFLET_MAP)
list(APPEND sources src/LeafletRadMap.cpp)
list(APPEND headers InterSpec/LeafletRadMap.h)
list(APPEND OTHER_InterSpec_SUPPORT_FILES InterSpec_resources/LeafletRadMap.js)
endif(USE_LEAFLET_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_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(USE_DETECTION_LIMIT_TOOL)
list( APPEND sources src/DetectionLimitCalc.cpp src/DetectionLimitTool.cpp src/DetectionLimitSimple.cpp )
list( APPEND headers InterSpec/DetectionLimitCalc.h InterSpec/DetectionLimitTool.h InterSpec/DetectionLimitSimple.h )
endif(USE_DETECTION_LIMIT_TOOL)
if(USE_QR_CODES)
list( APPEND sources external_libs/QR-Code-generator/cpp/qrcodegen.cpp
src/QrCode.cpp
src/QRSpectrum.cpp
)
list( APPEND headers external_libs/QR-Code-generator/cpp/qrcodegen.hpp
InterSpec/QrCode.h
InterSpec/QRSpectrum.h
)
endif(USE_QR_CODES)
if(USE_SPECRUM_FILE_QUERY_WIDGET)
if( BUILD_FOR_WEB_DEPLOYMENT )
message( FATAL_ERROR "The spectrum file query widget can not be enabled for web deployments." )
endif( BUILD_FOR_WEB_DEPLOYMENT )
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 )
endif(USE_SPECRUM_FILE_QUERY_WIDGET)
if( USE_REMOTE_RID )
list( APPEND sources src/RemoteRid.cpp )
list( APPEND headers InterSpec/RemoteRid.h )
endif( USE_REMOTE_RID )
if( USE_REL_ACT_TOOL )
list( APPEND sources
src/PeakFitLM.cpp
src/RelActCalc.cpp
src/RelActCalcAuto.cpp
src/RelActCalcManual.cpp
src/RelActAutoGui.cpp
src/RelActManualGui.cpp
src/RelActTxtResults.cpp
src/RelEffChart.cpp
)
list( APPEND headers
InterSpec/PeakFitLM.h
InterSpec/RelActCalc.h
InterSpec/RelActCalcAuto.h
InterSpec/RelActCalcManual.h
InterSpec/RelActAutoGui.h
InterSpec/RelActManualGui.h
InterSpec/RelActTxtResults.h
InterSpec/RelEffChart.h
)
endif( USE_REL_ACT_TOOL )
if( USE_BATCH_TOOLS )
list( APPEND sources
src/BatchCommandLine.cpp
src/BatchPeak.cpp
src/BatchActivity.cpp
src/BatchInfoLog.cpp
)
list( APPEND headers
InterSpec/BatchCommandLine.h
InterSpec/BatchPeak.h
InterSpec/BatchActivity.h
InterSpec/BatchInfoLog.h
)
endif( USE_BATCH_TOOLS )
if( BUILD_AS_OSX_APP )
list( APPEND sources target/osx/macOsUtils.mm target/osx/NativeMenu.mm )
list( APPEND headers target/osx/macOsUtils.h target/osx/NativeMenu.h )
endif( BUILD_AS_OSX_APP )
#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"
)
list( APPEND OTHER_InterSpec_SUPPORT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/InterSpec_resources/D3TimeChart.js )
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" )
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()
find_path(
WT_RESOURCES_DIRECTORY
form.css
${Wt_INCLUDE_DIR}/../share/Wt/resources
)
#Set SpecUtils compile options
set(SpecUtils_NO_BOOST_LIB OFF
CACHE BOOL "Use boost for threading primitives in SpecUtils"
)
if( APPLE OR ANDROID )
set(SpecUtils_USE_WT_THREADPOOL OFF CACHE BOOL "")
else( APPLE OR ANDROID )
set(SpecUtils_USE_WT_THREADPOOL ON CACHE BOOL "")
endif( APPLE OR ANDROID )
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_ENABLE_D3_CHART ON CACHE BOOL "")
set(SpecUtils_D3_SUPPORT_FILE_STATIC OFF CACHE BOOL "")
set(SpecUtils_D3_SCRIPTS_RUNTIME_DIR "InterSpec_resources" CACHE STRING "")
set(SpecUtils_ENABLE_URI_SPECTRA ${USE_QR_CODES} CACHE BOOL "")
set(SpecUtils_FLT_PARSE_METHOD "boost" 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)
add_library(InterSpecLib ${INTERSPEC_LIB_TYPE} ${sources} ${headers})
# If we are the top-level project, we'll build the local-server exe
if( NOT hasParent)
add_executable(InterSpecExe main.cpp)
target_link_libraries(InterSpecExe PUBLIC InterSpecLib)
set_target_properties(InterSpecExe PROPERTIES OUTPUT_NAME "InterSpec")
endif()
set_target_properties(InterSpecLib PROPERTIES PREFIX "")
set_target_properties(InterSpecLib PROPERTIES OUTPUT_NAME "InterSpec")
# Turn off some compiler warnings
target_compile_options(InterSpecLib PRIVATE
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wno-inconsistent-missing-override> # Turn off a bunch of warnings like: WTreeView:399:20: warning: 'headerWidget' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
$<$<CXX_COMPILER_ID:MSVC>:
>)
# Turn off "note: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated...."
# warnings (these come from Wt I think, not our code)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D BOOST_BIND_GLOBAL_PLACEHOLDERS")
if(WIN32)
#0x0601==Win7, 0x0501=WinXP (Wt CMakeLists.txt uses 0x0501x)
target_compile_definitions( InterSpecLib PUBLIC /bigobj -D _WIN32_WINNT=0x0601 -D WINVER=0x0601 -D _SCL_SECURE_NO_WARNINGS )
target_compile_definitions( InterSpecLib PRIVATE InterSpec_EXPORTS )
add_definitions( /bigobj )
if( USE_BATCH_TOOLS )
# We get error compiling multi-processor debug build of shared LibInterSpec, presumably due to some
# file locking issues, so only enable parallel builds for release, if we are building shared LibInterSpec
target_compile_options( InterSpecLib PUBLIC $<$<CONFIG:Release>:/MP> )
else( USE_BATCH_TOOLS )
add_definitions( /MP )
endif( USE_BATCH_TOOLS )
endif(WIN32)
target_link_libraries(
InterSpecLib
PUBLIC
Threads::Threads
SpecUtils
SandiaDecay
minuit2
Cuba-3.0
muparserx
Boost::thread
Boost::date_time
Boost::system
Boost::filesystem
Boost::program_options
Boost::regex
Boost::random
ZLIB::ZLIB
${CMAKE_DL_LIBS}
)
if( USE_SPECRUM_FILE_QUERY_WIDGET )
add_subdirectory(external_libs/pugixml-1.9)
target_link_libraries(InterSpecLib PUBLIC pugixml)
endif( USE_SPECRUM_FILE_QUERY_WIDGET )
if(USE_MYSQL_DB EQUAL USE_SQLITE3_DB)
MESSAGE(FATAL_ERROR "Exactly one type of database (MySQL or SQLITE3) must be chosen")
endif()
set( RAPID_XML_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_libs/SpecUtils/3rdparty )
target_include_directories( InterSpecLib
PUBLIC
${Wt_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${RAPID_XML_INC_DIR}
external_libs
)
if( InterSpec_FETCH_DEPENDENCIES )
target_link_libraries( InterSpecLib
PUBLIC
Boost::math Boost::scope_exit Boost::uuid Boost::iostreams Boost::assign Boost::multi_array Boost::crc Boost::process Boost::crc
# Boost::signals2 Boost::asio Boost::multi_index
wt
# wttest
wthttp
wtdbosqlite3
wtdbo
)
target_include_directories( InterSpecLib
PUBLIC
${wt_BINARY_DIR}
${boost_SOURCE_DIR}/libs/numeric/ublas/include
)
# Need to fix copying the "resources" directory and configs and stuff probably
endif( InterSpec_FETCH_DEPENDENCIES )
if(WIN32)
if( NOT InterSpec_FETCH_DEPENDENCIES )
target_link_libraries(InterSpecLib PUBLIC
debug "${Wt_DEBUG_LIBRARIES}"
optimized "${Wt_LIBRARIES}"
)
endif( NOT InterSpec_FETCH_DEPENDENCIES )
target_link_directories(InterSpecLib PUBLIC ${Boost_LIBRARY_DIR})
else(WIN32)
target_link_libraries(InterSpecLib PUBLIC
${Wt_LIBRARIES}
${Wt_LIBRARY}
${Wt_HTTP_LIBRARY}
${Wt_DBO_LIBRARY}
${Wt_DBOSQLITE3_LIBRARY}
)
endif(WIN32)
if( USE_REL_ACT_TOOL )
target_link_libraries(InterSpecLib PUBLIC Eigen3::Eigen Ceres::ceres )
endif( USE_REL_ACT_TOOL )
if( BUILD_AS_OSX_APP )
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
FIND_LIBRARY(COREDATA_LIBRARY CoreData)
FIND_LIBRARY(APPKIT_LIBRARY AppKit)
FIND_LIBRARY(FOUNDATION_LIBRARY Foundation)
MARK_AS_ADVANCED( COCOA_LIBRARY COREDATA_LIBRARY APPKIT_LIBRARY FOUNDATION_LIBRARY )
target_link_libraries( InterSpecLib PUBLIC
${COCOA_LIBRARY}
${APPKIT_LIBRARY}
${COREDATA_LIBRARY}
${FOUNDATION_LIBRARY}
)
if( USE_BATCH_TOOLS )
set_target_properties( InterSpecLib PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION A
MACOSX_FRAMEWORK_IDENTIFIER gov.sandia.InterSpecFramework
MACOSX_FRAMEWORK_SHORT_VERSION_STRING 1.0
MACOSX_FRAMEWORK_BUNDLE_VERSION 1.0.0
MACOSX_FRAMEWORK_COPYRIGHT "© 2024 Sandia National Laboratories"
# XCODE_ATTRIBUTE_INSTALL_PATH @executable_path/../Frameworks/
XCODE_ATTRIBUTE_SKIP_INSTALL "Yes"
)
set_target_properties( InterSpecLib PROPERTIES
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER gov.sandia.InterSpecFramework
)
set_target_properties( InterSpecLib PROPERTIES
PUBLIC_HEADER "InterSpec_config.h"
)
endif( USE_BATCH_TOOLS )
endif( BUILD_AS_OSX_APP )
if( BUILD_AS_LOCAL_SERVER AND (CMAKE_GENERATOR STREQUAL "Xcode") )
# Setting Xcode working directory requires cmake 3.17
if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0" )
set_target_properties(InterSpecExe PROPERTIES
XCODE_GENERATE_SCHEME TRUE
XCODE_SCHEME_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0" )
endif( BUILD_AS_LOCAL_SERVER AND (CMAKE_GENERATOR STREQUAL "Xcode") )
if(MSVC AND (NOT hasParent))
set_target_properties( InterSpecExe PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
endif(MSVC AND (NOT hasParent))
#20180104: on my mac I tried compiling Wt with support for PDF (libharu), but only
# had the static libhpdfs, so I had to add bellow to link to this
FIND_LIBRARY( HPDF_LIBRARY NAME hpdfs HINTS ${Wt_INCLUDE_DIR}/../lib )
if(NOT HPDF_LIBRARY)
message(
"Could not find libharu - if Wt was built with PDF support, you will get link errors"
)
else()
target_link_libraries(InterSpecLib PUBLIC ${HPDF_LIBRARY})
FIND_LIBRARY( PNG_LIBRARY NAME png HINTS ${Wt_INCLUDE_DIR}/../lib )
if(NOT PNG_LIBRARY)
message(FATAL_ERROR "Could not find libpng - requred for libharu")
else()
target_link_libraries(InterSpecLib PUBLIC ${PNG_LIBRARY})
endif()
endif()
#bellow is what I need to get things working 20131120 for statically linked
if(TRY_TO_STATIC_LINK)
if(APPLE AND NOT IOS)
find_library( CARBON_LIBRARY Carbon REQUIRED )
find_library( FOUNDATION_LIBRARY Foundation REQUIRED )
mark_as_advanced( CARBON_LIBRARY FOUNDATION_LIBRARY )
target_link_libraries( InterSpecLib PUBLIC ${CARBON_LIBRARY} ${FOUNDATION_LIBRARY} )
if(USE_OSX_NATIVE_MENU)
find_library( APP_KIT_LIBRARY AppKit REQUIRED )
mark_as_advanced( APP_KIT_LIBRARY )
target_link_libraries( InterSpecLib PUBLIC ${APP_KIT_LIBRARY} )
endif(USE_OSX_NATIVE_MENU)
endif(APPLE AND NOT IOS)
if(USE_MYSQL_DB)
include(cmake/WtFindMysql.txt)
target_link_libraries(InterSpecLib PUBLIC ${MYSQL_LIBRARIES})
endif(USE_MYSQL_DB)
if(Wt_FCGI_LIBRARY)
include(cmake/WtFindFcgi.txt)
target_link_libraries(InterSpecLib PUBLIC ${FCGI_LIBRARIES})
endif(Wt_FCGI_LIBRARY)
#include(cmake/WtFindSsl.txt)
#if(SSL_FOUND)
# target_link_libraries(InterSpecLib PUBLIC ${SSL_LIBRARIES})
#endif(SSL_FOUND)
if(("${CMAKE_SYSTEM}" MATCHES "Linux") AND (NOT ANDROID))
find_library( RT_LIB rt REQUIRES )
target_link_libraries(InterSpecLib PUBLIC ${RT_LIB})
#target_link_libraries( InterSpecExe -static-libgcc -static-libstdc++)
#Next line statically links to pthread, copying whole archive into exe
#set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-static -pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive")
endif(("${CMAKE_SYSTEM}" MATCHES "Linux") AND (NOT ANDROID))
endif(TRY_TO_STATIC_LINK)
if(Wt_DBOSQLITE3_LIBRARY)
find_file( HAS_WT_DBO_SQLITE3 "Sqlite3" PATHS "${Wt_INCLUDE_DIR}/Wt/Dbo/backend/" NO_DEFAULT_PATH )
endif(Wt_DBOSQLITE3_LIBRARY)
if(Wt_MYSQL_LIBRARY)
find_file( HAS_WT_DBO_MYSQL "MySQL" PATHS "${Wt_INCLUDE_DIR}/Wt/Dbo/backend/" NO_DEFAULT_PATH )
endif(Wt_MYSQL_LIBRARY)
if(Wt_MYSQL_LIBRARY AND BUILD_FOR_WEB_DEPLOYMENT AND USE_MYSQL_DB)
set(DATABASE_PASSWORD_FILE "/path/to/passwords/databases.xml"
CACHE STRING
"Location of the XML passwords file for connecting to MySQL database"
)
endif(Wt_MYSQL_LIBRARY AND BUILD_FOR_WEB_DEPLOYMENT AND USE_MYSQL_DB)
if(USE_MYSQL_DB AND NOT HAS_WT_DBO_MYSQL)
MESSAGE(FATAL_ERROR "You do not have the MySQL Wt Dbo backend installed, but you have asked to use it")
endif(USE_MYSQL_DB AND NOT HAS_WT_DBO_MYSQL)
if(USE_SQLITE3_DB AND NOT HAS_WT_DBO_SQLITE3 AND NOT WIN32 AND NOT InterSpec_FETCH_DEPENDENCIES )
MESSAGE(FATAL_ERROR "You do not have the SQLITE3 Wt Dbo backend installed, but you have asked to use it")
endif(USE_SQLITE3_DB AND NOT HAS_WT_DBO_SQLITE3 AND NOT WIN32 AND NOT InterSpec_FETCH_DEPENDENCIES )
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/InterSpec/InterSpec_config.h.in
${CMAKE_BINARY_DIR}/InterSpec_config.h
)
#if(ANDROID)
# target_include_directories(InterSpecLib PUBLIC target)
#endif(ANDROID)
if( WIN32 )
# The following are only needed for Wt 3.7.1, not 3.3.4
target_link_libraries( InterSpecLib PUBLIC opengl32.lib d2d1.lib windowscodecs.lib Dwrite.lib )
endif( WIN32 )
#if( ${PERFORM_DEVELOPER_CHECKS} EQUAL ${SpecUtils_ENABLE_EQUALITY_CHECKS} )
# MESSAGE(FATAL_ERROR "PERFORM_DEVELOPER_CHECKS (${PERFORM_DEVELOPER_CHECKS}) must be equal to SpecUtils_ENABLE_EQUALITY_CHECKS (${SpecUtils_ENABLE_EQUALITY_CHECKS})")
#endif()
# I cant seems to get more complex regexs to work, so we'll use many simple ones.
FILE(GLOB JS_BASE_FILES InterSpec_resources/*.js )
FILE(GLOB_RECURSE CSS_BASE_FILES LIST_DIRECTORIES TRUE InterSpec_resources/*.css )
list(FILTER CSS_BASE_FILES EXCLUDE REGEX ".*SpectrumChartD3.*css")
list(FILTER CSS_BASE_FILES EXCLUDE REGEX ".min.css")
FILE(GLOB STATIC_XML_FILES InterSpec_resources/static_text/*.xml )
FILE(GLOB STATIC_HTML_TMPLTS_FILES InterSpec_resources/static_text/*.html )
FILE(GLOB STATIC_ADD_XML_FILES InterSpec_resources/static_text/*/*.xml )
FILE(GLOB STATIC_ADD_CSS_FILES InterSpec_resources/static_text/*/*.css )
list( APPEND OTHER_InterSpec_SUPPORT_FILES
${JS_BASE_FILES}
${CSS_BASE_FILES}
${STATIC_XML_FILES}
${STATIC_ADD_XML_FILES}
${STATIC_ADD_CSS_FILES}
${STATIC_HTML_TMPLTS_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/InterSpec_resources/static_text/help.json
${CMAKE_CURRENT_SOURCE_DIR}/README.md
)
add_custom_target(interspec_resources SOURCES ${OTHER_InterSpec_SUPPORT_FILES})
# Make a target for the XML files that hold the (internationalized) text for the app
FILE(GLOB APP_TEXT_FILES InterSpec_resources/app_text/*.xml )
add_custom_target( interspec_app_text SOURCES ${APP_TEXT_FILES} )
#Copy files to the install directory
foreach(_file ${OTHER_FILES})
configure_file(
${PROJECT_SOURCE_DIR}/${_file}
${PROJECT_BINARY_DIR}/${_file}
COPYONLY
)
endforeach()
if(IOS)
MESSAGE("CMAKE_CURRENT_SOURCE_DIR is ${CMAKE_CURRENT_SOURCE_DIR}")
MESSAGE("Looking for form.css in ${CMAKE_CURRENT_SOURCE_DIR}/wt-3.3.1/resources")
if(NOT WT_RESOURCES_DIRECTORY)
FIND_PATH(WT_RESOURCES_DIRECTORY form.css HINTS ${CMAKE_CURRENT_SOURCE_DIR}/wt-3.3.1/resources NO_DEFAULT_PATHS NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif(NOT WT_RESOURCES_DIRECTORY)
MESSAGE("***** WT_RESOURCES_DIRECTORY is ${WT_RESOURCES_DIRECTORY}")
MESSAGE("WT_RESOURCES_DIRECTORY IS ${WT_RESOURCES_DIRECTORY}")
endif(IOS)
if(NOT WT_RESOURCES_DIRECTORY)
MESSAGE("Could not find the Wt resources path to copy into current directory")
else(NOT WT_RESOURCES_DIRECTORY)
MESSAGE("Using Wt resources from ${WT_RESOURCES_DIRECTORY}")
file(COPY ${WT_RESOURCES_DIRECTORY} DESTINATION ${PROJECT_BINARY_DIR}/)
endif(NOT WT_RESOURCES_DIRECTORY)
if(NOT ANDROID)
SET( SUPPORT_DIRECTORIES InterSpec_resources data example_spectra )
endif(NOT ANDROID)
foreach(_dir ${SUPPORT_DIRECTORIES})
if(WIN32)
# file(COPY ${PROJECT_SOURCE_DIR}/${_dir} DESTINATION ${PROJECT_BINARY_DIR}/ )
else(WIN32)
execute_process(
COMMAND
${CMAKE_COMMAND} -E create_symlink ${PROJECT_SOURCE_DIR}/${_dir}
${PROJECT_BINARY_DIR}/${_dir}
)
endif(WIN32)
endforeach()
# TODO: I think we can get rid of this next part, but need to modify in the code a little bit probably
if(INCLUDE_ANALYSIS_TEST_SUITE)
if(WIN32)
# file(COPY ${PROJECT_SOURCE_DIR}/target/testing/analysis_tests DESTINATION ${PROJECT_BINARY_DIR}/analysis_tests )
else(WIN32)
execute_process(
COMMAND
${CMAKE_COMMAND} -E create_symlink
${PROJECT_SOURCE_DIR}/target/testing/analysis_tests
${PROJECT_BINARY_DIR}/analysis_tests
)
endif(WIN32)
endif()
configure_file(
${PROJECT_SOURCE_DIR}//external_libs/SandiaDecay/sandia.decay.min.xml
${PROJECT_BINARY_DIR}/data/sandia.decay.xml
COPYONLY
)
# Only create an install target if this is a top-level project (e.g., not Electron, or iOS, etc)
if( NOT hasParent )
INSTALL(TARGETS InterSpecExe DESTINATION bin)
INSTALL(TARGETS InterSpecLib DESTINATION lib)
INSTALL(DIRECTORY data example_spectra InterSpec_resources DESTINATION share/interspec)