Mercurial > hg > orthanc-webviewer
comparison Resources/Orthanc/CMake/DownloadOrthancFramework.cmake @ 266:4e9d30c19b4b
linking against orthanc framework library
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 12:32:46 +0200 |
parents | |
children | 938257eebc03 |
comparison
equal
deleted
inserted
replaced
265:af7108b06b4d | 266:4e9d30c19b4b |
---|---|
1 # Orthanc - A Lightweight, RESTful DICOM Store | |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
4 # Copyright (C) 2017-2020 Osimis S.A., Belgium | |
5 # | |
6 # This program is free software: you can redistribute it and/or | |
7 # modify it under the terms of the GNU General Public License as | |
8 # published by the Free Software Foundation, either version 3 of the | |
9 # License, or (at your option) any later version. | |
10 # | |
11 # In addition, as a special exception, the copyright holders of this | |
12 # program give permission to link the code of its release with the | |
13 # OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 # that use the same license as the "OpenSSL" library), and distribute | |
15 # the linked executables. You must obey the GNU General Public License | |
16 # in all respects for all of the code used other than "OpenSSL". If you | |
17 # modify file(s) with this exception, you may extend this exception to | |
18 # your version of the file(s), but you are not obligated to do so. If | |
19 # you do not wish to do so, delete this exception statement from your | |
20 # version. If you delete this exception statement from all source files | |
21 # in the program, then also delete it here. | |
22 # | |
23 # This program is distributed in the hope that it will be useful, but | |
24 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 # General Public License for more details. | |
27 # | |
28 # You should have received a copy of the GNU General Public License | |
29 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 | |
31 | |
32 | |
33 ## | |
34 ## Check whether the parent script sets the mandatory variables | |
35 ## | |
36 | |
37 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR | |
38 (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system" AND | |
39 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND | |
40 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND | |
41 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND | |
42 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")) | |
43 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"system\", \"hg\", \"web\", \"archive\" or \"path\"") | |
44 endif() | |
45 | |
46 | |
47 ## | |
48 ## Detection of the requested version | |
49 ## | |
50 | |
51 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" OR | |
52 ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR | |
53 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") | |
54 if (NOT DEFINED ORTHANC_FRAMEWORK_VERSION) | |
55 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_VERSION must be set") | |
56 endif() | |
57 | |
58 if (DEFINED ORTHANC_FRAMEWORK_MAJOR OR | |
59 DEFINED ORTHANC_FRAMEWORK_MINOR OR | |
60 DEFINED ORTHANC_FRAMEWORK_REVISION OR | |
61 DEFINED ORTHANC_FRAMEWORK_MD5) | |
62 message(FATAL_ERROR "Some internal variable has been set") | |
63 endif() | |
64 | |
65 set(ORTHANC_FRAMEWORK_MD5 "") | |
66 | |
67 if (NOT DEFINED ORTHANC_FRAMEWORK_BRANCH) | |
68 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline") | |
69 set(ORTHANC_FRAMEWORK_BRANCH "default") | |
70 set(ORTHANC_FRAMEWORK_MAJOR 999) | |
71 set(ORTHANC_FRAMEWORK_MINOR 999) | |
72 set(ORTHANC_FRAMEWORK_REVISION 999) | |
73 | |
74 else() | |
75 set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}") | |
76 | |
77 set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$") | |
78 string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION}) | |
79 string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION}) | |
80 string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION}) | |
81 | |
82 if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR | |
83 NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR | |
84 NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$") | |
85 message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}") | |
86 endif() | |
87 | |
88 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1") | |
89 set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378") | |
90 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2") | |
91 set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750") | |
92 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.0") | |
93 set(ORTHANC_FRAMEWORK_MD5 "81e15f34d97ac32bbd7d26e85698835a") | |
94 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1") | |
95 set(ORTHANC_FRAMEWORK_MD5 "9b6f6114264b17ed421b574cd6476127") | |
96 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.2") | |
97 set(ORTHANC_FRAMEWORK_MD5 "d1ee84927dcf668e60eb5868d24b9394") | |
98 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.0") | |
99 set(ORTHANC_FRAMEWORK_MD5 "4429d8d9dea4ff6648df80ec3c64d79e") | |
100 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.1") | |
101 set(ORTHANC_FRAMEWORK_MD5 "099671538865e5da96208b37494d6718") | |
102 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.2") | |
103 set(ORTHANC_FRAMEWORK_MD5 "8867050f3e9a1ce6157c1ea7a9433b1b") | |
104 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.3") | |
105 set(ORTHANC_FRAMEWORK_MD5 "bf2f5ed1adb8b0fc5f10d278e68e1dfe") | |
106 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.4") | |
107 set(ORTHANC_FRAMEWORK_MD5 "404baef5d4c43e7c5d9410edda8ef5a5") | |
108 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.5") | |
109 set(ORTHANC_FRAMEWORK_MD5 "cfc437e0687ae4bd725fd93dc1f08bc4") | |
110 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.6") | |
111 set(ORTHANC_FRAMEWORK_MD5 "3c29de1e289b5472342947168f0105c0") | |
112 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.7") | |
113 set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3") | |
114 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8") | |
115 set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336") | |
116 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0") | |
117 set(ORTHANC_FRAMEWORK_MD5 "eab428d6e53f61e847fa360bb17ebe25") | |
118 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.1") | |
119 set(ORTHANC_FRAMEWORK_MD5 "3971f5de96ba71dc9d3f3690afeaa7c0") | |
120 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.0") | |
121 set(ORTHANC_FRAMEWORK_MD5 "ce5f689e852b01d3672bd3d2f952a5ef") | |
122 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.7.1") | |
123 set(ORTHANC_FRAMEWORK_MD5 "3c171217f930abe80246997bdbcaf7cc") | |
124 | |
125 # Below this point are development snapshots that were used to | |
126 # release some plugin, before an official release of the Orthanc | |
127 # framework was available. Here is the command to be used to | |
128 # generate a proper archive: | |
129 # | |
130 # $ hg archive /tmp/Orthanc-`hg id -i | sed 's/\+//'`.tar.gz | |
131 # | |
132 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "ae0e3fd609df") | |
133 # DICOMweb 1.1 (framework pre-1.6.0) | |
134 set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645") | |
135 endif() | |
136 endif() | |
137 endif() | |
138 else() | |
139 message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.") | |
140 set(ORTHANC_FRAMEWORK_MAJOR 999) | |
141 set(ORTHANC_FRAMEWORK_MINOR 999) | |
142 set(ORTHANC_FRAMEWORK_REVISION 999) | |
143 endif() | |
144 | |
145 | |
146 | |
147 ## | |
148 ## Detection of the third-party software | |
149 ## | |
150 | |
151 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg") | |
152 find_program(ORTHANC_FRAMEWORK_HG hg) | |
153 | |
154 if (${ORTHANC_FRAMEWORK_HG} MATCHES "ORTHANC_FRAMEWORK_HG-NOTFOUND") | |
155 message(FATAL_ERROR "Please install Mercurial") | |
156 endif() | |
157 endif() | |
158 | |
159 | |
160 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR | |
161 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") | |
162 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") | |
163 find_program(ORTHANC_FRAMEWORK_7ZIP 7z | |
164 PATHS | |
165 "$ENV{ProgramFiles}/7-Zip" | |
166 "$ENV{ProgramW6432}/7-Zip" | |
167 ) | |
168 | |
169 if (${ORTHANC_FRAMEWORK_7ZIP} MATCHES "ORTHANC_FRAMEWORK_7ZIP-NOTFOUND") | |
170 message(FATAL_ERROR "Please install the '7-zip' software (http://www.7-zip.org/)") | |
171 endif() | |
172 | |
173 else() | |
174 find_program(ORTHANC_FRAMEWORK_TAR tar) | |
175 if (${ORTHANC_FRAMEWORK_TAR} MATCHES "ORTHANC_FRAMEWORK_TAR-NOTFOUND") | |
176 message(FATAL_ERROR "Please install the 'tar' package") | |
177 endif() | |
178 endif() | |
179 endif() | |
180 | |
181 | |
182 | |
183 ## | |
184 ## Case of the Orthanc framework specified as a path on the filesystem | |
185 ## | |
186 | |
187 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") | |
188 if (NOT DEFINED ORTHANC_FRAMEWORK_ROOT) | |
189 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ROOT must provide the path to the sources of Orthanc") | |
190 endif() | |
191 | |
192 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}) | |
193 message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}") | |
194 endif() | |
195 | |
196 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) | |
197 message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}") | |
198 endif() | |
199 | |
200 set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT}) | |
201 endif() | |
202 | |
203 | |
204 | |
205 ## | |
206 ## Case of the Orthanc framework cloned using Mercurial | |
207 ## | |
208 | |
209 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg") | |
210 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) | |
211 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") | |
212 endif() | |
213 | |
214 set(ORTHANC_ROOT ${CMAKE_BINARY_DIR}/orthanc) | |
215 | |
216 if (EXISTS ${ORTHANC_ROOT}) | |
217 message("Updating the Orthanc source repository using Mercurial") | |
218 execute_process( | |
219 COMMAND ${ORTHANC_FRAMEWORK_HG} pull | |
220 WORKING_DIRECTORY ${ORTHANC_ROOT} | |
221 RESULT_VARIABLE Failure | |
222 ) | |
223 else() | |
224 message("Forking the Orthanc source repository using Mercurial") | |
225 execute_process( | |
226 COMMAND ${ORTHANC_FRAMEWORK_HG} clone "https://hg.orthanc-server.com/orthanc/" | |
227 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
228 RESULT_VARIABLE Failure | |
229 ) | |
230 endif() | |
231 | |
232 if (Failure OR NOT EXISTS ${ORTHANC_ROOT}) | |
233 message(FATAL_ERROR "Cannot fork the Orthanc repository") | |
234 endif() | |
235 | |
236 message("Setting branch of the Orthanc repository to: ${ORTHANC_FRAMEWORK_BRANCH}") | |
237 | |
238 execute_process( | |
239 COMMAND ${ORTHANC_FRAMEWORK_HG} update -c ${ORTHANC_FRAMEWORK_BRANCH} | |
240 WORKING_DIRECTORY ${ORTHANC_ROOT} | |
241 RESULT_VARIABLE Failure | |
242 ) | |
243 | |
244 if (Failure) | |
245 message(FATAL_ERROR "Error while running Mercurial") | |
246 endif() | |
247 endif() | |
248 | |
249 | |
250 | |
251 ## | |
252 ## Case of the Orthanc framework provided as a source archive on the | |
253 ## filesystem | |
254 ## | |
255 | |
256 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive") | |
257 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE) | |
258 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_ARCHIVE must provide the path to the sources of Orthanc") | |
259 endif() | |
260 endif() | |
261 | |
262 | |
263 | |
264 ## | |
265 ## Case of the Orthanc framework downloaded from the Web | |
266 ## | |
267 | |
268 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") | |
269 if (DEFINED ORTHANC_FRAMEWORK_URL) | |
270 string(REGEX REPLACE "^.*/" "" ORTHANC_FRAMEMORK_FILENAME "${ORTHANC_FRAMEWORK_URL}") | |
271 else() | |
272 # Default case: Download from the official Web site | |
273 set(ORTHANC_FRAMEMORK_FILENAME Orthanc-${ORTHANC_FRAMEWORK_VERSION}.tar.gz) | |
274 set(ORTHANC_FRAMEWORK_URL "http://orthanc.osimis.io/ThirdPartyDownloads/orthanc-framework/${ORTHANC_FRAMEMORK_FILENAME}") | |
275 endif() | |
276 | |
277 set(ORTHANC_FRAMEWORK_ARCHIVE "${CMAKE_SOURCE_DIR}/ThirdPartyDownloads/${ORTHANC_FRAMEMORK_FILENAME}") | |
278 | |
279 if (NOT EXISTS "${ORTHANC_FRAMEWORK_ARCHIVE}") | |
280 if (NOT STATIC_BUILD AND NOT ALLOW_DOWNLOADS) | |
281 message(FATAL_ERROR "CMake is not allowed to download from Internet. Please set the ALLOW_DOWNLOADS option to ON") | |
282 endif() | |
283 | |
284 message("Downloading: ${ORTHANC_FRAMEWORK_URL}") | |
285 | |
286 file(DOWNLOAD | |
287 "${ORTHANC_FRAMEWORK_URL}" "${ORTHANC_FRAMEWORK_ARCHIVE}" | |
288 SHOW_PROGRESS EXPECTED_MD5 "${ORTHANC_FRAMEWORK_MD5}" | |
289 TIMEOUT 60 | |
290 INACTIVITY_TIMEOUT 60 | |
291 ) | |
292 else() | |
293 message("Using local copy of: ${ORTHANC_FRAMEWORK_URL}") | |
294 endif() | |
295 endif() | |
296 | |
297 | |
298 | |
299 | |
300 ## | |
301 ## Uncompressing the Orthanc framework, if it was retrieved from a | |
302 ## source archive on the filesystem, or from the official Web site | |
303 ## | |
304 | |
305 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" OR | |
306 ORTHANC_FRAMEWORK_SOURCE STREQUAL "web") | |
307 | |
308 if (NOT DEFINED ORTHANC_FRAMEWORK_ARCHIVE OR | |
309 NOT DEFINED ORTHANC_FRAMEWORK_VERSION OR | |
310 NOT DEFINED ORTHANC_FRAMEWORK_MD5) | |
311 message(FATAL_ERROR "Internal error") | |
312 endif() | |
313 | |
314 if (ORTHANC_FRAMEWORK_MD5 STREQUAL "") | |
315 message(FATAL_ERROR "Unknown release of Orthanc: ${ORTHANC_FRAMEWORK_VERSION}") | |
316 endif() | |
317 | |
318 file(MD5 ${ORTHANC_FRAMEWORK_ARCHIVE} ActualMD5) | |
319 | |
320 if (NOT "${ActualMD5}" STREQUAL "${ORTHANC_FRAMEWORK_MD5}") | |
321 message(FATAL_ERROR "The MD5 hash of the Orthanc archive is invalid: ${ORTHANC_FRAMEWORK_ARCHIVE}") | |
322 endif() | |
323 | |
324 set(ORTHANC_ROOT "${CMAKE_BINARY_DIR}/Orthanc-${ORTHANC_FRAMEWORK_VERSION}") | |
325 | |
326 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") | |
327 if (NOT ORTHANC_FRAMEWORK_ARCHIVE MATCHES ".tar.gz$") | |
328 message(FATAL_ERROR "Archive should have the \".tar.gz\" extension: ${ORTHANC_FRAMEWORK_ARCHIVE}") | |
329 endif() | |
330 | |
331 message("Uncompressing: ${ORTHANC_FRAMEWORK_ARCHIVE}") | |
332 | |
333 if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") | |
334 # How to silently extract files using 7-zip | |
335 # http://superuser.com/questions/331148/7zip-command-line-extract-silently-quietly | |
336 | |
337 execute_process( | |
338 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} e -y ${ORTHANC_FRAMEWORK_ARCHIVE} | |
339 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
340 RESULT_VARIABLE Failure | |
341 OUTPUT_QUIET | |
342 ) | |
343 | |
344 if (Failure) | |
345 message(FATAL_ERROR "Error while running the uncompression tool") | |
346 endif() | |
347 | |
348 get_filename_component(TMP_FILENAME "${ORTHANC_FRAMEWORK_ARCHIVE}" NAME) | |
349 string(REGEX REPLACE ".gz$" "" TMP_FILENAME2 "${TMP_FILENAME}") | |
350 | |
351 execute_process( | |
352 COMMAND ${ORTHANC_FRAMEWORK_7ZIP} x -y ${TMP_FILENAME2} | |
353 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
354 RESULT_VARIABLE Failure | |
355 OUTPUT_QUIET | |
356 ) | |
357 | |
358 else() | |
359 execute_process( | |
360 COMMAND sh -c "${ORTHANC_FRAMEWORK_TAR} xfz ${ORTHANC_FRAMEWORK_ARCHIVE}" | |
361 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} | |
362 RESULT_VARIABLE Failure | |
363 ) | |
364 endif() | |
365 | |
366 if (Failure) | |
367 message(FATAL_ERROR "Error while running the uncompression tool") | |
368 endif() | |
369 | |
370 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") | |
371 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") | |
372 endif() | |
373 endif() | |
374 endif() | |
375 | |
376 | |
377 | |
378 ## | |
379 ## Case of the Orthanc framework installed as a shared library in a | |
380 ## GNU/Linux distribution (typically Debian) | |
381 ## | |
382 | |
383 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system") | |
384 set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "") | |
385 | |
386 include(CheckIncludeFileCXX) | |
387 include(FindPythonInterp) | |
388 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake) | |
389 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake) | |
390 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake) | |
391 set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py) | |
392 | |
393 # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake) | |
394 find_path(JSONCPP_INCLUDE_DIR json/reader.h | |
395 /usr/include/jsoncpp | |
396 /usr/local/include/jsoncpp | |
397 ) | |
398 | |
399 message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}") | |
400 include_directories(${JSONCPP_INCLUDE_DIR}) | |
401 link_libraries(jsoncpp) | |
402 | |
403 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H) | |
404 if (NOT HAVE_JSONCPP_H) | |
405 message(FATAL_ERROR "Please install the libjsoncpp-dev package") | |
406 endif() | |
407 | |
408 # Look for mandatory dependency Boost (cf. BoostConfiguration.cmake) | |
409 include(FindBoost) | |
410 find_package(Boost COMPONENTS filesystem thread system date_time regex) | |
411 | |
412 if (NOT Boost_FOUND) | |
413 message(FATAL_ERROR "Unable to locate Boost on this system") | |
414 endif() | |
415 | |
416 include_directories(${Boost_INCLUDE_DIRS}) | |
417 link_libraries(${Boost_LIBRARIES}) | |
418 | |
419 # Look for Orthanc framework shared library | |
420 include(CheckCXXSymbolExists) | |
421 | |
422 find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h | |
423 /usr/include/orthanc-framework | |
424 /usr/local/include/orthanc-framework | |
425 ${ORTHANC_FRAMEWORK_ROOT} | |
426 ) | |
427 | |
428 message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}") | |
429 include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR}) | |
430 | |
431 set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}") | |
432 | |
433 if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") | |
434 set(CMAKE_REQUIRED_LIBRARIES "-L${ORTHANC_FRAMEWORK_LIBDIR} -lOrthancFramework") | |
435 else() | |
436 set(CMAKE_REQUIRED_LIBRARIES "OrthancFramework") | |
437 endif() | |
438 | |
439 check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK) | |
440 if(NOT HAVE_ORTHANC_FRAMEWORK) | |
441 message(FATAL_ERROR "Cannot find the Orthanc framework") | |
442 endif() | |
443 | |
444 if (NOT "${ORTHANC_FRAMEWORK_ROOT}" STREQUAL "") | |
445 include_directories(${ORTHANC_FRAMEWORK_ROOT}) | |
446 endif() | |
447 | |
448 if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") | |
449 link_directories(${ORTHANC_FRAMEWORK_LIBDIR}) | |
450 endif() | |
451 endif() |