comparison Applications/CMakeLists.txt @ 140:a0f9a3df1110

resort to Orthanc framework
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 17 Apr 2018 15:47:47 +0200
parents 4f3945a2b725
children c9271bb5ef94
comparison
equal deleted inserted replaced
139:f2f58f288172 140:a0f9a3df1110
1 cmake_minimum_required(VERSION 2.8) 1 cmake_minimum_required(VERSION 2.8)
2 project(OrthancWSIApplications) 2 project(OrthancWSIApplications)
3
4 include(${CMAKE_SOURCE_DIR}/../Resources/CMake/Version.cmake)
3 5
4 6
5 ##################################################################### 7 #####################################################################
6 ## Parameters of the build 8 ## Parameters of the build
7 ##################################################################### 9 #####################################################################
9 # Generic parameters 11 # Generic parameters
10 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") 12 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
11 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") 13 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages")
12 SET(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof") 14 SET(ENABLE_PROFILING OFF CACHE BOOL "Whether to enable the generation of profiling information with gprof")
13 15
14 # Optional components
15 SET(ENABLE_SSL ON CACHE BOOL "Include support for SSL")
16 SET(USE_DCMTK_361 OFF CACHE BOOL "Use forthcoming DCMTK version 3.6.1 in static builds (instead of 3.6.0)")
17
18 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
19 set(TMP ON)
20 else()
21 set(TMP OFF)
22 endif()
23
24
25 # Advanced parameters to fine-tune linking against system libraries 16 # Advanced parameters to fine-tune linking against system libraries
26 SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
27 SET(USE_SYSTEM_CURL ON CACHE BOOL "Use the system version of LibCurl")
28 SET(USE_SYSTEM_DCMTK ON CACHE BOOL "Use the system version of DCMTK")
29 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
30 SET(USE_SYSTEM_LIBICONV ON CACHE BOOL "Use the system version of libiconv")
31 SET(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg")
32 SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng")
33 SET(USE_SYSTEM_LIBTIFF ON CACHE BOOL "Use the system version of libtiff") 17 SET(USE_SYSTEM_LIBTIFF ON CACHE BOOL "Use the system version of libtiff")
34 SET(USE_SYSTEM_OPENJPEG ON CACHE BOOL "Use the system version of OpenJpeg") 18 SET(USE_SYSTEM_OPENJPEG ON CACHE BOOL "Use the system version of OpenJpeg")
35 SET(USE_SYSTEM_OPENSSL ON CACHE BOOL "Use the system version of OpenSSL")
36 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") 19 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
37 SET(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib") 20
38 set(USE_SYSTEM_UUID ON CACHE BOOL "Use the system version of the uuid library from e2fsprogs")
39
40 SET(DCMTK_DICTIONARY_DIR "" CACHE PATH "Directory containing the DCMTK dictionaries \"dicom.dic\" and \"private.dic\" (only when using system version of DCMTK)")
41
42 SET(USE_BOOST_ICONV ON CACHE BOOL "Use iconv instead of wconv (Windows only)")
43 mark_as_advanced(USE_BOOST_ICONV)
44 21
45 22
46 ##################################################################### 23 #####################################################################
47 ## Configure mandatory third-party components 24 ## Configure mandatory third-party components
48 ##################################################################### 25 #####################################################################
49 26
50 SET(ORTHANC_WSI_DIR ${CMAKE_CURRENT_LIST_DIR}/..) 27 SET(ORTHANC_WSI_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
51 SET(ORTHANC_ROOT ${ORTHANC_WSI_DIR}/Resources/Orthanc)
52 SET(USE_OPENJPEG_JP2 ON) 28 SET(USE_OPENJPEG_JP2 ON)
53 SET(ENABLE_JPEG OFF) # Disable DCMTK's support for JPEG, that clashes with libtiff 29
54 SET(ENABLE_JPEG_LOSSLESS OFF) # Disable DCMTK's support for JPEG-LS 30 include(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/DownloadOrthancFramework.cmake)
55 SET(ENABLE_DCMTK_NETWORK OFF) # Disable DCMTK's support for DICOM networking 31
56 SET(ENABLE_LOCALE ON) # Enable support for locales (notably in Boost) 32 UNSET(STANDALONE_BUILD CACHE)
57 SET(STANDALONE_BUILD ON) # Embed DCMTK's dictionaries for static builds 33 SET(STANDALONE_BUILD ON) # Embed DCMTK's dictionaries for static builds
58 SET(USE_DCMTK_361_PRIVATE_DIC OFF) # No need for private tags 34
59 35 set(ORTHANC_FRAMEWORK_PLUGIN OFF)
60 include(CheckFunctionExists) 36 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
61 include(CheckIncludeFile) 37
62 include(CheckIncludeFiles) 38 SET(ENABLE_CRYPTO_OPTIONS ON)
63 include(CheckIncludeFileCXX) 39 SET(ENABLE_DCMTK ON)
64 include(CheckLibraryExists) 40 SET(ENABLE_DCMTK_JPEG OFF) # Disable DCMTK's support for JPEG, that clashes with libtiff
65 include(CheckStructHasMember) 41 SET(ENABLE_DCMTK_JPEG_LOSSLESS OFF) # Disable DCMTK's support for JPEG-LS
66 include(FindPythonInterp) 42 SET(ENABLE_DCMTK_NETWORKING OFF) # Disable DCMTK's support for DICOM networking
67 include(FindPkgConfig) 43 SET(ENABLE_JPEG ON)
68 include(CheckSymbolExists) 44 SET(ENABLE_LOCALE ON) # Enable support for locales (notably in Boost)
69 45 SET(ENABLE_PNG ON)
70 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) 46 SET(ENABLE_SSL ON)
71 include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) 47 SET(ENABLE_WEB_CLIENT ON)
72 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) 48 SET(ENABLE_ZLIB ON)
73 include(${ORTHANC_ROOT}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake) 49 SET(HAS_EMBEDDED_RESOURCES ON)
74 50
75 # Third-party components shipped with Orthanc 51 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
76 include(${ORTHANC_ROOT}/Resources/CMake/DcmtkConfiguration.cmake) 52 include_directories(${ORTHANC_ROOT})
77 include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake) 53
78 include(${ORTHANC_ROOT}/Resources/CMake/LibCurlConfiguration.cmake)
79 include(${ORTHANC_ROOT}/Resources/CMake/LibIconvConfiguration.cmake)
80 include(${ORTHANC_ROOT}/Resources/CMake/LibJpegConfiguration.cmake)
81 include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake)
82 include(${ORTHANC_ROOT}/Resources/CMake/UuidConfiguration.cmake)
83 include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake)
84 54
85 # Include components specific to WSI 55 # Include components specific to WSI
86 include(${ORTHANC_WSI_DIR}/Resources/CMake/Version.cmake)
87 include(${ORTHANC_WSI_DIR}/Resources/CMake/BoostExtendedConfiguration.cmake) 56 include(${ORTHANC_WSI_DIR}/Resources/CMake/BoostExtendedConfiguration.cmake)
88 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake) 57 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake)
89 include(${ORTHANC_WSI_DIR}/Resources/CMake/LibTiffConfiguration.cmake) 58 include(${ORTHANC_WSI_DIR}/Resources/CMake/LibTiffConfiguration.cmake)
90 59
91 add_definitions(
92 -DHAS_ORTHANC_EXCEPTION=1
93 -DORTHANC_BUILD_UNIT_TESTS=0 # For FromDcmtkBridge
94 -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
95 -DORTHANC_ENABLE_BASE64=1
96 -DORTHANC_ENABLE_CURL=1
97 -DORTHANC_ENABLE_DCMTK=1
98 -DORTHANC_ENABLE_DCMTK_JPEG=0 # Disable DCMTK's support for JPEG
99 -DORTHANC_ENABLE_DCMTK_JPEG_LOSSLESS=0 # Disable DCMTK's support for JPEG-LS
100 -DORTHANC_ENABLE_JPEG=1
101 -DORTHANC_ENABLE_LOCALE=1
102 -DORTHANC_ENABLE_LOGGING=1
103 -DORTHANC_ENABLE_LOGGING_STDIO=0
104 -DORTHANC_ENABLE_LOGGING_PLUGIN=0
105 -DORTHANC_ENABLE_LUA=0 # For FromDcmtkBridge
106 -DORTHANC_ENABLE_MD5=0
107 -DORTHANC_ENABLE_PKCS11=0
108 -DORTHANC_ENABLE_PNG=1
109 -DORTHANC_ENABLE_PUGIXML=0
110 -DORTHANC_MAXIMUM_TAG_LENGTH=256
111 -DORTHANC_SANDBOXED=0
112 )
113 60
114 61
115 ##################################################################### 62 #####################################################################
116 ## Find the Orthanc SDK 63 ## Find the Orthanc SDK
117 ##################################################################### 64 #####################################################################
118 65
119 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) 66 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
120 include_directories(${ORTHANC_ROOT}/Sdk-1.0.0) 67 include_directories(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/Sdk-1.0.0)
121 else () 68 else ()
122 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H) 69 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
123 if (NOT HAVE_ORTHANC_H) 70 if (NOT HAVE_ORTHANC_H)
124 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK") 71 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK")
125 endif() 72 endif()
126 endif()
127
128
129 #####################################################################
130 ## Configure optional third-party components
131 #####################################################################
132
133 if (ENABLE_SSL)
134 set(ENABLE_PKCS11 OFF)
135 add_definitions(-DORTHANC_ENABLE_SSL=1)
136 include(${ORTHANC_ROOT}/Resources/CMake/OpenSslConfiguration.cmake)
137 else()
138 add_definitions(-DORTHANC_ENABLE_SSL=0)
139 endif() 73 endif()
140 74
141 75
142 ##################################################################### 76 #####################################################################
143 ## Create the list of the source files that depend upon the 77 ## Create the list of the source files that depend upon the
173 ${ORTHANC_WSI_DIR}/Framework/Outputs/MultiframeDicomWriter.cpp 107 ${ORTHANC_WSI_DIR}/Framework/Outputs/MultiframeDicomWriter.cpp
174 ${ORTHANC_WSI_DIR}/Framework/Outputs/PyramidWriterBase.cpp 108 ${ORTHANC_WSI_DIR}/Framework/Outputs/PyramidWriterBase.cpp
175 ${ORTHANC_WSI_DIR}/Framework/Outputs/TruncatedPyramidWriter.cpp 109 ${ORTHANC_WSI_DIR}/Framework/Outputs/TruncatedPyramidWriter.cpp
176 ) 110 )
177 111
178 set(ORTHANC_CORE_SOURCES 112 EmbedResources(
179 ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp 113 ${DCMTK_DICTIONARIES}
180 ${ORTHANC_ROOT}/Core/DicomFormat/DicomArray.cpp 114 BRIGHTFIELD_OPTICAL_PATH ${ORTHANC_WSI_DIR}/Resources/BrightfieldOpticalPath.json
181 ${ORTHANC_ROOT}/Core/DicomFormat/DicomMap.cpp 115 SAMPLE_DATASET ${ORTHANC_WSI_DIR}/Resources/SampleDataset.json
182 ${ORTHANC_ROOT}/Core/DicomFormat/DicomTag.cpp 116 SRGB_ICC_PROFILE ${ORTHANC_WSI_DIR}/Resources/sRGB.icc
183 ${ORTHANC_ROOT}/Core/DicomFormat/DicomValue.cpp 117 )
184 ${ORTHANC_ROOT}/Core/DicomParsing/FromDcmtkBridge.cpp 118
185 ${ORTHANC_ROOT}/Core/DicomParsing/ToDcmtkBridge.cpp 119
186 ${ORTHANC_ROOT}/Core/Enumerations.cpp 120 #####################################################################
187 ${ORTHANC_ROOT}/Core/HttpClient.cpp 121 ## Setup precompiled headers for Microsoft Visual Studio
188 ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp 122 #####################################################################
189 ${ORTHANC_ROOT}/Core/Images/Image.cpp 123
190 ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp 124 if (MSVC)
191 ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp 125 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
192 ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp 126
193 ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp 127 set(TMP
194 ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp 128 ${ORTHANC_CORE_SOURCES_INTERNAL}
195 ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp 129 ${ORTHANC_DICOM_SOURCES_INTERNAL}
196 ${ORTHANC_ROOT}/Core/Images/PngReader.cpp 130 )
197 ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp 131
198 ${ORTHANC_ROOT}/Core/Logging.cpp 132 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
199 ${ORTHANC_ROOT}/Core/MultiThreading/BagOfTasksProcessor.cpp 133 "PrecompiledHeaders.h" "${ORTHANC_ROOT}/Core/PrecompiledHeaders.cpp"
200 ${ORTHANC_ROOT}/Core/MultiThreading/SharedMessageQueue.cpp 134 TMP ORTHANC_CORE_PCH)
201 ${ORTHANC_ROOT}/Core/SharedLibrary.cpp 135
202 ${ORTHANC_ROOT}/Core/SystemToolbox.cpp 136 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
203 ${ORTHANC_ROOT}/Core/TemporaryFile.cpp 137 "PrecompiledHeadersWSI.h" "${ORTHANC_WSI_DIR}/Framework/PrecompiledHeadersWSI.cpp"
204 ${ORTHANC_ROOT}/Core/Toolbox.cpp 138 ORTHANC_WSI_SOURCES ORTHANC_WSI_PCH)
205 ${ORTHANC_ROOT}/Core/WebServiceParameters.cpp 139
140 source_group(ThirdParty\\OrthancCore FILES ${ORTHANC_CORE_SOURCES})
141 endif()
142
143
144 #####################################################################
145 ## Create the static library containing the framework
146 #####################################################################
147
148 add_library(OrthancWSIFramework STATIC
149 ${ORTHANC_CORE_PCH}
150 ${ORTHANC_CORE_SOURCES_INTERNAL}
151 ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
152 ${ORTHANC_DICOM_SOURCES_INTERNAL}
153 ${ORTHANC_DICOM_SOURCES_DEPENDENCIES}
154 ${ORTHANC_WSI_PCH}
155 ${ORTHANC_WSI_SOURCES}
156 ${AUTOGENERATED_SOURCES}
157 ${BOOST_EXTENDED_SOURCES}
206 158
207 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp 159 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
208 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp 160 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp
209 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp 161 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp
210 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomTag.cpp 162 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomTag.cpp
212 ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp 164 ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp
213 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancHttpConnection.cpp 165 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancHttpConnection.cpp
214 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginConnection.cpp 166 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginConnection.cpp
215 ${ORTHANC_ROOT}/Plugins/Samples/Common/SimplifiedOrthancDataset.cpp 167 ${ORTHANC_ROOT}/Plugins/Samples/Common/SimplifiedOrthancDataset.cpp
216 168
217 ${ORTHANC_ROOT}/Resources/ThirdParty/base64/base64.cpp
218 )
219
220 EmbedResources(
221 ${DCMTK_DICTIONARIES}
222 BRIGHTFIELD_OPTICAL_PATH ${ORTHANC_WSI_DIR}/Resources/BrightfieldOpticalPath.json
223 SAMPLE_DATASET ${ORTHANC_WSI_DIR}/Resources/SampleDataset.json
224 SRGB_ICC_PROFILE ${ORTHANC_WSI_DIR}/Resources/sRGB.icc
225 )
226
227
228 #####################################################################
229 ## Setup precompiled headers for Microsoft Visual Studio
230 #####################################################################
231
232 if (MSVC)
233 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
234
235 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
236 "PrecompiledHeaders.h" "${ORTHANC_WSI_DIR}/Resources/Orthanc/Core/PrecompiledHeaders.cpp"
237 ORTHANC_CORE_SOURCES ORTHANC_CORE_PCH)
238
239 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
240 "PrecompiledHeadersWSI.h" "${ORTHANC_WSI_DIR}/Framework/PrecompiledHeadersWSI.cpp"
241 ORTHANC_WSI_SOURCES ORTHANC_WSI_PCH)
242
243 source_group(ThirdParty\\OrthancCore FILES ${ORTHANC_CORE_SOURCES})
244 endif()
245
246
247 #####################################################################
248 ## Create the static library containing the framework
249 #####################################################################
250
251 add_library(OrthancWSIFramework STATIC
252 ${ORTHANC_CORE_PCH}
253 ${ORTHANC_CORE_SOURCES}
254 ${ORTHANC_WSI_PCH}
255 ${ORTHANC_WSI_SOURCES}
256 ${AUTOGENERATED_SOURCES}
257
258 # Mandatory components 169 # Mandatory components
259 ${BOOST_SOURCES}
260 ${CURL_SOURCES}
261 ${DCMTK_SOURCES}
262 ${JSONCPP_SOURCES}
263 ${LIBICONV_SOURCES}
264 ${LIBJPEG_SOURCES}
265 ${LIBPNG_SOURCES}
266 ${LIBTIFF_SOURCES} 170 ${LIBTIFF_SOURCES}
267 ${OPENJPEG_SOURCES} 171 ${OPENJPEG_SOURCES}
268 ${UUID_SOURCES}
269 ${ZLIB_SOURCES}
270
271 # Optional components
272 ${OPENSSL_SOURCES}
273 ) 172 )
274 173
275 174
276 ##################################################################### 175 #####################################################################
277 ## Build the WSI DICOM-izer 176 ## Build the WSI DICOM-izer