Mercurial > hg > orthanc
annotate OrthancFramework/Resources/CMake/DcmtkConfigurationStatic-3.6.6.cmake @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
4470 | 1 # Orthanc - A Lightweight, RESTful DICOM Store |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5434
diff
changeset
|
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
4470 | 7 # |
8 # This program is free software: you can redistribute it and/or | |
9 # modify it under the terms of the GNU Lesser General Public License | |
10 # as published by the Free Software Foundation, either version 3 of | |
11 # the License, or (at your option) any later version. | |
12 # | |
13 # This program is distributed in the hope that it will be useful, but | |
14 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 # Lesser General Public License for more details. | |
17 # | |
18 # You should have received a copy of the GNU Lesser General Public | |
19 # License along with this program. If not, see | |
20 # <http://www.gnu.org/licenses/>. | |
21 | |
22 | |
23 SET(DCMTK_VERSION_NUMBER 366) | |
24 SET(DCMTK_PACKAGE_VERSION "3.6.6") | |
25 SET(DCMTK_SOURCES_DIR ${CMAKE_BINARY_DIR}/dcmtk-3.6.6) | |
5434
aa1c09fa6632
changed location of third-party downloads
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5271
diff
changeset
|
26 SET(DCMTK_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/dcmtk-3.6.6.tar.gz") |
4470 | 27 SET(DCMTK_MD5 "f815879d315b916366a9da71339c7575") |
28 | |
29 macro(DCMTK_UNSET) | |
30 endmacro() | |
31 | |
32 macro(DCMTK_UNSET_CACHE) | |
33 endmacro() | |
34 | |
35 set(DCMTK_BINARY_DIR ${DCMTK_SOURCES_DIR}/) | |
36 set(DCMTK_CMAKE_INCLUDE ${DCMTK_SOURCES_DIR}/) | |
37 | |
38 if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") | |
39 set(DCMTK_WITH_THREADS OFF) # Disable thread support in wasm/asm.js | |
40 else() | |
41 set(DCMTK_WITH_THREADS ON) | |
42 endif() | |
43 | |
44 add_definitions(-DDCMTK_INSIDE_LOG4CPLUS=1) | |
45 | |
46 if (IS_DIRECTORY "${DCMTK_SOURCES_DIR}") | |
47 set(FirstRun OFF) | |
48 else() | |
49 set(FirstRun ON) | |
50 endif() | |
51 | |
52 DownloadPackage(${DCMTK_MD5} ${DCMTK_URL} "${DCMTK_SOURCES_DIR}") | |
53 | |
54 | |
55 if (FirstRun) | |
56 # Apply the patches | |
57 execute_process( | |
58 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i | |
59 ${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-3.6.6.patch | |
60 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
61 RESULT_VARIABLE Failure | |
62 ) | |
63 | |
64 if (Failure) | |
65 message(FATAL_ERROR "Error while patching a file") | |
66 endif() | |
67 | |
68 configure_file( | |
69 ${CMAKE_CURRENT_LIST_DIR}/../Patches/dcmtk-dcdict_orthanc.cc | |
70 ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/dcdict_orthanc.cc | |
71 COPYONLY) | |
72 else() | |
73 message("The patches for DCMTK have already been applied") | |
74 endif() | |
75 | |
76 | |
77 include_directories( | |
78 ${DCMTK_SOURCES_DIR}/dcmiod/include | |
79 ) | |
80 | |
81 | |
82 # C_CHAR_UNSIGNED *must* be set before calling "GenerateDCMTKConfigure.cmake" | |
83 IF (CMAKE_CROSSCOMPILING) | |
84 if (CMAKE_COMPILER_IS_GNUCXX AND | |
85 CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW | |
86 SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") | |
87 | |
88 elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js | |
89 | |
90 # Check out "../WebAssembly/ArithmeticTests/" to regenerate the | |
91 # "arith.h" file | |
92 configure_file( | |
93 ${CMAKE_CURRENT_LIST_DIR}/WebAssembly/arith.h | |
94 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h | |
95 COPYONLY) | |
96 | |
97 UNSET(C_CHAR_UNSIGNED CACHE) | |
98 SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") | |
99 | |
100 else() | |
101 message(FATAL_ERROR "Support your platform here") | |
102 endif() | |
103 ENDIF() | |
104 | |
105 | |
106 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") | |
107 SET(DCMTK_ENABLE_CHARSET_CONVERSION "iconv" CACHE STRING "") | |
108 SET(HAVE_SYS_GETTID 0 CACHE INTERNAL "") | |
109 endif() | |
110 | |
111 | |
112 SET(DCMTK_SOURCE_DIR ${DCMTK_SOURCES_DIR}) | |
113 include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) | |
114 include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) | |
115 | |
116 | |
117 if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or | |
118 # asm.js The macros below are not properly discovered by DCMTK | |
119 # when using WebAssembly. Check out "../WebAssembly/arith.h" for | |
120 # how we produced these values. This step MUST be after | |
121 # "GenerateDCMTKConfigure" and before the generation of | |
122 # "osconfig.h". | |
123 UNSET(SIZEOF_VOID_P CACHE) | |
124 UNSET(SIZEOF_CHAR CACHE) | |
125 UNSET(SIZEOF_DOUBLE CACHE) | |
126 UNSET(SIZEOF_FLOAT CACHE) | |
127 UNSET(SIZEOF_INT CACHE) | |
128 UNSET(SIZEOF_LONG CACHE) | |
129 UNSET(SIZEOF_SHORT CACHE) | |
130 UNSET(SIZEOF_VOID_P CACHE) | |
131 | |
132 SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") | |
133 SET(SIZEOF_CHAR 1 CACHE INTERNAL "") | |
134 SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") | |
135 SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") | |
136 SET(SIZEOF_INT 4 CACHE INTERNAL "") | |
137 SET(SIZEOF_LONG 4 CACHE INTERNAL "") | |
138 SET(SIZEOF_SHORT 2 CACHE INTERNAL "") | |
139 SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") | |
140 endif() | |
141 | |
142 | |
143 set(DCMTK_PACKAGE_VERSION_SUFFIX "") | |
144 set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) | |
145 | |
146 CONFIGURE_FILE( | |
147 ${DCMTK_SOURCES_DIR}/CMake/osconfig.h.in | |
148 ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/osconfig.h) | |
149 | |
150 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
151 link_libraries(netapi32) # For NetWkstaUserGetInfo@12 | |
152 link_libraries(iphlpapi) # For GetAdaptersInfo@8 | |
153 | |
154 # Configure Wine if cross-compiling for Windows | |
155 if (CMAKE_COMPILER_IS_GNUCXX) | |
156 include(${DCMTK_SOURCES_DIR}/CMake/dcmtkUseWine.cmake) | |
157 FIND_PROGRAM(WINE_WINE_PROGRAM wine) | |
158 FIND_PROGRAM(WINE_WINEPATH_PROGRAM winepath) | |
159 list(APPEND DCMTK_TRY_COMPILE_REQUIRED_CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=-static") | |
160 endif() | |
161 endif() | |
162 | |
163 # This step must be after the generation of "osconfig.h" | |
164 if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") | |
165 INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES() | |
166 endif() | |
167 | |
168 | |
169 # Source for the logging facility of DCMTK | |
170 AUX_SOURCE_DIRECTORY(${DCMTK_SOURCES_DIR}/oflog/libsrc DCMTK_SOURCES) | |
171 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | |
172 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR | |
173 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR | |
174 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR | |
175 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR | |
176 ${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten") | |
177 list(REMOVE_ITEM DCMTK_SOURCES | |
178 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc | |
179 ${DCMTK_SOURCES_DIR}/oflog/libsrc/windebap.cc | |
180 ${DCMTK_SOURCES_DIR}/oflog/libsrc/winsock.cc | |
181 ) | |
182 | |
183 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
184 list(REMOVE_ITEM DCMTK_SOURCES | |
185 ${DCMTK_SOURCES_DIR}/oflog/libsrc/unixsock.cc | |
186 ${DCMTK_SOURCES_DIR}/oflog/libsrc/clfsap.cc | |
187 ) | |
188 endif() | |
189 | |
190 | |
191 # Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by | |
192 # default since this does not seem to be appropriate (anymore) for | |
193 # most modern operating systems. In order to change this default, the | |
194 # environment variable NO_TCPDELAY can be set to "1" (see envvars.txt | |
195 # for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can | |
196 # be defined to change this setting at compilation time (see | |
197 # macros.txt for details). | |
198 # https://forum.dcmtk.org/viewtopic.php?t=4632 | |
199 add_definitions( | |
200 -DDISABLE_NAGLE_ALGORITHM=1 | |
201 ) | |
202 | |
203 | |
204 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
205 # For compatibility with Windows XP, avoid using fiber-local-storage | |
206 # in log4cplus, but use thread-local-storage instead. Otherwise, | |
207 # Windows XP complains about missing "FlsGetValue()" in KERNEL32.dll | |
208 add_definitions( | |
209 -DDCMTK_LOG4CPLUS_AVOID_WIN32_FLS | |
210 ) | |
211 | |
212 if (CMAKE_COMPILER_IS_GNUCXX OR # MinGW | |
213 "${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") # MSVC for 32bit (*) | |
214 | |
215 # (*) With multithreaded logging enabled, Visual Studio 2008 fails | |
216 # with error: ".\dcmtk-3.6.6\oflog\libsrc\globinit.cc(422) : error | |
217 # C2664: 'dcmtk::log4cplus::thread::impl::tls_init' : cannot | |
218 # convert parameter 1 from 'void (__stdcall *)(void *)' to | |
219 # 'dcmtk::log4cplus::thread::impl::tls_init_cleanup_func_type'" | |
220 # None of the functions with this name in scope match the target type | |
221 | |
222 add_definitions( | |
223 -DDCMTK_LOG4CPLUS_SINGLE_THREADED | |
224 ) | |
225 endif() | |
226 endif() |