comparison Resources/CMake/DcmtkConfiguration.cmake @ 1537:fbf763bb1fa3

error detection in patches
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Aug 2015 15:25:38 +0200
parents 728c22ade2e2
children 17a3814fd8a1
comparison
equal deleted inserted replaced
1536:1b03676d68c2 1537:fbf763bb1fa3
14 14
15 15
16 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK) 16 if (STATIC_BUILD OR NOT USE_SYSTEM_DCMTK)
17 SET(DCMTK_VERSION_NUMBER 360) 17 SET(DCMTK_VERSION_NUMBER 360)
18 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) 18 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
19 DownloadPackage( 19 SET(DCMTK_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/dcmtk-3.6.0.zip")
20 "219ad631b82031806147e4abbfba4fa4" 20 SET(DCMTK_MD5 "219ad631b82031806147e4abbfba4fa4")
21 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/dcmtk-3.6.0.zip" 21
22 "${DCMTK_SOURCES_DIR}") 22 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}")
23 set(FirstRun OFF)
24 else()
25 set(FirstRun ON)
26 endif()
27
28 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}")
23 29
24 IF (CMAKE_CROSSCOMPILING) 30 IF (CMAKE_CROSSCOMPILING)
25 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") 31 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.")
26 ENDIF() 32 ENDIF()
27 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0) 33 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.0)
99 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc 105 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc
100 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc 106 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc
101 ) 107 )
102 108
103 execute_process( 109 execute_process(
104 COMMAND patch -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-linux-speed.patch 110 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-linux-speed.patch
105 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 111 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
106 ) 112 RESULT_VARIABLE Failure
113 )
114
115 if (Failure AND FirstRun)
116 message(FATAL_ERROR "Error while patching a file")
117 endif()
107 118
108 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 119 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
109 list(REMOVE_ITEM DCMTK_SOURCES 120 list(REMOVE_ITEM DCMTK_SOURCES
110 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc 121 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc
111 ) 122 )
112 123
113 if (CMAKE_COMPILER_IS_GNUCXX) 124 if (CMAKE_COMPILER_IS_GNUCXX)
114 # This is a patch for MinGW64 125 # This is a patch for MinGW64
115 execute_process( 126 execute_process(
116 COMMAND patch -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-mingw64.patch 127 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-mingw64.patch
117 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 128 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
129 RESULT_VARIABLE Failure
118 ) 130 )
131
132 if (Failure AND FirstRun)
133 message(FATAL_ERROR "Error while patching a file")
134 endif()
119 endif() 135 endif()
120 136
121 # This patch improves speed, even for Windows 137 # This patch improves speed, even for Windows
122 execute_process( 138 execute_process(
123 COMMAND patch -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-linux-speed.patch 139 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-linux-speed.patch
124 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 140 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
125 ) 141 RESULT_VARIABLE Failure
126 142 )
143
144 if (Failure AND FirstRun)
145 message(FATAL_ERROR "Error while patching a file")
146 endif()
127 endif() 147 endif()
128 148
129 list(REMOVE_ITEM DCMTK_SOURCES 149 list(REMOVE_ITEM DCMTK_SOURCES
130 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc 150 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
131 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc 151 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc