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