-
Notifications
You must be signed in to change notification settings - Fork 560
/
External_DCMTK.cmake
108 lines (89 loc) · 3.4 KB
/
External_DCMTK.cmake
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
set(proj DCMTK)
# Set dependency list
set(${proj}_DEPENDENCIES "zlib")
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(Slicer_USE_SYSTEM_${proj})
unset(DCMTK_DIR CACHE)
find_package(DCMTK REQUIRED)
endif()
# Sanity checks
if(DEFINED DCMTK_DIR AND NOT EXISTS ${DCMTK_DIR})
message(FATAL_ERROR "DCMTK_DIR variable is defined but corresponds to nonexistent directory")
endif()
if(NOT DEFINED DCMTK_DIR AND NOT Slicer_USE_SYSTEM_${proj})
set(EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS)
if(CTEST_USE_LAUNCHERS)
set(EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
-DCMAKE_PROJECT_DCMTK_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake
)
endif()
if(UNIX)
list(APPEND EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS
-DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON
-DDCMTK_WITH_WRAP:BOOL=OFF # CTK does not build on Mac with this option turned ON due to library dependencies missing
)
endif()
ExternalProject_SetIfNotDefined(
Slicer_${proj}_GIT_REPOSITORY
"${EP_GIT_PROTOCOL}://github.com/commontk/DCMTK.git"
QUIET
)
ExternalProject_SetIfNotDefined(
Slicer_${proj}_GIT_TAG
"ea07125078cd097245867a71d8fba8b36fd92878" # patched-DCMTK-3.6.8_20241024
QUIET
)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj})
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/${proj}-build)
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
GIT_REPOSITORY "${Slicer_${proj}_GIT_REPOSITORY}"
GIT_TAG "${Slicer_${proj}_GIT_TAG}"
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
CMAKE_CACHE_ARGS
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS:STRING=${ep_common_c_flags}
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
-DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
-DBUILD_SHARED_LIBS:BOOL=ON
-DDCMTK_WITH_DOXYGEN:BOOL=OFF
-DDCMTK_WITH_ZLIB:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_OPENSSL:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_PNG:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_TIFF:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_XML:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_ICONV:BOOL=OFF # see CTK github issue #178
-DDCMTK_WITH_SNDFILE:BOOL=OFF # see DCMQI github issue #395
-DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF
-DDCMTK_DEFAULT_DICT:STRING=builtin
-DDCMTK_ENABLE_PRIVATE_TAGS:BOOL=ON
${EXTERNAL_PROJECT_OPTIONAL_CMAKE_CACHE_ARGS}
INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
)
ExternalProject_GenerateProjectDescription_Step(${proj})
set(DCMTK_DIR ${EP_BINARY_DIR})
#-----------------------------------------------------------------------------
# Launcher setting specific to build tree
set(_lib_subdir lib)
if(WIN32)
set(_lib_subdir bin)
endif()
set(${proj}_LIBRARY_PATHS_LAUNCHER_BUILD ${DCMTK_DIR}/${_lib_subdir}/<CMAKE_CFG_INTDIR>)
mark_as_superbuild(
VARS ${proj}_LIBRARY_PATHS_LAUNCHER_BUILD
LABELS "LIBRARY_PATHS_LAUNCHER_BUILD"
)
else()
ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
endif()
mark_as_superbuild(
VARS DCMTK_DIR:PATH
LABELS "FIND_PACKAGE"
)