comparison ViewerPlugin/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(OrthancWSIPlugin) 2 project(OrthancWSIPlugin)
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 14
13 # Advanced parameters to fine-tune linking against system libraries 15 # Advanced parameters to fine-tune linking against system libraries
14 SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost")
15 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp")
16 SET(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg")
17 SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng")
18 SET(USE_SYSTEM_OPENJPEG ON CACHE BOOL "Use the system version of OpenJpeg") 16 SET(USE_SYSTEM_OPENJPEG ON CACHE BOOL "Use the system version of OpenJpeg")
19 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") 17 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK")
20 SET(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib")
21 set(USE_SYSTEM_UUID ON CACHE BOOL "Use the system version of the uuid library from e2fsprogs")
22 18
23 # Parameters related to OpenLayers 19 # Parameters related to OpenLayers
24 SET(USE_SYSTEM_OPENLAYERS OFF CACHE BOOL "Use the system version of OpenLayers") 20 SET(USE_SYSTEM_OPENLAYERS OFF CACHE BOOL "Use the system version of OpenLayers")
25 SET(OPENLAYERS_CSS "" CACHE FILEPATH "Path to the system version of OpenLayers CSS") 21 SET(OPENLAYERS_CSS "" CACHE FILEPATH "Path to the system version of OpenLayers CSS")
26 SET(OPENLAYERS_JS "" CACHE FILEPATH "Path to the system version of OpenLayers JavaScript") 22 SET(OPENLAYERS_JS "" CACHE FILEPATH "Path to the system version of OpenLayers JavaScript")
29 ##################################################################### 25 #####################################################################
30 ## Configure mandatory third-party components 26 ## Configure mandatory third-party components
31 ##################################################################### 27 #####################################################################
32 28
33 SET(ORTHANC_WSI_DIR ${CMAKE_CURRENT_LIST_DIR}/..) 29 SET(ORTHANC_WSI_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
34 SET(ORTHANC_ROOT ${ORTHANC_WSI_DIR}/Resources/Orthanc)
35
36 SET(USE_OPENJPEG_JP2 ON) 30 SET(USE_OPENJPEG_JP2 ON)
37 SET(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost) 31
38 32 include(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/DownloadOrthancFramework.cmake)
39 include(CheckIncludeFile) 33
40 include(CheckIncludeFileCXX) 34 set(ORTHANC_FRAMEWORK_PLUGIN ON)
41 include(CheckIncludeFiles) 35 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
42 include(CheckLibraryExists) 36
43 include(CheckSymbolExists) 37 set(ENABLE_LOCALE OFF) # Disable support for locales (notably in Boost)
44 include(FindPkgConfig) 38 set(ENABLE_ZLIB ON)
45 include(FindPythonInterp) 39 set(ENABLE_PNG ON)
46 40 set(ENABLE_JPEG ON)
47 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) 41
48 include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) 42 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
49 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) 43 include_directories(${ORTHANC_ROOT})
50 include(${ORTHANC_ROOT}/Resources/CMake/VisualStudioPrecompiledHeaders.cmake)
51
52 # Third-party components shipped with Orthanc
53 include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake)
54 include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake)
55 include(${ORTHANC_ROOT}/Resources/CMake/LibJpegConfiguration.cmake)
56 include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake)
57 include(${ORTHANC_ROOT}/Resources/CMake/UuidConfiguration.cmake)
58 include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake)
59 44
60 # Include components specific to WSI 45 # Include components specific to WSI
61 include(${ORTHANC_WSI_DIR}/Resources/CMake/Version.cmake) 46 include(${ORTHANC_WSI_DIR}/Resources/CMake/Version.cmake)
62 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake) 47 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake)
63 48
64 add_definitions(
65 -DHAS_ORTHANC_EXCEPTION=1
66 -DORTHANC_DEFAULT_DICOM_ENCODING=Encoding_Latin1
67 -DORTHANC_ENABLE_BASE64=0
68 -DORTHANC_ENABLE_CURL=0
69 -DORTHANC_ENABLE_DCMTK=0
70 -DORTHANC_ENABLE_JPEG=1
71 -DORTHANC_ENABLE_LOCALE=0
72 -DORTHANC_ENABLE_LOGGING=1
73 -DORTHANC_ENABLE_LOGGING_PLUGIN=1
74 -DORTHANC_ENABLE_LOGGING_STDIO=0
75 -DORTHANC_ENABLE_MD5=0
76 -DORTHANC_ENABLE_PNG=1
77 -DORTHANC_ENABLE_PUGIXML=0
78 -DORTHANC_SANDBOXED=0
79 )
80
81 49
82 ##################################################################### 50 #####################################################################
83 ## Find the Orthanc SDK 51 ## Find the Orthanc SDK
84 ##################################################################### 52 #####################################################################
85 53
86 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) 54 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK)
87 include_directories(${ORTHANC_ROOT}/Sdk-1.0.0) 55 include_directories(${CMAKE_SOURCE_DIR}/../Resources/Orthanc/Sdk-1.0.0)
88 else () 56 else ()
89 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H) 57 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H)
90 if (NOT HAVE_ORTHANC_H) 58 if (NOT HAVE_ORTHANC_H)
91 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK") 59 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK")
92 endif() 60 endif()
168 ##################################################################### 136 #####################################################################
169 137
170 set(ORTHANC_WSI_SOURCES 138 set(ORTHANC_WSI_SOURCES
171 DicomPyramidCache.cpp 139 DicomPyramidCache.cpp
172 Plugin.cpp 140 Plugin.cpp
141
173 ${ORTHANC_WSI_DIR}/Framework/DicomToolbox.cpp 142 ${ORTHANC_WSI_DIR}/Framework/DicomToolbox.cpp
174 ${ORTHANC_WSI_DIR}/Framework/Enumerations.cpp 143 ${ORTHANC_WSI_DIR}/Framework/Enumerations.cpp
175 ${ORTHANC_WSI_DIR}/Framework/ImageToolbox.cpp 144 ${ORTHANC_WSI_DIR}/Framework/ImageToolbox.cpp
176 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramid.cpp 145 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramid.cpp
177 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidInstance.cpp 146 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidInstance.cpp
178 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidLevel.cpp 147 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidLevel.cpp
179 ${ORTHANC_WSI_DIR}/Framework/Inputs/PyramidWithRawTiles.cpp 148 ${ORTHANC_WSI_DIR}/Framework/Inputs/PyramidWithRawTiles.cpp
180 ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Reader.cpp 149 ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Reader.cpp
181 ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Writer.cpp 150 ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Writer.cpp
182 ) 151
183
184 set(ORTHANC_CORE_SOURCES
185 ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp
186 ${ORTHANC_ROOT}/Core/Enumerations.cpp
187 ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp
188 ${ORTHANC_ROOT}/Core/Images/Image.cpp
189 ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp
190 ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp
191 ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp
192 ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp
193 ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp
194 ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp
195 ${ORTHANC_ROOT}/Core/Images/PngReader.cpp
196 ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp
197 ${ORTHANC_ROOT}/Core/Logging.cpp
198 ${ORTHANC_ROOT}/Core/MultiThreading/Semaphore.cpp
199 ${ORTHANC_ROOT}/Core/SystemToolbox.cpp
200 ${ORTHANC_ROOT}/Core/Toolbox.cpp
201 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp 152 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomDatasetReader.cpp
202 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp 153 ${ORTHANC_ROOT}/Plugins/Samples/Common/DicomPath.cpp
203 ${ORTHANC_ROOT}/Plugins/Samples/Common/FullOrthancDataset.cpp 154 ${ORTHANC_ROOT}/Plugins/Samples/Common/FullOrthancDataset.cpp
204 ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp 155 ${ORTHANC_ROOT}/Plugins/Samples/Common/IOrthancConnection.cpp
205 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginConnection.cpp 156 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginConnection.cpp
214 if (MSVC) 165 if (MSVC)
215 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1) 166 add_definitions(-DORTHANC_USE_PRECOMPILED_HEADERS=1)
216 167
217 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( 168 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
218 "PrecompiledHeaders.h" "${ORTHANC_WSI_DIR}/Resources/Orthanc/Core/PrecompiledHeaders.cpp" 169 "PrecompiledHeaders.h" "${ORTHANC_WSI_DIR}/Resources/Orthanc/Core/PrecompiledHeaders.cpp"
219 ORTHANC_CORE_SOURCES ORTHANC_CORE_PCH) 170 ORTHANC_CORE_SOURCES_INTERNAL ORTHANC_CORE_PCH)
220 171
221 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS( 172 ADD_VISUAL_STUDIO_PRECOMPILED_HEADERS(
222 "PrecompiledHeadersWSI.h" "${ORTHANC_WSI_DIR}/Framework/PrecompiledHeadersWSI.cpp" 173 "PrecompiledHeadersWSI.h" "${ORTHANC_WSI_DIR}/Framework/PrecompiledHeadersWSI.cpp"
223 ORTHANC_WSI_SOURCES ORTHANC_WSI_PCH) 174 ORTHANC_WSI_SOURCES ORTHANC_WSI_PCH)
224 175
230 ## Create the plugin 181 ## Create the plugin
231 ##################################################################### 182 #####################################################################
232 183
233 add_library(OrthancWSI SHARED 184 add_library(OrthancWSI SHARED
234 ${ORTHANC_CORE_PCH} 185 ${ORTHANC_CORE_PCH}
235 ${ORTHANC_CORE_SOURCES} 186 ${ORTHANC_CORE_SOURCES_INTERNAL}
187 ${ORTHANC_CORE_SOURCES_DEPENDENCIES}
236 ${ORTHANC_WSI_PCH} 188 ${ORTHANC_WSI_PCH}
237 ${ORTHANC_WSI_SOURCES} 189 ${ORTHANC_WSI_SOURCES}
238 ${AUTOGENERATED_SOURCES} 190 ${AUTOGENERATED_SOURCES}
239
240 # Mandatory components
241 ${BOOST_SOURCES}
242 ${JSONCPP_SOURCES}
243 ${LIBJPEG_SOURCES}
244 ${LIBPNG_SOURCES}
245 ${OPENJPEG_SOURCES} 191 ${OPENJPEG_SOURCES}
246 ${UUID_SOURCES}
247 ${ZLIB_SOURCES}
248 ) 192 )
249 193
250 message("Setting the version of the library to ${ORTHANC_WSI_VERSION}") 194 message("Setting the version of the library to ${ORTHANC_WSI_VERSION}")
251 set_target_properties(OrthancWSI PROPERTIES 195 set_target_properties(OrthancWSI PROPERTIES
252 VERSION ${ORTHANC_WSI_VERSION} 196 VERSION ${ORTHANC_WSI_VERSION}