Mercurial > hg > orthanc-wsi
comparison ViewerPlugin/CMakeLists.txt @ 0:4a7a53257c7d
initial commit
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 22 Oct 2016 21:48:33 +0200 |
parents | |
children | 77b76c1a213f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4a7a53257c7d |
---|---|
1 cmake_minimum_required(VERSION 2.8) | |
2 project(OrthancWSIPlugin) | |
3 | |
4 set(ORTHANC_WSI_VERSION "mainline") | |
5 | |
6 | |
7 ##################################################################### | |
8 ## Parameters of the build | |
9 ##################################################################### | |
10 | |
11 # Generic parameters | |
12 SET(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)") | |
13 SET(ALLOW_DOWNLOADS OFF CACHE BOOL "Allow CMake to download packages") | |
14 | |
15 # Advanced parameters to fine-tune linking against system libraries | |
16 SET(USE_SYSTEM_BOOST ON CACHE BOOL "Use the system version of Boost") | |
17 SET(USE_SYSTEM_JSONCPP ON CACHE BOOL "Use the system version of JsonCpp") | |
18 SET(USE_SYSTEM_LIBJPEG ON CACHE BOOL "Use the system version of libjpeg") | |
19 SET(USE_SYSTEM_LIBPNG ON CACHE BOOL "Use the system version of libpng") | |
20 SET(USE_SYSTEM_OPENJPEG ON CACHE BOOL "Use the system version of OpenJpeg") | |
21 SET(USE_SYSTEM_ZLIB ON CACHE BOOL "Use the system version of ZLib") | |
22 SET(USE_SYSTEM_ORTHANC_SDK ON CACHE BOOL "Use the system version of the Orthanc plugin SDK") | |
23 | |
24 # Parameters related to OpenLayers | |
25 SET(USE_SYSTEM_OPENLAYERS OFF CACHE BOOL "Use the system version of OpenLayers") | |
26 SET(OPENLAYERS_CSS "" CACHE FILEPATH "Path to the system version of OpenLayers CSS") | |
27 SET(OPENLAYERS_JS "" CACHE FILEPATH "Path to the system version of OpenLayers JavaScript") | |
28 | |
29 | |
30 ##################################################################### | |
31 ## Configure mandatory third-party components | |
32 ##################################################################### | |
33 | |
34 SET(ORTHANC_WSI_DIR ${CMAKE_CURRENT_LIST_DIR}/..) | |
35 SET(ORTHANC_ROOT ${ORTHANC_WSI_DIR}/Framework/Orthanc) | |
36 | |
37 SET(USE_OPENJPEG_JP2 ON) | |
38 | |
39 include(CheckIncludeFiles) | |
40 include(CheckIncludeFileCXX) | |
41 include(CheckLibraryExists) | |
42 include(FindPythonInterp) | |
43 include(FindPkgConfig) | |
44 | |
45 include(${ORTHANC_ROOT}/Resources/CMake/Compiler.cmake) | |
46 include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) | |
47 include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) | |
48 | |
49 # Third-party components shipped with Orthanc | |
50 include(${ORTHANC_ROOT}/Resources/CMake/BoostConfiguration.cmake) | |
51 include(${ORTHANC_ROOT}/Resources/CMake/JsonCppConfiguration.cmake) | |
52 include(${ORTHANC_ROOT}/Resources/CMake/LibJpegConfiguration.cmake) | |
53 include(${ORTHANC_ROOT}/Resources/CMake/LibPngConfiguration.cmake) | |
54 include(${ORTHANC_ROOT}/Resources/CMake/ZlibConfiguration.cmake) | |
55 | |
56 include(${ORTHANC_WSI_DIR}/Resources/CMake/OpenJpegConfiguration.cmake) | |
57 | |
58 add_definitions( | |
59 -DORTHANC_ENABLE_BASE64=0 | |
60 -DORTHANC_ENABLE_CURL=0 | |
61 -DORTHANC_ENABLE_DCMTK=0 | |
62 -DORTHANC_ENABLE_LOGGING=0 | |
63 -DORTHANC_ENABLE_MD5=0 | |
64 -DHAS_ORTHANC_EXCEPTION=1 | |
65 ) | |
66 | |
67 | |
68 ##################################################################### | |
69 ## Find the Orthanc SDK | |
70 ##################################################################### | |
71 | |
72 if (STATIC_BUILD OR NOT USE_SYSTEM_ORTHANC_SDK) | |
73 include_directories(${ORTHANC_ROOT}/Sdk-1.0.0) | |
74 else () | |
75 CHECK_INCLUDE_FILE_CXX(orthanc/OrthancCPlugin.h HAVE_ORTHANC_H) | |
76 if (NOT HAVE_ORTHANC_H) | |
77 message(FATAL_ERROR "Please install the headers of the Orthanc plugins SDK") | |
78 endif() | |
79 endif() | |
80 | |
81 | |
82 ##################################################################### | |
83 ## Platform-specific configuration | |
84 ##################################################################### | |
85 | |
86 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR | |
87 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR | |
88 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") | |
89 link_libraries(rt) | |
90 | |
91 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") | |
92 SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32") | |
93 | |
94 execute_process( | |
95 COMMAND | |
96 ${PYTHON_EXECUTABLE} ${ORTHANC_ROOT}/Resources/WindowsResources.py | |
97 ${ORTHANC_WSI_VERSION} "OrthancWSI" OrthancWSI.dll "Whole-slide imaging plugin for Orthanc" | |
98 ERROR_VARIABLE Failure | |
99 OUTPUT_FILE ${AUTOGENERATED_DIR}/Version.rc | |
100 ) | |
101 | |
102 if (Failure) | |
103 message(FATAL_ERROR "Error while computing the version information: ${Failure}") | |
104 endif() | |
105 | |
106 list(APPEND AUTOGENERATED_SOURCES ${AUTOGENERATED_DIR}/Version.rc) | |
107 endif() | |
108 | |
109 if (APPLE) | |
110 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreFoundation") | |
111 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -framework CoreFoundation") | |
112 endif() | |
113 | |
114 | |
115 ##################################################################### | |
116 ## Prepare OpenLayers | |
117 ##################################################################### | |
118 | |
119 if (STATIC_BUILD OR NOT USE_SYSTEM_OPENLAYERS) | |
120 DownloadPackage( | |
121 "77e57aad873c2d4deea8bb1446e9b87a" | |
122 "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/WSI/openlayers-3.19.0-dist.zip" | |
123 "v3.19.0-dist") | |
124 | |
125 set(OPENLAYERS_RESOURCES | |
126 OPENLAYERS_CSS ${CMAKE_CURRENT_BINARY_DIR}/v3.19.0-dist/ol.css | |
127 OPENLAYERS_JS ${CMAKE_CURRENT_BINARY_DIR}/v3.19.0-dist/ol.js | |
128 ) | |
129 | |
130 else() | |
131 set(OPENLAYERS_RESOURCES | |
132 OPENLAYERS_CSS ${OPENLAYERS_CSS} | |
133 OPENLAYERS_JS ${OPENLAYERS_JS} | |
134 ) | |
135 endif() | |
136 | |
137 EmbedResources( | |
138 ${OPENLAYERS_RESOURCES} | |
139 ORTHANC_EXPLORER ${CMAKE_SOURCE_DIR}/OrthancExplorer.js | |
140 VIEWER_HTML ${CMAKE_SOURCE_DIR}/viewer.html | |
141 VIEWER_JS ${CMAKE_SOURCE_DIR}/viewer.js | |
142 ) | |
143 | |
144 | |
145 ##################################################################### | |
146 ## Create the plugin | |
147 ##################################################################### | |
148 | |
149 add_library(OrthancWSI SHARED | |
150 Plugin.cpp | |
151 | |
152 ${ORTHANC_WSI_DIR}/Framework/DicomToolbox.cpp | |
153 ${ORTHANC_WSI_DIR}/Framework/Enumerations.cpp | |
154 ${ORTHANC_WSI_DIR}/Framework/ImageToolbox.cpp | |
155 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramid.cpp | |
156 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidInstance.cpp | |
157 ${ORTHANC_WSI_DIR}/Framework/Inputs/DicomPyramidLevel.cpp | |
158 ${ORTHANC_WSI_DIR}/Framework/Inputs/PyramidWithRawTiles.cpp | |
159 ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Reader.cpp | |
160 ${ORTHANC_WSI_DIR}/Framework/Jpeg2000Writer.cpp | |
161 ${ORTHANC_WSI_DIR}/Framework/Messaging/IOrthancConnection.cpp | |
162 ${ORTHANC_WSI_DIR}/Framework/Messaging/OrthancConnectionBase.cpp | |
163 ${ORTHANC_WSI_DIR}/Framework/Messaging/PluginOrthancConnection.cpp | |
164 | |
165 ${ORTHANC_ROOT}/Core/ChunkedBuffer.cpp | |
166 ${ORTHANC_ROOT}/Core/Enumerations.cpp | |
167 ${ORTHANC_ROOT}/Core/Images/IImageWriter.cpp | |
168 ${ORTHANC_ROOT}/Core/Images/Image.cpp | |
169 ${ORTHANC_ROOT}/Core/Images/ImageAccessor.cpp | |
170 ${ORTHANC_ROOT}/Core/Images/ImageBuffer.cpp | |
171 ${ORTHANC_ROOT}/Core/Images/ImageProcessing.cpp | |
172 ${ORTHANC_ROOT}/Core/Images/JpegErrorManager.cpp | |
173 ${ORTHANC_ROOT}/Core/Images/JpegReader.cpp | |
174 ${ORTHANC_ROOT}/Core/Images/JpegWriter.cpp | |
175 ${ORTHANC_ROOT}/Core/Images/PngReader.cpp | |
176 ${ORTHANC_ROOT}/Core/Images/PngWriter.cpp | |
177 ${ORTHANC_ROOT}/Core/Logging.cpp | |
178 ${ORTHANC_ROOT}/Core/MultiThreading/Semaphore.cpp | |
179 ${ORTHANC_ROOT}/Core/Toolbox.cpp | |
180 | |
181 ${AUTOGENERATED_SOURCES} | |
182 | |
183 # Mandatory components | |
184 ${BOOST_SOURCES} | |
185 ${JSONCPP_SOURCES} | |
186 ${ZLIB_SOURCES} | |
187 ${LIBPNG_SOURCES} | |
188 ${LIBJPEG_SOURCES} | |
189 ${OPENJPEG_SOURCES} | |
190 ) | |
191 | |
192 message("Setting the version of the library to ${ORTHANC_WSI_VERSION}") | |
193 add_definitions(-DORTHANC_WSI_VERSION="${ORTHANC_WSI_VERSION}") | |
194 | |
195 set_target_properties(OrthancWSI PROPERTIES | |
196 VERSION ${ORTHANC_WSI_VERSION} | |
197 SOVERSION ${ORTHANC_WSI_VERSION}) | |
198 | |
199 install( | |
200 TARGETS OrthancWSI | |
201 RUNTIME DESTINATION lib # Destination for Windows | |
202 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
203 ) |