Mercurial > hg > orthanc
annotate Resources/CMake/DcmtkConfiguration.cmake @ 1785:c131566b8252 dcmtk-3.6.1
integration mainline->dcmtk-3.6.1
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 18 Nov 2015 10:16:21 +0100 |
parents | 1b82bb0446d2 6473e4e22d44 |
children | 4f2386d0f326 |
rev | line source |
---|---|
929 | 1 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK) |
1633 | 2 SET(DCMTK_VERSION_NUMBER 361) |
1635 | 3 set(DCMTK_PACKAGE_VERSION "3.6.1") |
1633 | 4 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.1_20150629) |
1638 | 5 SET(DCMTK_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/dcmtk-3.6.1_20150629.tar.gz") |
1639 | 6 SET(DCMTK_MD5 "2faf73786fc638ae05fef0103cce0eea") |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
7 |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
8 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
9 set(FirstRun OFF) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
10 else() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
11 set(FirstRun ON) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
12 endif() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
13 |
1633 | 14 # Definitions for DCMTK 3.6.1 |
15 macro(DCMTK_UNSET) | |
16 endmacro() | |
17 | |
18 set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/) | |
1638 | 19 add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1) |
1633 | 20 # End |
21 | |
22 | |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
23 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") |
929 | 24 |
1414 | 25 IF (CMAKE_CROSSCOMPILING) |
929 | 26 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") |
27 ENDIF() | |
1634 | 28 SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR}) |
929 | 29 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) |
30 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) | |
31 | |
32 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | |
33 set(HAVE_SSTREAM 1) | |
34 set(HAVE_PROTOTYPE_BZERO 1) | |
35 set(HAVE_PROTOTYPE_GETHOSTNAME 1) | |
36 set(HAVE_PROTOTYPE_GETSOCKOPT 1) | |
37 set(HAVE_PROTOTYPE_SETSOCKOPT 1) | |
38 set(HAVE_PROTOTYPE_CONNECT 1) | |
39 set(HAVE_PROTOTYPE_BIND 1) | |
40 set(HAVE_PROTOTYPE_ACCEPT 1) | |
41 set(HAVE_PROTOTYPE_SETSOCKNAME 1) | |
42 set(HAVE_PROTOTYPE_GETSOCKNAME 1) | |
43 endif() | |
44 | |
1149
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
45 set(DCMTK_PACKAGE_VERSION_SUFFIX "") |
1634 | 46 set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) |
1149
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
47 |
929 | 48 CONFIGURE_FILE( |
49 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in | |
50 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) | |
51 | |
1638 | 52 |
53 execute_process( | |
54 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-speed.patch | |
55 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
56 RESULT_VARIABLE Failure | |
57 ) | |
58 | |
59 if (Failure AND FirstRun) | |
60 message(FATAL_ERROR "Error while patching a file") | |
61 endif() | |
62 | |
63 | |
929 | 64 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES) |
65 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES) | |
66 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES) | |
67 | |
68 | |
69 if (ENABLE_JPEG) | |
70 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES) | |
71 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES) | |
72 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES) | |
73 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES) | |
74 include_directories( | |
75 ${DCMTK_SOURCES_DIR}/dcmjpeg/include | |
76 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 | |
77 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 | |
78 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 | |
79 ${DCMTK_SOURCES_DIR}/dcmimgle/include | |
80 ) | |
81 list(REMOVE_ITEM DCMTK_SOURCES | |
82 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc | |
83 ) | |
84 endif() | |
85 | |
86 | |
87 if (ENABLE_JPEG_LOSSLESS) | |
88 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES) | |
89 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES) | |
90 include_directories( | |
91 ${DCMTK_SOURCES_DIR}/dcmjpeg/include | |
92 ${DCMTK_SOURCES_DIR}/dcmjpls/include | |
93 ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls | |
94 ) | |
95 list(REMOVE_ITEM DCMTK_SOURCES | |
96 ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc | |
97 ) | |
98 list(APPEND DCMTK_SOURCES | |
99 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc | |
100 ) | |
101 endif() | |
102 | |
103 | |
104 # Source for the logging facility of DCMTK | |
105 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) | |
106 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | |
930 | 107 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR |
1337 | 108 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR |
929 | 109 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") |
110 list(REMOVE_ITEM DCMTK_SOURCES | |
1638 | 111 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc |
929 | 112 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc |
113 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc | |
114 ) | |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1337
diff
changeset
|
115 |
929 | 116 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
117 list(REMOVE_ITEM DCMTK_SOURCES | |
1638 | 118 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc |
929 | 119 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc |
120 ) | |
121 endif() | |
122 | |
123 list(REMOVE_ITEM DCMTK_SOURCES | |
124 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc | |
125 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc | |
126 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc | |
127 ) | |
128 | |
1149
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
129 #set_source_files_properties(${DCMTK_SOURCES} |
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
130 # PROPERTIES COMPILE_DEFINITIONS |
1636 | 131 # "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"") |
1149
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
132 |
929 | 133 # This fixes crashes related to the destruction of the DCMTK OFLogger |
134 # http://support.dcmtk.org/docs-snapshot/file_macros.html | |
135 add_definitions( | |
136 -DLOG4CPLUS_DISABLE_FATAL=1 | |
1634 | 137 -DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER} |
929 | 138 ) |
139 | |
140 include_directories( | |
141 #${DCMTK_SOURCES_DIR} | |
142 ${DCMTK_SOURCES_DIR}/config/include | |
143 ${DCMTK_SOURCES_DIR}/dcmnet/include | |
144 ${DCMTK_SOURCES_DIR}/ofstd/include | |
145 ${DCMTK_SOURCES_DIR}/oflog/include | |
146 ${DCMTK_SOURCES_DIR}/dcmdata/include | |
147 ) | |
148 | |
149 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*) | |
150 | |
151 set(DCMTK_BUNDLES_LOG4CPLUS 1) | |
152 | |
153 if (STANDALONE_BUILD) | |
1770 | 154 set(DCMTK_USE_EMBEDDED_DICTIONARIES 1) |
155 set(DCMTK_DICTIONARIES | |
156 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic | |
157 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic | |
158 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic | |
159 ) | |
929 | 160 else() |
1770 | 161 set(DCMTK_USE_EMBEDDED_DICTIONARIES 0) |
929 | 162 endif() |
163 | |
164 else() | |
165 # The following line allows to manually add libraries at the | |
166 # command-line, which is necessary for Ubuntu/Debian packages | |
167 set(tmp "${DCMTK_LIBRARIES}") | |
168 include(FindDCMTK) | |
169 list(APPEND DCMTK_LIBRARIES "${tmp}") | |
170 | |
171 include_directories(${DCMTK_INCLUDE_DIR}) | |
172 | |
173 add_definitions( | |
174 -DHAVE_CONFIG_H=1 | |
175 ) | |
176 | |
177 if (EXISTS "${DCMTK_DIR}/config/cfunix.h") | |
178 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h") | |
179 elseif (EXISTS "${DCMTK_DIR}/config/osconfig.h") # This is for Arch Linux | |
180 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h") | |
181 else() | |
182 message(FATAL_ERROR "Please install libdcmtk1-dev") | |
183 endif() | |
184 | |
185 # Autodetection of the version of DCMTK | |
186 file(STRINGS | |
187 "${DCMTK_CONFIGURATION_FILE}" | |
188 DCMTK_VERSION_NUMBER1 REGEX | |
189 ".*PACKAGE_VERSION .*") | |
190 | |
191 string(REGEX REPLACE | |
192 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$" | |
193 "\\1\\2\\3" | |
194 DCMTK_VERSION_NUMBER | |
195 ${DCMTK_VERSION_NUMBER1}) | |
196 | |
1770 | 197 set(DCMTK_USE_EMBEDDED_DICTIONARIES 0) |
198 endif() | |
929 | 199 |
200 | |
201 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}) | |
202 message("DCMTK version: ${DCMTK_VERSION_NUMBER}") | |
1770 | 203 |
204 | |
205 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=${DCMTK_USE_EMBEDDED_DICTIONARIES}) | |
206 if (NOT DCMTK_USE_EMBEDDED_DICTIONARIES) | |
207 # Lookup for DICOM dictionaries, if none is specified by the user | |
208 if (DCMTK_DICTIONARY_DIR STREQUAL "") | |
209 find_path(DCMTK_DICTIONARY_DIR_AUTO dicom.dic | |
210 /usr/share/dcmtk | |
211 /usr/share/libdcmtk2 | |
212 /usr/share/libdcmtk4 | |
213 /usr/local/share/dcmtk | |
214 ) | |
215 | |
216 if (${DCMTK_DICTIONARY_DIR_AUTO} MATCHES "DCMTK_DICTIONARY_DIR_AUTO-NOTFOUND") | |
217 message(FATAL_ERROR "Cannot locate the DICOM dictionary on this system") | |
218 endif() | |
219 | |
220 message("Autodetected path to the DICOM dictionaries: ${DCMTK_DICTIONARY_DIR_AUTO}") | |
221 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR_AUTO}") | |
222 else() | |
223 add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR}") | |
224 endif() | |
225 endif() |