comparison Resources/CMake/DcmtkConfiguration.cmake @ 2356:7b3b82d426ed

removal of unneeded patch for speed in DCMTK 3.6.2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Jul 2017 12:02:41 +0200
parents 8a5c8af669cb
children ae50eccd41b7
comparison
equal deleted inserted replaced
2355:e2e5dde95027 2356:7b3b82d426ed
15 SET(DCMTK_VERSION_NUMBER 362) 15 SET(DCMTK_VERSION_NUMBER 362)
16 SET(DCMTK_PACKAGE_VERSION "3.6.2") 16 SET(DCMTK_PACKAGE_VERSION "3.6.2")
17 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2) 17 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.2)
18 SET(DCMTK_URL "http://www.orthanc-server.com/downloads/third-party/dcmtk-3.6.2.tar.gz") 18 SET(DCMTK_URL "http://www.orthanc-server.com/downloads/third-party/dcmtk-3.6.2.tar.gz")
19 SET(DCMTK_MD5 "d219a4152772985191c9b89d75302d12") 19 SET(DCMTK_MD5 "d219a4152772985191c9b89d75302d12")
20 SET(DCMTK_PATCH_SPEED "${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-speed.patch")
21 20
22 macro(DCMTK_UNSET) 21 macro(DCMTK_UNSET)
23 endmacro() 22 endmacro()
24 23
25 macro(DCMTK_UNSET_CACHE) 24 macro(DCMTK_UNSET_CACHE)
37 endif() 36 endif()
38 37
39 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") 38 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
40 39
41 40
42 if (FirstRun AND 41 if (FirstRun)
43 USE_DCMTK_360) 42 if (USE_DCMTK_360)
44 # If using DCMTK 3.6.0, backport the "private.dic" file from DCMTK 43 # If using DCMTK 3.6.0, backport the "private.dic" file from DCMTK
45 # 3.6.2. This adds support for more private tags, and fixes some 44 # 3.6.2. This adds support for more private tags, and fixes some
46 # import problems with Philips MRI Achieva. 45 # import problems with Philips MRI Achieva.
47 if (USE_DCMTK_362_PRIVATE_DIC) 46 if (USE_DCMTK_362_PRIVATE_DIC)
48 message("Using the dictionary of private tags from DCMTK 3.6.2") 47 message("Using the dictionary of private tags from DCMTK 3.6.2")
49 configure_file( 48 configure_file(
50 ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-private.dic 49 ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.2-private.dic
51 ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic 50 ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic
52 COPYONLY) 51 COPYONLY)
53 else() 52 else()
54 message("Using the dictionary of private tags from DCMTK 3.6.0") 53 message("Using the dictionary of private tags from DCMTK 3.6.0")
55 endif() 54 endif()
56 55
57 # Patches specific to DCMTK 3.6.0 56 # Patches specific to DCMTK 3.6.0
58 execute_process( 57 message("Applying patch to solve vulnerability in DCMTK 3.6.0")
59 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-dulparse-vulnerability.patch 58 execute_process(
60 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 59 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
61 RESULT_VARIABLE Failure 60 ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-dulparse-vulnerability.patch
62 ) 61 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
63 62 RESULT_VARIABLE Failure
64 if (Failure) 63 )
65 message(FATAL_ERROR "Error while patching a file") 64
66 endif() 65 if (Failure)
67 endif() 66 message(FATAL_ERROR "Error while patching a file")
68 67 endif()
68
69 # This patch is not needed anymore thanks to the following commit
70 # (information sent by Jorg Riesmeier on Twitter on 2017-07-19):
71 # http://git.dcmtk.org/?p=dcmtk.git;a=commit;h=8df1f5e517b8629ae09088d0935c2a8dd333c76f
72 message("Applying patch for speed in DCMTK 3.6.0")
73 execute_process(
74 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
75 ${ORTHANC_ROOT}/Resources/Patches/dcmtk-3.6.0-speed.patch
76 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
77 RESULT_VARIABLE Failure
78 )
79
80 if (Failure)
81 message(FATAL_ERROR "Error while patching a file")
82 endif()
83
84 else (FirstRun())
85 message("No need to apply a patch for speed in DCMTK")
86 endif()
87 else()
88 message("The patches for DCMTK have already been applied")
89 endif()
69 90
70 IF (CMAKE_CROSSCOMPILING) 91 IF (CMAKE_CROSSCOMPILING)
71 if (CMAKE_COMPILER_IS_GNUCXX AND 92 if (CMAKE_COMPILER_IS_GNUCXX AND
72 ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") # MinGW 93 ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") # MinGW
73 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") 94 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
185 list(REMOVE_ITEM DCMTK_SOURCES 206 list(REMOVE_ITEM DCMTK_SOURCES
186 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc 207 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
187 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc 208 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
188 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc 209 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
189 ) 210 )
190
191 execute_process(
192 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${DCMTK_PATCH_SPEED}
193 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
194 RESULT_VARIABLE Failure
195 )
196
197 if (Failure AND FirstRun)
198 message(FATAL_ERROR "Error while patching a file")
199 endif()
200 211
201 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 212 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
202 list(REMOVE_ITEM DCMTK_SOURCES 213 list(REMOVE_ITEM DCMTK_SOURCES
203 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc 214 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
204 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc 215 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc
205 ) 216 )
206 217
207 if (CMAKE_COMPILER_IS_GNUCXX AND DCMTK_PATCH_MINGW64) 218 if (CMAKE_COMPILER_IS_GNUCXX AND
219 DCMTK_PATCH_MINGW64 AND
220 USE_DCMTK_360)
208 # This is a patch for MinGW64 221 # This is a patch for MinGW64
209 execute_process( 222 execute_process(
210 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${DCMTK_PATCH_MINGW64} 223 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${DCMTK_PATCH_MINGW64}
211 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 224 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
212 RESULT_VARIABLE Failure 225 RESULT_VARIABLE Failure
213 ) 226 )
214 227
215 if (Failure AND FirstRun) 228 if (Failure AND FirstRun)
216 message(FATAL_ERROR "Error while patching a file") 229 message(FATAL_ERROR "Error while patching a file")
217 endif() 230 endif()
218 endif()
219
220 # This patch improves speed, even for Windows
221 execute_process(
222 COMMAND ${PATCH_EXECUTABLE} -p0 -N
223 INPUT_FILE ${DCMTK_PATCH_SPEED}
224 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
225 RESULT_VARIABLE Failure
226 )
227
228 if (Failure AND FirstRun)
229 message(FATAL_ERROR "Error while patching a file")
230 endif() 231 endif()
231 endif() 232 endif()
232 233
233 list(REMOVE_ITEM DCMTK_SOURCES 234 list(REMOVE_ITEM DCMTK_SOURCES
234 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc 235 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc