comparison Resources/DownloadOrthancFramework.cmake @ 4037:5e26d004838c

adding option "system" to DownloadOrthancFramework.cmake
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 12:18:21 +0200
parents 7cd0fe733822
children
comparison
equal deleted inserted replaced
4034:78ee0155ec67 4037:5e26d004838c
33 ## 33 ##
34 ## Check whether the parent script sets the mandatory variables 34 ## Check whether the parent script sets the mandatory variables
35 ## 35 ##
36 36
37 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR 37 if (NOT DEFINED ORTHANC_FRAMEWORK_SOURCE OR
38 (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND 38 (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system" AND
39 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "hg" AND
39 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND 40 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "web" AND
40 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND 41 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "archive" AND
41 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")) 42 NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "path"))
42 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"hg\", \"web\", \"archive\" or \"path\"") 43 message(FATAL_ERROR "The variable ORTHANC_FRAMEWORK_SOURCE must be set to \"system\", \"hg\", \"web\", \"archive\" or \"path\"")
43 endif() 44 endif()
44 45
45 46
46 ## 47 ##
47 ## Detection of the requested version 48 ## Detection of the requested version
369 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") 370 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}")
370 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") 371 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.")
371 endif() 372 endif()
372 endif() 373 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()