-
Notifications
You must be signed in to change notification settings - Fork 65
/
CMakeLists.txt
1195 lines (979 loc) · 47.5 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.7.2)
# set project name. The exe name is taken from this
SET( PROJECT_NAME CaPTk )
PROJECT( CaPTk )
SET( ${PROJECT_NAME} )
SET( ${PROJECT_NAME}_Variant "Full" ) # the particular variant of CaPTk (Full/Neuro/Torso/Viewer)
# WARNING: captk-pkg (the linux packager) directly tries to pattern match these lines (excluding the actual number/patch text)
# to read the version number.
# So small changes here to formatting or naming convention *may potentially break the linux packager*!
# STRING(TIMESTAMP TODAY "%Y%m%d")
SET( PROJECT_VERSION_MAJOR 1 )
SET( PROJECT_VERSION_MINOR 9 )
SET( PROJECT_VERSION_PATCH 0 )
SET( PROJECT_VERSION_TWEAK )
# check for the string "nonRelease" in the PROJECT_VERSION_PATCH variable
# if it is found, add timestamp and git hash of commit to the version
STRING(FIND ${PROJECT_VERSION_PATCH} "nonRelease" NONRELEASE_FOUND)
IF( ${NONRELEASE_FOUND} GREATER 0 )
# get the timestamp
STRING(TIMESTAMP TODAY "%Y%m%d")
# get git hash
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
FIND_PACKAGE(Git)
IF(GIT_FOUND)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
OUTPUT_VARIABLE "GIT_HASH"
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
#MESSAGE( STATUS "Git version: ${GIT_HASH}" )
ELSE(GIT_FOUND)
SET(GIT_HASH 0)
ENDIF(GIT_FOUND)
ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
SET( PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}.${TODAY}.${GIT_HASH}" )
#MESSAGE( STATUS "PROJECT_VERSION_PATCH: ${PROJECT_VERSION_PATCH}")
ENDIF()
# Configure CCache if available
FIND_PROGRAM(CCACHE_FOUND ccache)
IF(CCACHE_FOUND)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
ENDIF(CCACHE_FOUND)
FIND_PROGRAM(CCacheExectuable ccache)
IF( CCacheExectuable )
# only used with >=cmake-3.4
SET( CMAKE_C_COMPILER_LAUNCHER "${CCacheExectuable}" )
SET( CMAKE_CXX_COMPILER_LAUNCHER "${CCacheExectuable}" )
#MESSAGE( STATUS "Speeding up build with ccache" )
ENDIF()
IF(WIN32)
# enable parallel builds for windows
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /MP")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
ENDIF()
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake_modules/)
INCLUDE( CaPTk_macros )
#SET (SVN_REVISION "${SVN_REVISION}")
OPTION( CAPTK_SUPERBUILD_FORCE "Force CaPTk Superbuild regardless of whether dependencies are found or not" OFF )
# claire option is not present for Windows, unfortunately
IF( UNIX )
SET( BUILD_CLAIRE OFF CACHE BOOL "Do you want to build CLAIRE (this changes the Superbuild)?" )
ENDIF()
SET( QT_VERSION_ACTUAL "5.12.1" )
if(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(EXISTS "/etc/issue")
file(READ "/etc/issue" LINUX_ISSUE)
if(LINUX_ISSUE MATCHES "CentOS")
SET( QT_VERSION_ACTUAL "5.11.1" )
endif()
endif()
endif()
endif()
SET( QT_VERSION ${QT_VERSION_ACTUAL} CACHE STRING "Superbuild Qt version to build CaPTk against" FORCE )
SET( OPENCV_VERSION "3.4.7" CACHE STRING "Superbuild OpenCV version to build CaPTk against" FORCE )
SET(CAPTK_BUILD_DIR "${PROJECT_BINARY_DIR}" CACHE STRING "CaPTk build directory" FORCE )
ADD_DEFINITIONS(-DCAPTK_BUILD_DIR="${PROJECT_BINARY_DIR}")
CAPTK_INITIAL_SETUP()
IF( CAPTK_SUPERBUILD_FORCE )
PROJECT(${PROJECT_NAME}_Depends)
INCLUDE( ${PROJECT_SOURCE_DIR}/cmake_modules/Superbuild.cmake )
return()
ELSE()
FIND_PACKAGE(ITK)
IF(NOT EXISTS ${ITK_USE_FILE})
#MESSAGE( AUTHOR_WARNING "=== [DEBUG] PROJECT_BIN_DIR=${PROJECT_BINARY_DIR}" )
IF( NOT EXISTS ${PROJECT_BINARY_DIR}/ITK-build/ITKConfig.cmake )
OPTION( CAPTK_SUPERBUILD "Do a Superbuild of the CaPTk dependencies or Specify ITK install directory with the defined components" ON )
IF( CAPTK_SUPERBUILD )
PROJECT(${PROJECT_NAME}_Depends)
INCLUDE( ${PROJECT_SOURCE_DIR}/cmake_modules/Superbuild.cmake )
return()
ENDIF()
ENDIF()
ENDIF()
IF( EXISTS ${PROJECT_BINARY_DIR}/ITK-build/ITKConfig.cmake )
SET( ITK_DIR "${PROJECT_BINARY_DIR}/ITK-build/" CACHE STRING "ITK_DIR Path for use in other builds" FORCE )
SET( DCMTK_DIR "${PROJECT_BINARY_DIR}/DCMTK-build/" CACHE STRING "ITK_DIR Path for use in other builds" FORCE )
IF (APPLE) # THIS QT FOLDER STRUCTURE WAS NOT REQUIRED FOR 5.11.2
SET( ENV{PATH} "${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/clang_64/lib/cmake/Qt5/:${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/clang_64/bin:$ENV{PATH}" CACHE PATH "" FORCE)
SET( ENV{CMAKE_PREFIX_PATH} "${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/clang_64/lib/cmake/Qt5/:${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/clang_64/bin:${PROJECT_BINARY_DIR}/ITK-build/:${PROJECT_BINARY_DIR}/DCMTK-build/:${PROJECT_BINARY_DIR}/OpenCV-build/:${PROJECT_BINARY_DIR}/VTK-build:$ENV{CMAKE_PREFIX_PATH}" CACHE PATH "" FORCE )
SET( ENV{CMAKE_PROGRAM_PATH} "${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/clang_64/lib/cmake/Qt5/:${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/clang_64/bin:$ENV{CMAKE_PROGRAM_PATH}" CACHE PATH "" FORCE )
ELSE()
SET( ENV{CMAKE_PREFIX_PATH} "${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/lib/cmake/Qt5/:${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/bin:${PROJECT_BINARY_DIR}/ITK-build/:${PROJECT_BINARY_DIR}/DCMTK-build/:${PROJECT_BINARY_DIR}/OpenCV-build/:${PROJECT_BINARY_DIR}/VTK-build:$ENV{CMAKE_PREFIX_PATH}" CACHE PATH "" FORCE )
SET( ENV{LD_LIBRARY_PATH} "${QT_EXTRACTED_DIR}/${QT_VERSION}/lib/:$ENV{LD_LIBRARY_PATH}" CACHE PATH "" FORCE )
SET( ENV{CMAKE_PROGRAM_PATH} "${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/lib/cmake/Qt5/:${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/bin:$ENV{CMAKE_PROGRAM_PATH}" CACHE PATH "" FORCE )
SET( ENV{PATH} "${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/lib/cmake/Qt5/:${PROJECT_BINARY_DIR}/qt/${QT_VERSION}/bin:$ENV{PATH}" CACHE PATH "" FORCE)
ENDIF()
#MESSAGE( AUTHOR_WARNING "=== [DEBUG] ENV{CMAKE_PREFIX_PATH}=$ENV{CMAKE_PREFIX_PATH}" )
ENDIF()
ENDIF()
# MESSAGE()
SET( PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" CACHE STRING "The project version" FORCE )
MESSAGE( AUTHOR_WARNING "Building CaPTk version ${PROJECT_VERSION}")
IF (APPLE)
SET (EXE_NAME "${PROJECT_NAME}_${PROJECT_VERSION}")
ELSE()
SET( EXE_NAME "${PROJECT_NAME}" )
ENDIF()
#IF( NOT( ${SVN_REVISION} STREQUAL "" ) )
# SET( PROJECT_VERSION "${PROJECT_VERSION}_${SVN_REVISION}")
#ENDIF()
IF(${PROJECT_NAME}_Variant MATCHES "Full" )
SET( PROJECT_NAME_EXTENDED "Cancer Imaging Phenomics Toolkit (${PROJECT_NAME})")
ELSE()
SET( PROJECT_NAME_EXTENDED "Cancer Imaging Phenomics Toolkit (${PROJECT_NAME}_${${PROJECT_NAME}_Variant})" )
ENDIF()
SET( PROJECT_VENDOR "CBICA - UPenn" )
SET( LICENSE_FILE "${PROJECT_SOURCE_DIR}/LICENSE" )
SET( README_FILE "${PROJECT_SOURCE_DIR}/README.txt" )
SET( PROJECT_DOMAIN "https://www.med.upenn.edu/cbica/captk/" )
SET( PROJECT_CONTACT "[email protected]" )
SET( COPYRIGHT "Copyright (c) 2019 CBICA. All rights reserved.")
SET( IDENTIFIER "")
ADD_DEFINITIONS(-DPROJECT_NAME="${PROJECT_NAME}" )
ADD_DEFINITIONS(-DPROJECT_VERSION="${PROJECT_VERSION}" )
ADD_DEFINITIONS(-DEXE_NAME="${EXE_NAME}")
ADD_DEFINITIONS(-DCaPTk_Variant="${CaPTk_Variant}")
ADD_DEFINITIONS(-DPROJECT_NAME_EXTENDED="${PROJECT_NAME_EXTENDED}")
ADD_DEFINITIONS(-DCONTACT="${PROJECT_CONTACT}")
ADD_DEFINITIONS(-DPROJECT_CONTACT="${PROJECT_CONTACT}")
ADD_DEFINITIONS(-DPROJECT_DOMAIN="${PROJECT_DOMAIN}")
ADD_DEFINITIONS(-DPROJECT_LICENSE="${LICENSE_FILE}")
ADD_DEFINITIONS(-DLICENSE="${LICENSE_FILE}")
ADD_DEFINITIONS(-DPROJECT_README="${README_FILE}")
ADD_DEFINITIONS(-DREADME="${README_FILE}")
ADD_DEFINITIONS(-DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}/")
ADD_DEFINITIONS(-DPROJECT_BINARY_DIR="${PROJECT_BINARY_DIR}/")
ADD_DEFINITIONS(-DPROJECT_VARIANT="${${PROJECT_NAME}_Variant}")
### Building the documentation
## The following 4 lines are for generation of public documentation
SET( BUILD_DOCUMENTATION ON CACHE BOOL "Do you want to build Documentation (needs Doxygen)?" )
SET( BUILD_DOCUMENTATION_ONLY OFF CACHE BOOL "This doesn't build anything else in the project" )
SET( CAPTK_UPDATE_DOCS OFF CACHE BOOL "Copy HTML files to $PROJECT_SOURCE_DIR/docs for git commit" )
MARK_AS_ADVANCED(BUILD_DOCUMENTATION)
MARK_AS_ADVANCED(BUILD_DOCUMENTATION_ONLY)
IF( BUILD_DOCUMENTATION_ONLY )
SET( BUILD_DOCUMENTATION ON )
SET( CAPTK_UPDATE_DOCS ON ) #in this case, the HTML files are updated all the time
ENDIF()
IF( BUILD_DOCUMENTATION )
ADD_SUBDIRECTORY( docs_sources )
ENDIF ()
IF( NOT BUILD_DOCUMENTATION_ONLY )
# Provide build configuration option
SET( CAPTK_BUILD_OPTION "PACKAGE_PROJECT" CACHE STRING "Toggle between packaging mode (optimized code) or developer mode (provides debugging info)" )
SET_PROPERTY( CACHE CAPTK_BUILD_OPTION PROPERTY STRINGS PACKAGE_PROJECT DEVELOPER_MODE )
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
IF( CAPTK_BUILD_OPTION STREQUAL PACKAGE_PROJECT)
SET( CAPTK_PACKAGE_PROJECT ON )
SET( CAPTK_UPDATE_DOCS ON CACHE BOOL "Copy HTML files to $PROJECT_SOURCE_DIR/docs for git commit" )
SET( CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "Default configuration types" FORCE )
ADD_DEFINITIONS(-DCAPTK_PACKAGE_PROJECT)
# add a few compiler options for GCC and MSVC
IF( CMAKE_COMPILER_IS_GNUCXX )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function -O3" )
ENDIF()
if(APPLE)
SET (CAPTK_MACOSX_BUNDLE_NAME "${PROJECT_NAME}_${PROJECT_VERSION}")
SET (CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${PROJECT}" )
endif()
IF(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
ENDIF(MSVC)
ELSE()
SET( CAPTK_PACKAGE_PROJECT OFF )
SET( CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "Default configuration types" FORCE )
ENDIF()
OPTION( CAPTK_DISABLE_CWL "Disable CWL file generation - useful for debug builds or devops" ON )
MARK_AS_ADVANCED(CAPTK_PACKAGE_PROJECT)
MARK_AS_ADVANCED(CAPTK_BUILD_OPTION)
MARK_AS_ADVANCED(CAPTK_DISABLE_CWL)
SET( CMAKE_COLOR_MAKEFILE ON )
# option to compile only the viewer
SET( CAPTK_BUILD_CONSOLE_ONLY OFF CACHE BOOL "Do you want only the interactive capabilities of ${PROJECT_NAME}? Enabling this will remove all algorithms from compilation." )
IF (CAPTK_BUILD_CONSOLE_ONLY)
ADD_DEFINITIONS(-DCAPTK_BUILD_CONSOLE_ONLY)
ENDIF()
MARK_AS_ADVANCED(CAPTK_BUILD_CONSOLE_ONLY)
SET( CAPTK_CLI_MODE OFF CACHE BOOL "Builds only CLI apps of CaPTk." )
ADD_DEFINITIONS(-DCAPTK_CLI_MODE)
# find dependencies START
SET( THIRDPARTY_LIB_PATH ${PROJECT_SOURCE_DIR}/src/thirdparty )
INCLUDE_DIRECTORIES( ${THIRDPARTY_LIB_PATH} )
### third party library processing
# find and include all third party libraries
SUBDIRLIST(SUBDIRECTORIES ${THIRDPARTY_LIB_PATH})
FIND_PACKAGE( ITK REQUIRED )
#FIND_PACKAGE( ITK REQUIRED )
INCLUDE("${ITK_USE_FILE}")
FIND_PACKAGE(OpenCV REQUIRED)
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
FOREACH(thirdParty_include ${SUBDIRECTORIES})
INCLUDE_DIRECTORIES( ${THIRDPARTY_LIB_PATH}/${thirdParty_include} )
IF( EXISTS "${THIRDPARTY_LIB_PATH}/${thirdParty_include}/include" )
INCLUDE_DIRECTORIES( ${THIRDPARTY_LIB_PATH}/${thirdParty_include}/include )
ENDIF()
#SUBDIRLIST(SUBDIRECTORIES_INT ${THIRDPARTY_LIB_PATH})
#FOREACH(thirdParty_int_include ${THIRDPARTY_LIB_PATH}/${thirdParty_include})
# INCLUDE_DIRECTORIES( ${THIRDPARTY_LIB_PATH}/${thirdParty_include}/${thirdParty_int_include} )
#ENDFOREACH()
ENDFOREACH()
# for YAML-CPP
FILE(GLOB_RECURSE YAMLCPP_Headers "${PROJECT_SOURCE_DIR}/src/thirdparty/yaml-cpp/include/yaml-cpp/*.h")
FILE(GLOB_RECURSE YAMLCPP_Sources "${PROJECT_SOURCE_DIR}/src/thirdparty/yaml-cpp/src/*.cpp")
SET( YAMLCPP_Headers ${YAMLCPP_Headers} CACHE STRING "YAML-CPP headers" FORCE )
SET( YAMLCPP_Sources ${YAMLCPP_Sources} CACHE STRING "YAML-CPP sources" FORCE )
### third party library processing
FIND_PACKAGE(VTK REQUIRED)
INCLUDE("${VTK_USE_FILE}")
IF(VTK_VERSION VERSION_LESS 6.0.0)
SET(VTK_LIBRARIES
vtkCommon
vtkRendering
vtkIO
vtkFiltering
vtkGraphics
vtkWidgets
vtkImaging
vtkHybrid
QVTK
)
ENDIF(VTK_VERSION VERSION_LESS 6.0.0)
IF(VTK_VERSION VERSION_LESS 5.6.0)
SET(VTK_LIBRARIES
${VTK_LIBRARIES}
#vtkQVTK
)
ENDIF(VTK_VERSION VERSION_LESS 5.6.0)
FIND_PACKAGE(Qt5 COMPONENTS Core Gui Svg Widgets WebView WebEngine WebEngineCore WebEngineWidgets Concurrent Test Sql REQUIRED)
# For some reason IF(LINUX) doesn't work properly on linux
# This is necessary for the whole project to compile on linux
IF(WIN32)
ELSEIF(APPLE)
ELSE()
FIND_PACKAGE(Qt5 COMPONENTS X11Extras REQUIRED)
ENDIF()
#INCLUDE(${QT_USE_FILE})
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTMAIN TRUE)
SET(QT_USE_QTGUI TRUE)
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
ADD_DEFINITIONS(-DQT_THREAD_SUPPORT)
LINK_DIRECTORIES(${QT_LIBRARY_DIR})
# link dependent libraries
SET( DEPENDENT_LIBS
Qt5::Core
Qt5::Gui
Qt5::Svg
Qt5::Widgets
Qt5::WebView
Qt5::WebEngine
Qt5::WebEngineCore
Qt5::WebEngineWidgets
Qt5::Concurrent
Qt5::Test
Qt5::Sql
${ITK_LIBRARIES}
${VTK_LIBRARIES}
${OpenCV_LIBRARIES}
${OpenMP_LIBRARIES}
)
IF(UNIX AND NOT APPLE)
SET( DEPENDENT_LIBS
${DEPENDENT_LIBS}
Qt5::X11Extras
)
ENDIF()
SET( DEPENDENT_LIBS ${DEPENDENT_LIBS} CACHE STRING "All dependent libraries" )
# find dependencies END
SET( DATA_DIR "${PROJECT_SOURCE_DIR}/data" )
# define build options for applications and add the respective definitions
SET( BUILD_TRAINING ON CACHE BOOL "Do you want to build Training Module?" )
SET( BUILD_EGFRvIII ON CACHE BOOL "Do you want to build EGFRvIII Estimation?" )
SET( BUILD_EGFRvIIISVM ON CACHE BOOL "Do you want to build EGFRvIII SVM Estimation?" )
SET( BUILD_RECURRENCE ON CACHE BOOL "Do you want to build Recurrence Estimation?" )
SET( BUILD_PSEUDOPROGRESSION ON CACHE BOOL "Do you want to build Pseudoprogression Estimation?" )
SET( BUILD_SURVIVAL ON CACHE BOOL "Do you want to build Survival Estimation?" )
SET( BUILD_ISUBTYPE OFF CACHE BOOL "Do you want to build Imaging Subtype Estimation?" )
SET( BUILD_MSUBTYPE ON CACHE BOOL "Do you want to build Molecular Subtype Estimation?" )
SET( BUILD_ATLAS ON CACHE BOOL "Do you want to build Population Atlas?" )
SET( BUILD_ALIGNMENT ON CACHE BOOL "Do you want to build Perfusion Alignment?" )
SET( BUILD_PCA ON CACHE BOOL "Do you want to build Perfusion PCA?" )
SET( BUILD_GEODESIC ON CACHE BOOL "Do you want to build Geodesic Segmentation?" )
SET( BUILD_GEODESICTRAINING ON CACHE BOOL "Do you want to build Geodesic Training Segmentation?" )
SET( BUILD_SBRT ON CACHE BOOL "Do you want to build SBRT Lung?" )
SET( BUILD_WHITESTRIPE ON CACHE BOOL "Do you want to build WhiteStripe Normalization?" )
SET( BUILD_ITKSNAP ON CACHE BOOL "Do you want to connect ITK-SNAP to CaPTk Console?" )
SET( BUILD_LIBRASINGLE ON CACHE BOOL "Do you want to connect LIBRA to CaPTk Console (needs MATLAB runtime)?" )
SET( BUILD_LIBRABATCH ON CACHE BOOL "Do you want to connect LIBRA to CaPTk Console (needs MATLAB runtime)?" )
SET( BUILD_CONFETTI ON CACHE BOOL "Do you want to connect Confetti to CaPTk Console (needs Python 2.7 and other dependencies)?" )
SET( BUILD_FETALBRAIN OFF CACHE BOOL "Do you want to build FetalBrain?" )
SET( BUILD_DEEPMEDIC ON CACHE BOOL "Do you want to package DeepMedic?" )
IF(BUILD_EGFRvIII)
ADD_DEFINITIONS(-DBUILD_EGFRvIII)
ENDIF()
IF(BUILD_EGFRvIIISVM)
ADD_DEFINITIONS(-DBUILD_EGFRvIIISVM)
ENDIF()
IF(BUILD_ALIGNMENT)
ADD_DEFINITIONS(-DBUILD_ALIGNMENT)
ENDIF()
IF(BUILD_PCA)
ADD_DEFINITIONS(-DBUILD_PCA)
ENDIF()
IF(BUILD_RECURRENCE)
ADD_DEFINITIONS(-DBUILD_RECURRENCE)
ENDIF()
IF(BUILD_PSEUDOPROGRESSION)
ADD_DEFINITIONS(-DBUILD_PSEUDOPROGRESSION)
ENDIF()
IF(BUILD_ISUBTYPE)
ADD_DEFINITIONS(-DBUILD_ISUBTYPE)
ENDIF()
IF(BUILD_MSUBTYPE)
ADD_DEFINITIONS(-DBUILD_MSUBTYPE)
ENDIF()
IF(BUILD_ATLAS)
ADD_DEFINITIONS(-DBUILD_ATLAS)
ENDIF()
IF(BUILD_RECURRENCE)
ADD_DEFINITIONS(-DBUILD_RECURRENCE)
ENDIF()
IF(BUILD_SURVIVAL)
ADD_DEFINITIONS(-DBUILD_SURVIVAL)
ENDIF()
IF(BUILD_GEODESIC)
ADD_DEFINITIONS(-DBUILD_GEODESIC)
ENDIF()
IF(BUILD_SBRT)
ADD_DEFINITIONS(-DBUILD_SBRT)
ENDIF()
IF(BUILD_WHITESTRIPE)
ADD_DEFINITIONS(-DBUILD_WHITESTRIPE)
ENDIF()
IF(BUILD_ITKSNAP)
ADD_DEFINITIONS(-DBUILD_ITKSNAP)
ENDIF()
IF(BUILD_LIBRA)
ADD_DEFINITIONS(-DBUILD_LIBRA)
ENDIF()
IF(BUILD_CONFETTI)
ADD_DEFINITIONS(-DBUILD_CONFETTI)
ENDIF()
IF(BUILD_FETALBRAIN)
ADD_DEFINITIONS(-DBUILD_FETALBRAIN)
ENDIF()
IF(BUILD_GEODESICTRAINING)
ADD_DEFINITIONS(-DBUILD_GEODESICTRAINING)
ENDIF()
# set stand-alone applications and libs directories
SET_PROPERTY( GLOBAL PROPERTY USE_FOLDERS ON )
SET( CaPTk_CLIs_Folder "CaPTk_CLIApps")
SET( CaPTk_Libs_Folder "CaPTk_Libs")
ADD_SUBDIRECTORY(${PROJECT_SOURCE_DIR}/src)
SET(INDIVIDUAL_APPLICATIONS_DIR ${PROJECT_SOURCE_DIR}/src/applications/individualApps)
# include dependencies
# add source code include directories
INCLUDE_DIRECTORIES(
${CACHED_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/
${PROJECT_SOURCE_DIR}/src/applications/
${PROJECT_SOURCE_DIR}/src/applications/common_includes/
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/src/depends/
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/src/
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction_includes/
${PROJECT_SOURCE_DIR}/src/applications/GeodesicTraining/
${PROJECT_SOURCE_DIR}/src/applications/GeodesicTraining/include/
${PROJECT_SOURCE_DIR}/src/cbica_toolkit/src/
${PROJECT_SOURCE_DIR}/src/cbica_toolkit/src/IO/inc
${PROJECT_SOURCE_DIR}/src/common/inc/
${PROJECT_SOURCE_DIR}/src/view/gui/
${GEODESIC_TRAINING_INCLUDE_DIRS}
${APPLICATION_INCLUDES}
${CACHED_INCLUDE_DIRS}
${OpenMP_INCLUDE_DIRS}
)
IF( BUILD_CONFETTI )
IF (WIN32)
# do nothing for windows since the pre-compiled binaries will be used
ELSE()
SET(ConfettiSrcs ${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/main.cpp
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/confetti.cpp)
SET(ConfettiHeaders
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/confetti.h
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/dtiUtils.h
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/multinomialModel.h)
#CAPTK_ADD_EXECUTABLE(${STANDALONE_APP_NAME} "${ConfettiSrcs} ${ConfettiHeaders}" "${OpenCV_LIBS} ${ITK_LIBRARIES}")
ADD_EXECUTABLE(Confetti ${ConfettiSrcs} ${ConfettiHeaders})
TARGET_LINK_LIBRARIES(Confetti ${OpenCV_LIBS} ${ITK_LIBRARIES})
SET_TARGET_PROPERTIES( Confetti PROPERTIES FOLDER "${CaPTk_CLIApps}" )
ADD_LIBRARY(ConfettiCore SHARED
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/confetti.cpp
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/confetti.h
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/multinomialModel.h
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/dtiUtils.h
${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/src/confettiApi.cpp
)
TARGET_LINK_LIBRARIES(ConfettiCore ${OpenCV_LIBS} ${ITK_LIBRARIES})
# install all targets and scripts
IF (APPLE)
INSTALL( TARGETS Confetti
BUNDLE DESTINATION .
RUNTIME DESTINATION ${EXE_NAME}.app/Contents/Resources/bin
LIBRARY DESTINATION ${EXE_NAME}.app/Contents/Resources/lib
CONFIGURATIONS "${CMAKE_CONFIGURATION_TYPES}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
INSTALL( TARGETS ConfettiCore
DESTINATION ${EXE_NAME}.app/Contents/Resources/lib
)
INSTALL( FILES ${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiCore.py
DESTINATION ${EXE_NAME}.app/Contents/Resources/libexec
)
IF( NOT CAPTK_CLI_MODE )
INSTALL( FILES ${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiGUI.py
DESTINATION ${EXE_NAME}.app/Contents/Resources/bin
#CONFIGURATIONS "${CMAKE_CONFIGURATION_TYPES}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
ENDIF()
ELSE()
INSTALL( TARGETS Confetti
BUNDLE DESTINATION .
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
CONFIGURATIONS "${CMAKE_CONFIGURATION_TYPES}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
INSTALL( TARGETS ConfettiCore
DESTINATION lib
)
INSTALL( FILES ${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiCore.py
DESTINATION libexec
)
IF( NOT CAPTK_CLI_MODE )
INSTALL( FILES ${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiGUI.py
DESTINATION bin
#CONFIGURATIONS "${CMAKE_CONFIGURATION_TYPES}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
ENDIF()
ENDIF()
ENDIF()
ENDIF()
ADD_DEFINITIONS(-DDATA_DIR="${DATA_DIR}")
ADD_DEFINITIONS(-DICON_DIR="${DATA_DIR}/icons")
ADD_DEFINITIONS(-DCAPTK_APP_LIST="${CAPTK_APP_LIST}")
ADD_DEFINITIONS(-DPREPROCESS_ALGOS="${PREPROCESSING_ALGOS}")
ADD_DEFINITIONS(-DCAPTK_APP_LIST_PY_GUI="${CAPTK_APP_LIST_PY_GUI}")
ADD_DEFINITIONS(-DCAPTK_APP_LIST_PY_CLI="${CAPTK_APP_LIST_PY_CLI}")
# keep source files structured as folders for clarity
SOURCE_GROUP( GUI FILES ${GUI_SOURCES_UPDATED} )
SOURCE_GROUP( CBICA-TK FILES ${CBICA-TK_SOURCES} )
SOURCE_GROUP( APPLICATIONS FILES ${APPLICATION_SOURCES} )
SOURCE_GROUP( APPLICATIONS_Dependencies FILES ${APPLICATION_DEPENDS} )
#SET( LIBNAME_GUI "${PROJECT_NAME}_GUI" )
SET( LIBNAME_Applications "${PROJECT_NAME}_Applications" )
SET( LIBNAME_FeatureExtractor "${PROJECT_NAME}_FeatureExtractor" )
SET( LIBNAME_CBICATK "${PROJECT_NAME}_CBICATK" )
# add all dependenciesO of ${application} to compilation
FILE( GLOB
FEATURE_EXTRACTION_DEPENDS
"${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction_includes/*.h"
"${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction_includes/*.cpp"
"${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction_includes/*.hxx"
)
ADD_LIBRARY(
${LIBNAME_FeatureExtractor}
${FEATURE_EXTRACTION_DEPENDS}
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/src/FeatureExtraction.h
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/src/FeatureExtraction.hxx
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/src/depends/LBPFeatures2D.h
${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/src/depends/LBPFeatures2D.cpp
#${CBICA-TK_SOURCES}
)
TARGET_LINK_LIBRARIES(
${LIBNAME_FeatureExtractor}
#${DEPENDENT_LIBS}
${LIBNAME_CBICATK}
${ITK_LIBRARIES}
${OpenCV_LIBRARIES}
)
ADD_LIBRARY(
${LIBNAME_Applications}
${APPLICATION_SOURCES}
${APPLICATION_DEPENDS}
#${CBICA-TK_SOURCES}
)
TARGET_LINK_LIBRARIES(
${LIBNAME_Applications}
${DEPENDENT_LIBS}
${LIBNAME_CBICATK}
${ITK_LIBRARIES}
${OpenCV_LIBRARIES}
)
ADD_DEPENDENCIES( ${LIBNAME_Applications} ${LIBNAME_GUI} ${LIBNAME_FeatureExtractor} )
SET_TARGET_PROPERTIES( ${LIBNAME_CBICATK} PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET_TARGET_PROPERTIES( ${LIBNAME_Applications} PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET_TARGET_PROPERTIES( ${LIBNAME_FeatureExtractor} PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET_TARGET_PROPERTIES( CaPTk_GUI PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET_TARGET_PROPERTIES( CaPTk_Common PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET_TARGET_PROPERTIES( GeodesicTrainingCaPTkLib PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET_TARGET_PROPERTIES( GeodesicTrainingComputeLib PROPERTIES FOLDER "${CaPTk_Libs_Folder}" )
SET( CAPTK_LIBRARIES
${LIBNAME_CBICATK}
${LIBNAME_Applications}
${LIBNAME_FeatureExtractor}
)
# find stand-alone CMD applications
FILE( GLOB STANDALONE_APPS
"${PROJECT_SOURCE_DIR}/src/applications/*.cxx"
)
#MESSAGE( STATUS "[debug]STANDALONE_APPS == ${STANDALONE_APPS}")
#SET(STANDALONE_APPS_LIST "")
FOREACH(application ${STANDALONE_APPS})
GET_FILENAME_COMPONENT( STANDALONE_APP_NAME ${application} NAME_WE )
IF( NOT (${STANDALONE_APP_NAME} STREQUAL "ImagingSubtypePredictor" ) )
CAPTK_ADD_EXECUTABLE(${STANDALONE_APP_NAME} ${PROJECT_SOURCE_DIR}/src/applications/${STANDALONE_APP_NAME}.cxx "${CAPTK_LIBRARIES}" )
ENDIF()
ENDFOREACH()
IF (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install" CACHE PATH "Default Install Path" FORCE )
ENDIF()
## Build test(s) only if CAPTK_PACKAGE_PROJECT is OFF
#IF( NOT CAPTK_PACKAGE_PROJECT )
SET( BUILD_TESTING TRUE CACHE BOOL "Build testing" )
IF( BUILD_TESTING )
ENABLE_TESTING()
ADD_SUBDIRECTORY( testing )
#INCLUDE(CTest)
ENDIF( BUILD_TESTING )
#ENDIF()
# installation
IF (UNIX)
IF(NOT LIBEXEC_INSTALL_DIR)
SET(LIBEXEC_INSTALL_DIR "./libexec")
ENDIF()
ENDIF()
## symlink creation for UNIX machines - currently only works for DEB or RPM
# IF (UNIX OR APPLE)
# INSTALL(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_INSTALL_PREFIX}/bin/${EXE_NAME} ${CMAKE_INSTALL_PREFIX}/bin/captk)")
# ENDIF()
SET(META_FILES_TO_INCLUDE "") # used for Apple package
#IF( BUILD_DOCUMENTATION )
IF (APPLE)
# TODO: Figure out how to set properties on files only present after configuration
FILE(GLOB ALL_DOC_FILES_BASE "${PROJECT_BINARY_DIR}/docs_sources/html/*.*")
FOREACH(docFiles ${ALL_DOC_FILES_BASE})
SET_SOURCE_FILES_PROPERTIES(${docFiles} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/share/doc)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${docFiles})
ENDFOREACH()
ELSE() # Windows or Linux
# Need to install the directory to pick up files that are not present at configure time (for CI/Azure)
INSTALL( DIRECTORY ${PROJECT_BINARY_DIR}/docs_sources/html/ DESTINATION share/doc )
ENDIF()
#ENDIF()
# ensure all licenses are in the package
FILE( GLOB_RECURSE ALL_LICENSES "${PROJECT_SOURCE_DIR}/licenses/*.txt" )
IF (APPLE)
SET_SOURCE_FILES_PROPERTIES(${ALL_LICENSES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/license)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${ALL_LICENSES})
ELSE()
FOREACH( license ${ALL_LICENSES} )
INSTALL( FILES "${license}" DESTINATION licenses )
ENDFOREACH()
ENDIF()
#INSTALL(FILES "${README_FILE}" DESTINATION ".") # not needed any more
# ensure all icons are in the package
FILE( GLOB_RECURSE ALL_ICONS "${DATA_DIR}/icons/*.png" )
IF (APPLE)
SET_SOURCE_FILES_PROPERTIES(${ALL_ICONS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/icons)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${ALL_ICONS})
ELSE()
FOREACH( icon ${ALL_ICONS} )
INSTALL(FILES "${icon}" DESTINATION data/icons )
ENDFOREACH()
ENDIF()
SET( CAPTK_STYLESHEET_FILE "captk.qss" )
ADD_DEFINITIONS( -DCAPTK_STYLESHEET_FILE="${CAPTK_STYLESHEET_FILE}" )
#INSTALL(FILES "${DATA_DIR}/FetalModel.xml" DESTINATION data)
IF (WIN32)
# Can't be used with Linuxdeployqt or macdeployqt
INSTALL(FILES "${DATA_DIR}/${CAPTK_STYLESHEET_FILE}" DESTINATION etc)
INSTALL(FILES "${DATA_DIR}/qt.conf" DESTINATION bin)
ELSEIF (APPLE)
SET_SOURCE_FILES_PROPERTIES("${DATA_DIR}/${CAPTK_STYLESHEET_FILE}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources/etc)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} "${DATA_DIR}/${CAPTK_STYLESHEET_FILE}")
ELSE ()
INSTALL(FILES "${DATA_DIR}/${CAPTK_STYLESHEET_FILE}" DESTINATION etc)
# Linux needs the applications folder to be able to create a binary with linuxdeployqt
INSTALL(DIRECTORY "${DATA_DIR}/applications" DESTINATION share)
ENDIF()
IF (APPLE)
SET( FLAIR_FILE "${DATA_DIR}/AAAC0_flair_pp_shrunk.nii.gz")
SET_SOURCE_FILES_PROPERTIES( ${FLAIR_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data)
SET( FLAIR_TESTTUMOR_FILE "${DATA_DIR}/AAAC0_flair_pp_shrunk_testTumor.nii.gz")
SET_SOURCE_FILES_PROPERTIES( ${FLAIR_TESTTUMOR_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data)
FILE(GLOB survival_FILES "${DATA_DIR}/survival/*.*")
SET_SOURCE_FILES_PROPERTIES(${survival_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/survival)
FILE(GLOB egfrv3_FILES "${DATA_DIR}/egfrv3/*.*")
SET_SOURCE_FILES_PROPERTIES(${egfrv3_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/egfrv3)
FILE(GLOB egfrv3_FILES "${DATA_DIR}/molecular/*.*")
SET_SOURCE_FILES_PROPERTIES(${egfrv3_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/molecular)
FILE(GLOB sri24_FILES "${DATA_DIR}/sri24/*.*")
SET_SOURCE_FILES_PROPERTIES(${sri24_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/sri24)
FILE(GLOB DOWNLOAD_LINKS "${DATA_DIR}/links.yaml")
SET_SOURCE_FILES_PROPERTIES(${DOWNLOAD_LINKS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${FLAIR_FILE} ${FLAIR_TESTTUMOR_FILE} ${survival_FILES} ${egfrv3_FILES} ${sri24_FILES} ${DOWNLOAD_LINKS})
ELSE ()
INSTALL(FILES "${DATA_DIR}/AAAC0_flair_pp_shrunk.nii.gz" DESTINATION data)
INSTALL(FILES "${DATA_DIR}/AAAC0_flair_pp_shrunk_testTumor.nii.gz" DESTINATION data)
INSTALL(FILES "${DATA_DIR}/links.yaml" DESTINATION data)
INSTALL(DIRECTORY "${DATA_DIR}/survival" DESTINATION data PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY "${DATA_DIR}/egfrv3" DESTINATION data PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY "${DATA_DIR}/molecular" DESTINATION data PATTERN ".svn" EXCLUDE)
INSTALL(DIRECTORY "${DATA_DIR}/sri24" DESTINATION data PATTERN ".svn" EXCLUDE)
ENDIF()
# install DeepMedic files
IF (APPLE)
FILE(GLOB_RECURSE DEEPMEDIC_CONFIGFILES "${DATA_DIR}/deepMedic/configFiles/*")
FILE(GLOB_RECURSE DEEPMEDIC_SAVEDMODELS_BRAIN_TUMOR "${DATA_DIR}/deepMedic/saved_models/brainTumorSegmentation/*")
FILE(GLOB_RECURSE DEEPMEDIC_SAVEDMODELS_SKULL "${DATA_DIR}/deepMedic/saved_models/skullStripping/*")
FILE(GLOB_RECURSE DEEPMEDIC_SAVEDMODELS_SKULL_MA "${DATA_DIR}/deepMedic/saved_models/skullStripping_modalityAgnostic/*")
SET_SOURCE_FILES_PROPERTIES( ${DEEPMEDIC_CONFIGFILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/deepMedic/configFiles )
SET_SOURCE_FILES_PROPERTIES( ${DEEPMEDIC_SAVEDMODELS_BRAIN_TUMOR} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/deepMedic/saved_models/brainTumorSegmentation )
SET_SOURCE_FILES_PROPERTIES( ${DEEPMEDIC_SAVEDMODELS_SKULL} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/deepMedic/saved_models/skullStripping )
SET_SOURCE_FILES_PROPERTIES( ${DEEPMEDIC_SAVEDMODELS_SKULL_MA} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/deepMedic/saved_models/skullStripping_modalityAgnostic )
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${DEEPMEDIC_CONFIGFILES})
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${DEEPMEDIC_SAVEDMODELS_BRAIN_TUMOR})
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${DEEPMEDIC_SAVEDMODELS_SKULL})
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${DEEPMEDIC_SAVEDMODELS_SKULL_MA})
ELSE()
INSTALL(DIRECTORY "${DATA_DIR}/deepMedic/configFiles" DESTINATION data/deepMedic)
INSTALL(DIRECTORY "${DATA_DIR}/deepMedic/saved_models" DESTINATION data/deepMedic)
ENDIF()
# install CWL files if they aren't getting generated
#IF(CAPTK_DISABLE_CWL)
FILE(GLOB_RECURSE CWL_FILES "${DATA_DIR}/cwlFiles/*")
FOREACH(cwlFile ${CWL_FILES})
IF (APPLE)
SET_SOURCE_FILES_PROPERTIES(${cwlFile} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/etc/cwlDefinitions)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${cwlFile})
INSTALL(FILES "${cwlFile}" DESTINATION ${EXE_NAME}.app/Contents/Resources/etc/cwlDefinitions)
ELSE()
INSTALL(FILES "${cwlFile}" DESTINATION etc/cwlDefinitions)
ENDIF()
ENDFOREACH()
#ENDIF()
IF(WIN32)
FILE(GLOB_RECURSE ALL_DEPENDENT_LIBS "${PROJECT_BINARY_DIR}/${CMAKE_CONFIGURATION_TYPES}/*.dll")
ELSE(WIN32)
FILE(GLOB_RECURSE ALL_DEPENDENT_LIBS "${PROJECT_BINARY_DIR}/${CMAKE_CONFIGURATION_TYPES}/*.so")
ENDIF()
FOREACH(dependent_lib ${ALL_DEPENDENT_LIBS})
IF (APPLE)
SET_SOURCE_FILES_PROPERTIES(${dependent_lib} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/bin)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${dependent_lib})
INSTALL(FILES "${dependent_lib}" DESTINATION ${EXE_NAME}.app/Contents/Resources/bin)
ELSE()
INSTALL(FILES "${dependent_lib}" DESTINATION bin)
ENDIF()
ENDFOREACH()
#IF( WIN32 )
# INSTALL(DIRECTORY "${DATA_DIR}/GnuWin32" DESTINATION data PATTERN ".svn" EXCLUDE)
#ENDIF()
FILE(GLOB ALL_DOC_FILES_BASE "${PROJECT_BINARY_DIR}/docs_sources/html/*.*")
FOREACH(docFiles ${ALL_DOC_FILES_BASE})
IF (APPLE)
SET_SOURCE_FILES_PROPERTIES(${docFiles} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/share/doc)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${docFiles})
ELSE()
INSTALL(FILES "${docFiles}" DESTINATION share/doc)
ENDIF()
ENDFOREACH()
set(OS_BUNDLE MACOSX_BUNDLE)
IF( NOT CAPTK_CLI_MODE )
# define the executable
IF(WIN32)
# ensures no console pops up when launching the program
ADD_EXECUTABLE(${EXE_NAME} WIN32
${EXE_SOURCES}
#${YAMLCPP_Headers}
#${YAMLCPP_Sources}
${DATA_DIR}/icons/application/windows/captk.rc
)
ELSEIF(APPLE)
SET (ICON_FILE "${DATA_DIR}/icons/application/apple/CaPTk.icns")
SET_SOURCE_FILES_PROPERTIES(${ICON_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
FOREACH(CAPTK_MACOSX_BUNDLE_FILE ${CAPTK_MACOSX_BUNDLE_FILES_INSTALL_TARGETS})
# MESSAGE(STATUS ${CAPTK_MACOSX_BUNDLE_FILES_INSTALL_TARGETS})
SET_SOURCE_FILES_PROPERTIES(${CAPTK_MACOSX_BUNDLE_FILE} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE PROPERTIES MACOSX_PACKAGE_LOCATION Resources/bin )
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${CAPTK_MACOSX_BUNDLE_FILE})
ENDFOREACH()
FOREACH(FT_META_FILES_TO_INCLUDE ${FEATURE_EXTRACTION_META_FILES_TO_INCLUDE})
IF (${FT_META_FILES_TO_INCLUDE} STREQUAL "${PROJECT_SOURCE_DIR}/src/applications/FeatureExtraction/data/batchMode/batch_featureExtraction.csv")
SET_SOURCE_FILES_PROPERTIES(${FT_META_FILES_TO_INCLUDE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/share/featureExtractionBatch )
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${FT_META_FILES_TO_INCLUDE})
ELSE()
SET_SOURCE_FILES_PROPERTIES(${FT_META_FILES_TO_INCLUDE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/data/features )
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${FT_META_FILES_TO_INCLUDE})
ENDIF()
ENDFOREACH()
IF (NOT ICON_NAME)
SET(ICON_NAME CaPTk)
ENDIF()
# SET_SOURCE_FILES_PROPERTIES(Confetti PROPERTIES MACOSX_PACKAGE_LOCATION Resources/bin)
# SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} Confetti)
# # SET_SOURCE_FILES_PROPERTIES(${ConfettiCore} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/lib)
# # SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${ConfettiCore})
SET_SOURCE_FILES_PROPERTIES("${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiGUI.py" PROPERTIES MACOSX_PACKAGE_LOCATION Resources/bin)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} "${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiGUI.py")
SET_SOURCE_FILES_PROPERTIES("${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiCore.py" PROPERTIES MACOSX_PACKAGE_LOCATION Resources/libexec)
SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} "${INDIVIDUAL_APPLICATIONS_DIR}/confetti_source/pyGUI/ConfettiCore.py")
# FOREACH(application ${STANDALONE_APPS})
# GET_FILENAME_COMPONENT( STANDALONE_APP_NAME ${application} NAME_WE )
# IF( NOT (${STANDALONE_APP_NAME} STREQUAL "ImagingSubtypePredictor" ) )
# SET_SOURCE_FILES_PROPERTIES(${STANDALONE_APP_NAME} PROPERTIES MACOSX_PACKAGE_LOCATION Resources/bin)
# SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} ${STANDALONE_APP_NAME})
# ENDIF()
# ENDFOREACH()
# SET_SOURCE_FILES_PROPERTIES(CaPTk_Utilities PROPERTIES MACOSX_PACKAGE_LOCATION Resources/bin)
# SET(META_FILES_TO_INCLUDE ${META_FILES_TO_INCLUDE} CaPTk_Utilities)
# Identify MacOS bundle
SET(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}_${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
SET(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION})
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
SET(MACOSX_BUNDLE_COPYRIGHT ${COPYRIGHT})
SET(MACOSX_BUNDLE_GUI_IDENTIFIER ${IDENTIFIER})
SET(MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
ADD_EXECUTABLE(${EXE_NAME}
${OS_BUNDLE}
${EXE_SOURCES}
${ICON_FILE}
${META_FILES_TO_INCLUDE}
)
ELSE()
ADD_EXECUTABLE(${EXE_NAME}
${EXE_SOURCES}
#${YAMLCPP_Headers}
#${YAMLCPP_Sources}
)
ENDIF()
TARGET_LINK_LIBRARIES( ${EXE_NAME}
${DEPENDENT_LIBS}
CaPTk_GUI
CaPTk_Common
GeodesicTrainingComputeLib
GeodesicTrainingCaPTkLib
${LIBNAME_Applications}
${LIBNAME_FeatureExtractor}
${LIBNAME_CBICATK}
)
ADD_DEPENDENCIES( ${EXE_NAME}
CaPTk_GUI
CaPTk_Common
${LIBNAME_Applications}
${LIBNAME_FeatureExtractor}
${LIBNAME_CBICATK}
)
# set properties for the executable
# SET_TARGET_PROPERTIES( ${EXE_NAME}
# PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE
# OUTPUT_NAME ${EXE_NAME}
# )
ENDIF()
IF (APPLE)
INSTALL( TARGETS ${EXE_NAME}
BUNDLE DESTINATION .
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
# INSTALL( FILES "${PROJECT_BINARY_DIR}/${EXE_NAME}.app/Contents/MacOS/${EXE_NAME}"
# DESTINATION ${EXE_NAME}.app/Contents/MacOS
# PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
# )
ELSE()
INSTALL( TARGETS ${EXE_NAME}
BUNDLE DESTINATION .
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
CONFIGURATIONS "${CMAKE_CONFIGURATION_TYPES}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
ENDIF()