Mercurial > hg > orthanc
annotate Resources/CMake/DcmtkConfiguration.cmake @ 1633:b7dfb048b2f3 dcmtk-3.6.1
setup
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Sep 2015 09:55:23 +0200 |
parents | 17a3814fd8a1 |
children | 0844a4bcb0ad |
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) | |
1633 | 17 SET(DCMTK_VERSION_NUMBER 361) |
18 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.1_20150629) | |
19 SET(DCMTK_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/dcmtk-3.6.1_20150629.tar.gz") | |
20 SET(DCMTK_MD5 "2faf73786fc638ae05fef0103cce0eea") | |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
21 |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
22 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
23 set(FirstRun OFF) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
24 else() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
25 set(FirstRun ON) |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
26 endif() |
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
27 |
1633 | 28 # Definitions for DCMTK 3.6.1 |
29 macro(DCMTK_UNSET) | |
30 endmacro() | |
31 | |
32 set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/) | |
33 # End | |
34 | |
35 | |
1537
fbf763bb1fa3
error detection in patches
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1415
diff
changeset
|
36 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") |
929 | 37 |
1414 | 38 IF (CMAKE_CROSSCOMPILING) |
929 | 39 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") |
40 ENDIF() | |
1633 | 41 SET(DCMTK_SOURCE_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.1) |
929 | 42 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) |
43 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) | |
44 | |
45 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | |
46 set(HAVE_SSTREAM 1) | |
47 set(HAVE_PROTOTYPE_BZERO 1) | |
48 set(HAVE_PROTOTYPE_GETHOSTNAME 1) | |
49 set(HAVE_PROTOTYPE_GETSOCKOPT 1) | |
50 set(HAVE_PROTOTYPE_SETSOCKOPT 1) | |
51 set(HAVE_PROTOTYPE_CONNECT 1) | |
52 set(HAVE_PROTOTYPE_BIND 1) | |
53 set(HAVE_PROTOTYPE_ACCEPT 1) | |
54 set(HAVE_PROTOTYPE_SETSOCKNAME 1) | |
55 set(HAVE_PROTOTYPE_GETSOCKNAME 1) | |
56 endif() | |
57 | |
1633 | 58 set(DCMTK_PACKAGE_VERSION "3.6.1") |
1149
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
59 set(DCMTK_PACKAGE_VERSION_SUFFIX "") |
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
60 set(DCMTK_PACKAGE_VERSION_NUMBER 360) |
dd6d7fd82da9
fix version of dcmtk
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1057
diff
changeset
|
61 |
929 | 62 CONFIGURE_FILE( |
63 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in | |
64 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) | |
65 | |
66 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES) | |
67 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES) | |
68 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES) | |
69 | |
70 | |
71 if (ENABLE_JPEG) | |
72 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES) | |
73 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES) | |
74 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES) | |
75 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES) | |
76 include_directories( | |
77 ${DCMTK_SOURCES_DIR}/dcmjpeg/include | |
78 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 | |
79 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 | |
80 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 | |
81 ${DCMTK_SOURCES_DIR}/dcmimgle/include | |
82 ) | |
83 list(REMOVE_ITEM DCMTK_SOURCES | |
84 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc | |
85 ) | |
86 endif() | |
87 | |
88 | |
89 if (ENABLE_JPEG_LOSSLESS) | |
90 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES) | |
91 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES) | |
92 include_directories( | |
93 ${DCMTK_SOURCES_DIR}/dcmjpeg/include | |
94 ${DCMTK_SOURCES_DIR}/dcmjpls/include | |
95 ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls | |
96 ) | |
97 list(REMOVE_ITEM DCMTK_SOURCES | |
98 ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc | |
99 ) | |
100 list(APPEND DCMTK_SOURCES | |
101 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc | |
102 ) | |
103 endif() | |
104 | |
105 | |
106 # Source for the logging facility of DCMTK | |
107 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) | |
108 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | |
930 | 109 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR |
1337 | 110 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR |
929 | 111 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") |
112 list(REMOVE_ITEM DCMTK_SOURCES | |
113 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc | |
114 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc | |
115 ) | |
1361
94ffb597d297
refactoring of C-Find SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1337
diff
changeset
|
116 |
929 | 117 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") |
118 list(REMOVE_ITEM DCMTK_SOURCES | |
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 |
1633 | 131 # "PACKAGE_VERSION=\"3.6.1\";PACKAGE_VERSION_NUMBER=\"360\"") |
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 | |
137 -DDCMTK_VERSION_NUMBER=360 | |
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) | |
154 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=1) | |
155 else() | |
156 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0) | |
157 endif() | |
158 | |
159 set(DCMTK_DICTIONARIES | |
160 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic | |
161 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic | |
162 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic | |
163 ) | |
164 | |
165 else() | |
166 # The following line allows to manually add libraries at the | |
167 # command-line, which is necessary for Ubuntu/Debian packages | |
168 set(tmp "${DCMTK_LIBRARIES}") | |
169 include(FindDCMTK) | |
170 list(APPEND DCMTK_LIBRARIES "${tmp}") | |
171 | |
172 include_directories(${DCMTK_INCLUDE_DIR}) | |
173 | |
174 add_definitions( | |
175 -DHAVE_CONFIG_H=1 | |
176 ) | |
177 | |
178 if (EXISTS "${DCMTK_DIR}/config/cfunix.h") | |
179 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h") | |
180 elseif (EXISTS "${DCMTK_DIR}/config/osconfig.h") # This is for Arch Linux | |
181 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h") | |
182 else() | |
183 message(FATAL_ERROR "Please install libdcmtk1-dev") | |
184 endif() | |
185 | |
186 # Autodetection of the version of DCMTK | |
187 file(STRINGS | |
188 "${DCMTK_CONFIGURATION_FILE}" | |
189 DCMTK_VERSION_NUMBER1 REGEX | |
190 ".*PACKAGE_VERSION .*") | |
191 | |
192 string(REGEX REPLACE | |
193 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$" | |
194 "\\1\\2\\3" | |
195 DCMTK_VERSION_NUMBER | |
196 ${DCMTK_VERSION_NUMBER1}) | |
197 | |
198 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0) | |
199 | |
200 endif() | |
201 | |
202 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}) | |
203 message("DCMTK version: ${DCMTK_VERSION_NUMBER}") |