Mercurial > hg > orthanc-webviewer
comparison Resources/Orthanc/CMake/DownloadOrthancFramework.cmake @ 272:2c3555b8eabc
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 01 Jul 2020 11:29:01 +0200 |
parents | 938257eebc03 |
children | ae2049a3616a |
comparison
equal
deleted
inserted
replaced
270:3e9307f6da67 | 272:2c3555b8eabc |
---|---|
193 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}) | 193 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}) |
194 message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}") | 194 message(FATAL_ERROR "Non-existing directory: ${ORTHANC_FRAMEWORK_ROOT}") |
195 endif() | 195 endif() |
196 | 196 |
197 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) | 197 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) |
198 message(FATAL_ERROR "Directory not containing the source code of Orthanc: ${ORTHANC_FRAMEWORK_ROOT}") | 198 message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_FRAMEWORK_ROOT}") |
199 endif() | 199 endif() |
200 | |
201 set(ORTHANC_ROOT ${ORTHANC_FRAMEWORK_ROOT}) | |
202 endif() | 200 endif() |
203 | 201 |
204 | 202 |
205 | 203 |
206 ## | 204 ## |
243 ) | 241 ) |
244 | 242 |
245 if (Failure) | 243 if (Failure) |
246 message(FATAL_ERROR "Error while running Mercurial") | 244 message(FATAL_ERROR "Error while running Mercurial") |
247 endif() | 245 endif() |
246 | |
247 unset(ORTHANC_FRAMEWORK_ROOT CACHE) | |
248 set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE | |
249 STRING "Path to the Orthanc framework source directory") | |
250 | |
251 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) | |
252 message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}") | |
253 endif() | |
254 | |
255 unset(ORTHANC_ROOT) | |
248 endif() | 256 endif() |
249 | 257 |
250 | 258 |
251 | 259 |
252 ## | 260 ## |
370 | 378 |
371 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") | 379 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") |
372 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") | 380 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") |
373 endif() | 381 endif() |
374 endif() | 382 endif() |
383 | |
384 unset(ORTHANC_FRAMEWORK_ROOT CACHE) | |
385 set(ORTHANC_FRAMEWORK_ROOT "${ORTHANC_ROOT}/OrthancFramework" CACHE | |
386 STRING "Path to the Orthanc framework source directory") | |
387 | |
388 if (NOT EXISTS ${ORTHANC_FRAMEWORK_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake) | |
389 message(FATAL_ERROR "Directory not containing the source code of the Orthanc framework: ${ORTHANC_ROOT}") | |
390 endif() | |
391 | |
392 unset(ORTHANC_ROOT) | |
375 endif() | 393 endif() |
376 | 394 |
377 | 395 |
378 | 396 |
379 ## | 397 ## |
397 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake) | 415 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake) |
398 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake) | 416 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake) |
399 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake) | 417 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake) |
400 set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py) | 418 set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py) |
401 | 419 |
402 if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") | 420 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR |
421 ORTHANC_FRAMEWORK_STATIC) | |
422 include_directories(${ORTHANC_FRAMEWORK_ROOT}/..) | |
423 else() | |
403 # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake) | 424 # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake) |
404 find_path(JSONCPP_INCLUDE_DIR json/reader.h | 425 find_path(JSONCPP_INCLUDE_DIR json/reader.h |
405 /usr/include/jsoncpp | 426 /usr/include/jsoncpp |
406 /usr/local/include/jsoncpp | 427 /usr/local/include/jsoncpp |
407 ) | 428 ) |
444 if (NOT HAVE_SQLITE_H) | 465 if (NOT HAVE_SQLITE_H) |
445 message(FATAL_ERROR "Please install the libsqlite3-dev package") | 466 message(FATAL_ERROR "Please install the libsqlite3-dev package") |
446 endif() | 467 endif() |
447 link_libraries(sqlite3) | 468 link_libraries(sqlite3) |
448 endif() | 469 endif() |
470 | |
471 # Optional component - Pugixml | |
472 if (ENABLE_PUGIXML) | |
473 CHECK_INCLUDE_FILE_CXX(pugixml.hpp HAVE_PUGIXML_H) | |
474 if (NOT HAVE_PUGIXML_H) | |
475 message(FATAL_ERROR "Please install the libpugixml-dev package") | |
476 endif() | |
477 link_libraries(pugixml) | |
478 endif() | |
479 | |
480 # Optional component - DCMTK | |
481 if (ENABLE_DCMTK) | |
482 include(FindDCMTK) | |
483 include_directories(${DCMTK_INCLUDE_DIRS}) | |
484 link_libraries(${DCMTK_LIBRARIES}) | |
485 endif() | |
449 endif() | 486 endif() |
450 | 487 |
451 # Optional component - Google Test | 488 # Optional component - Google Test |
452 if (ENABLE_GOOGLE_TEST) | 489 if (ENABLE_GOOGLE_TEST) |
453 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") | 490 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test") |
459 # Look for Orthanc framework shared library | 496 # Look for Orthanc framework shared library |
460 include(CheckCXXSymbolExists) | 497 include(CheckCXXSymbolExists) |
461 | 498 |
462 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") | 499 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") |
463 set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}) | 500 set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}) |
464 include_directories(${ORTHANC_FRAMEWORK_ROOT}/..) | |
465 else() | 501 else() |
466 find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h | 502 find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h |
467 /usr/include/orthanc-framework | 503 /usr/include/orthanc-framework |
468 /usr/local/include/orthanc-framework | 504 /usr/local/include/orthanc-framework |
469 ${ORTHANC_FRAMEWORK_ROOT} | 505 ${ORTHANC_FRAMEWORK_ROOT} |
470 ) | 506 ) |
471 endif() | 507 endif() |
508 | |
509 if (${ORTHANC_FRAMEWORK_INCLUDE_DIR} STREQUAL "ORTHANC_FRAMEWORK_INCLUDE_DIR-NOTFOUND") | |
510 message(FATAL_ERROR "Cannot locate the OrthancFramework.h header") | |
511 endif() | |
472 | 512 |
473 message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}") | 513 message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}") |
474 include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR}) | 514 include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR}) |
475 | 515 |
516 if ("${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") | |
517 set(ORTHANC_FRAMEWORK_LIBRARIES OrthancFramework) | |
518 else() | |
519 if (MSVC) | |
520 set(Suffix ".lib") | |
521 set(Prefix "") | |
522 else() | |
523 list(GET CMAKE_FIND_LIBRARY_PREFIXES 0 Prefix) | |
524 list(GET CMAKE_FIND_LIBRARY_SUFFIXES 0 Suffix) | |
525 endif() | |
526 set(ORTHANC_FRAMEWORK_LIBRARIES ${ORTHANC_FRAMEWORK_LIBDIR}/${Prefix}OrthancFramework${Suffix}) | |
527 endif() | |
528 | |
476 set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}") | 529 set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}") |
477 | 530 set(CMAKE_REQUIRED_LIBRARIES "${ORTHANC_FRAMEWORK_LIBRARIES}") |
478 if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") | |
479 set(CMAKE_REQUIRED_LIBRARIES "-L${ORTHANC_FRAMEWORK_LIBDIR} -lOrthancFramework") | |
480 else() | |
481 set(CMAKE_REQUIRED_LIBRARIES "OrthancFramework") | |
482 endif() | |
483 | 531 |
484 check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK) | 532 check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK) |
485 if(NOT HAVE_ORTHANC_FRAMEWORK) | 533 if (NOT HAVE_ORTHANC_FRAMEWORK) |
486 message(FATAL_ERROR "Cannot find the Orthanc framework") | 534 message(FATAL_ERROR "Cannot find the Orthanc framework") |
487 endif() | 535 endif() |
488 | 536 |
489 if (NOT "${ORTHANC_FRAMEWORK_ROOT}" STREQUAL "") | 537 if (NOT "${ORTHANC_FRAMEWORK_ROOT}" STREQUAL "") |
490 include_directories(${ORTHANC_FRAMEWORK_ROOT}) | 538 include_directories(${ORTHANC_FRAMEWORK_ROOT}) |
491 endif() | 539 endif() |
492 | 540 endif() |
493 if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "") | |
494 link_directories(${ORTHANC_FRAMEWORK_LIBDIR}) | |
495 endif() | |
496 endif() |