927
|
1 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR}")
|
|
2
|
|
3 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK)
|
|
4 SET(DCMTK_VERSION_NUMBER 360)
|
|
5 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
|
|
6 DownloadPackage(
|
|
7 "219ad631b82031806147e4abbfba4fa4"
|
|
8 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/dcmtk-3.6.0.zip"
|
|
9 "${DCMTK_SOURCES_DIR}")
|
|
10
|
|
11 IF(CMAKE_CROSSCOMPILING)
|
|
12 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
|
|
13 ENDIF()
|
|
14 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
|
|
15 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake)
|
|
16 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake)
|
|
17
|
|
18 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
|
|
19 set(HAVE_SSTREAM 1)
|
|
20 set(HAVE_PROTOTYPE_BZERO 1)
|
|
21 set(HAVE_PROTOTYPE_GETHOSTNAME 1)
|
|
22 set(HAVE_PROTOTYPE_GETSOCKOPT 1)
|
|
23 set(HAVE_PROTOTYPE_SETSOCKOPT 1)
|
|
24 set(HAVE_PROTOTYPE_CONNECT 1)
|
|
25 set(HAVE_PROTOTYPE_BIND 1)
|
|
26 set(HAVE_PROTOTYPE_ACCEPT 1)
|
|
27 set(HAVE_PROTOTYPE_SETSOCKNAME 1)
|
|
28 set(HAVE_PROTOTYPE_GETSOCKNAME 1)
|
|
29 endif()
|
|
30
|
|
31 CONFIGURE_FILE(
|
|
32 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in
|
|
33 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h)
|
|
34
|
|
35 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES)
|
|
36 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES)
|
|
37 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES)
|
|
38
|
|
39 # Source for the logging facility of DCMTK
|
|
40 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES)
|
|
41 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
|
|
42 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
|
43 list(REMOVE_ITEM DCMTK_SOURCES
|
|
44 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
|
|
45 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
|
|
46 )
|
|
47 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
48 list(REMOVE_ITEM DCMTK_SOURCES
|
|
49 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
|
|
50 )
|
|
51
|
|
52 if (${CMAKE_COMPILER_IS_GNUCXX})
|
|
53 # This is a patch for MinGW64
|
|
54 execute_process(
|
|
55 COMMAND patch -p0 -i ${CMAKE_SOURCE_DIR}/Resources/Patches/dcmtk-mingw64.patch
|
|
56 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
|
57 )
|
|
58 endif()
|
|
59
|
|
60 endif()
|
|
61
|
|
62 list(REMOVE_ITEM DCMTK_SOURCES
|
|
63 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
|
|
64 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
|
|
65 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc
|
|
66 )
|
|
67
|
|
68 # This fixes crashes related to the destruction of the DCMTK OFLogger
|
|
69 # http://support.dcmtk.org/docs-snapshot/file_macros.html
|
|
70 add_definitions(
|
|
71 -DLOG4CPLUS_DISABLE_FATAL=1
|
|
72 -DDCMTK_VERSION_NUMBER=360
|
|
73 )
|
|
74
|
|
75 include_directories(
|
|
76 #${DCMTK_SOURCES_DIR}
|
|
77 ${DCMTK_SOURCES_DIR}/config/include
|
|
78 ${DCMTK_SOURCES_DIR}/dcmnet/include
|
|
79 ${DCMTK_SOURCES_DIR}/ofstd/include
|
|
80 ${DCMTK_SOURCES_DIR}/oflog/include
|
|
81 ${DCMTK_SOURCES_DIR}/dcmdata/include
|
|
82 )
|
|
83
|
|
84 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*)
|
|
85
|
|
86 set(DCMTK_BUNDLES_LOG4CPLUS 1)
|
|
87
|
|
88 if (STANDALONE_BUILD)
|
|
89 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=1)
|
|
90 else()
|
|
91 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0)
|
|
92 endif()
|
|
93
|
|
94 set(DCMTK_DICTIONARIES
|
|
95 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic
|
|
96 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
|
|
97 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic
|
|
98 )
|
|
99
|
|
100 else()
|
|
101 # The following line allows to manually add libraries at the
|
|
102 # command-line, which is necessary for Ubuntu/Debian packages
|
|
103 set(tmp "${DCMTK_LIBRARIES}")
|
|
104 include(FindDCMTK)
|
|
105 list(APPEND DCMTK_LIBRARIES "${tmp}")
|
|
106
|
|
107 include_directories(${DCMTK_INCLUDE_DIR})
|
|
108 link_libraries(${DCMTK_LIBRARIES})
|
|
109
|
|
110 add_definitions(
|
|
111 -DHAVE_CONFIG_H=1
|
|
112 )
|
|
113
|
|
114 if (EXISTS "${DCMTK_DIR}/config/cfunix.h")
|
|
115 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h")
|
|
116 elseif (EXISTS "${DCMTK_DIR}/config/osconfig.h") # This is for Arch Linux
|
|
117 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h")
|
|
118 else()
|
|
119 message(FATAL_ERROR "Please install libdcmtk1-dev")
|
|
120 endif()
|
|
121
|
|
122 # Autodetection of the version of DCMTK
|
|
123 file(STRINGS
|
|
124 "${DCMTK_CONFIGURATION_FILE}"
|
|
125 DCMTK_VERSION_NUMBER1 REGEX
|
|
126 ".*PACKAGE_VERSION .*")
|
|
127
|
|
128 string(REGEX REPLACE
|
|
129 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$"
|
|
130 "\\1\\2\\3"
|
|
131 DCMTK_VERSION_NUMBER
|
|
132 ${DCMTK_VERSION_NUMBER1})
|
|
133
|
|
134 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0)
|
|
135
|
|
136 endif()
|
|
137
|
|
138 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER})
|
|
139 message("DCMTK version: ${DCMTK_VERSION_NUMBER}")
|