Mercurial > hg > orthanc
annotate Resources/CMake/DcmtkConfiguration.cmake @ 1072:1dffa9f44a94
conformance
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 Jul 2014 13:31:35 +0200 |
parents | 3a26bc6e4867 |
children | dd6d7fd82da9 |
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 | |
43 CONFIGURE_FILE( | |
44 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in | |
45 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) | |
46 | |
47 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmnet/libsrc DCMTK_SOURCES) | |
48 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmdata/libsrc DCMTK_SOURCES) | |
49 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/ofstd/libsrc DCMTK_SOURCES) | |
50 | |
51 | |
52 if (ENABLE_JPEG) | |
53 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc DCMTK_SOURCES) | |
54 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 DCMTK_SOURCES) | |
55 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 DCMTK_SOURCES) | |
56 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 DCMTK_SOURCES) | |
57 include_directories( | |
58 ${DCMTK_SOURCES_DIR}/dcmjpeg/include | |
59 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg8 | |
60 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg12 | |
61 ${DCMTK_SOURCES_DIR}/dcmjpeg/libijg16 | |
62 ${DCMTK_SOURCES_DIR}/dcmimgle/include | |
63 ) | |
64 list(REMOVE_ITEM DCMTK_SOURCES | |
65 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/ddpiimpl.cc | |
66 ) | |
67 endif() | |
68 | |
69 | |
70 if (ENABLE_JPEG_LOSSLESS) | |
71 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libsrc DCMTK_SOURCES) | |
72 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/dcmjpls/libcharls DCMTK_SOURCES) | |
73 include_directories( | |
74 ${DCMTK_SOURCES_DIR}/dcmjpeg/include | |
75 ${DCMTK_SOURCES_DIR}/dcmjpls/include | |
76 ${DCMTK_SOURCES_DIR}/dcmjpls/libcharls | |
77 ) | |
78 list(REMOVE_ITEM DCMTK_SOURCES | |
79 ${DCMTK_SOURCES_DIR}/dcmjpls/libsrc/djcodece.cc | |
80 ) | |
81 list(APPEND DCMTK_SOURCES | |
82 ${DCMTK_SOURCES_DIR}/dcmjpeg/libsrc/djrplol.cc | |
83 ) | |
84 endif() | |
85 | |
86 | |
87 # Source for the logging facility of DCMTK | |
88 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) | |
89 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | |
930 | 90 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR |
929 | 91 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") |
92 list(REMOVE_ITEM DCMTK_SOURCES | |
93 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc | |
94 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc | |
95 ) | |
96 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
97 list(REMOVE_ITEM DCMTK_SOURCES | |
98 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc | |
99 ) | |
100 | |
101 if (${CMAKE_COMPILER_IS_GNUCXX}) | |
102 # This is a patch for MinGW64 | |
103 execute_process( | |
1057
3a26bc6e4867
more generic paths in CMake
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
930
diff
changeset
|
104 COMMAND patch -p0 -i ${ORTHANC_ROOT}/Resources/Patches/dcmtk-mingw64.patch |
929 | 105 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} |
106 ) | |
107 endif() | |
108 | |
109 endif() | |
110 | |
111 list(REMOVE_ITEM DCMTK_SOURCES | |
112 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc | |
113 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc | |
114 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdictbi.cc | |
115 ) | |
116 | |
117 # This fixes crashes related to the destruction of the DCMTK OFLogger | |
118 # http://support.dcmtk.org/docs-snapshot/file_macros.html | |
119 add_definitions( | |
120 -DLOG4CPLUS_DISABLE_FATAL=1 | |
121 -DDCMTK_VERSION_NUMBER=360 | |
122 ) | |
123 | |
124 include_directories( | |
125 #${DCMTK_SOURCES_DIR} | |
126 ${DCMTK_SOURCES_DIR}/config/include | |
127 ${DCMTK_SOURCES_DIR}/dcmnet/include | |
128 ${DCMTK_SOURCES_DIR}/ofstd/include | |
129 ${DCMTK_SOURCES_DIR}/oflog/include | |
130 ${DCMTK_SOURCES_DIR}/dcmdata/include | |
131 ) | |
132 | |
133 source_group(ThirdParty\\Dcmtk REGULAR_EXPRESSION ${DCMTK_SOURCES_DIR}/.*) | |
134 | |
135 set(DCMTK_BUNDLES_LOG4CPLUS 1) | |
136 | |
137 if (STANDALONE_BUILD) | |
138 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=1) | |
139 else() | |
140 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0) | |
141 endif() | |
142 | |
143 set(DCMTK_DICTIONARIES | |
144 DICTIONARY_DICOM ${DCMTK_SOURCES_DIR}/dcmdata/data/dicom.dic | |
145 DICTIONARY_PRIVATE ${DCMTK_SOURCES_DIR}/dcmdata/data/private.dic | |
146 DICTIONARY_DICONDE ${DCMTK_SOURCES_DIR}/dcmdata/data/diconde.dic | |
147 ) | |
148 | |
149 else() | |
150 # The following line allows to manually add libraries at the | |
151 # command-line, which is necessary for Ubuntu/Debian packages | |
152 set(tmp "${DCMTK_LIBRARIES}") | |
153 include(FindDCMTK) | |
154 list(APPEND DCMTK_LIBRARIES "${tmp}") | |
155 | |
156 include_directories(${DCMTK_INCLUDE_DIR}) | |
157 link_libraries(${DCMTK_LIBRARIES}) | |
158 | |
159 add_definitions( | |
160 -DHAVE_CONFIG_H=1 | |
161 ) | |
162 | |
163 if (EXISTS "${DCMTK_DIR}/config/cfunix.h") | |
164 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/cfunix.h") | |
165 elseif (EXISTS "${DCMTK_DIR}/config/osconfig.h") # This is for Arch Linux | |
166 set(DCMTK_CONFIGURATION_FILE "${DCMTK_DIR}/config/osconfig.h") | |
167 else() | |
168 message(FATAL_ERROR "Please install libdcmtk1-dev") | |
169 endif() | |
170 | |
171 # Autodetection of the version of DCMTK | |
172 file(STRINGS | |
173 "${DCMTK_CONFIGURATION_FILE}" | |
174 DCMTK_VERSION_NUMBER1 REGEX | |
175 ".*PACKAGE_VERSION .*") | |
176 | |
177 string(REGEX REPLACE | |
178 ".*PACKAGE_VERSION.*\"([0-9]*)\\.([0-9]*)\\.([0-9]*)\"$" | |
179 "\\1\\2\\3" | |
180 DCMTK_VERSION_NUMBER | |
181 ${DCMTK_VERSION_NUMBER1}) | |
182 | |
183 add_definitions(-DDCMTK_USE_EMBEDDED_DICTIONARIES=0) | |
184 | |
185 endif() | |
186 | |
187 add_definitions(-DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}) | |
188 message("DCMTK version: ${DCMTK_VERSION_NUMBER}") |