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