comparison Resources/Orthanc/DownloadOrthancFramework.cmake @ 1499:8e5f69c94fea

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Jun 2020 07:58:56 +0200
parents 86f89ab3563e
children d8af188ab545
comparison
equal deleted inserted replaced
1498:51d18d6bebd1 1499:8e5f69c94fea
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
112 set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3") 113 set(ORTHANC_FRAMEWORK_MD5 "e1b76f01116d9b5d4ac8cc39980560e3")
113 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8") 114 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.5.8")
114 set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336") 115 set(ORTHANC_FRAMEWORK_MD5 "82323e8c49a667f658a3639ea4dbc336")
115 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0") 116 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.6.0")
116 set(ORTHANC_FRAMEWORK_MD5 "eab428d6e53f61e847fa360bb17ebe25") 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")
117 124
118 # Below this point are development snapshots that were used to 125 # Below this point are development snapshots that were used to
119 # release some plugin, before an official release of the Orthanc 126 # release some plugin, before an official release of the Orthanc
120 # framework was available. Here is the command to be used to 127 # framework was available. Here is the command to be used to
121 # generate a proper archive: 128 # generate a proper archive:
126 # DICOMweb 1.1 (framework pre-1.6.0) 133 # DICOMweb 1.1 (framework pre-1.6.0)
127 set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645") 134 set(ORTHANC_FRAMEWORK_MD5 "7e09e9b530a2f527854f0b782d7e0645")
128 endif() 135 endif()
129 endif() 136 endif()
130 endif() 137 endif()
131 else() 138
139 elseif (NOT ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
132 message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.") 140 message("Using the Orthanc framework from a path of the filesystem. Assuming mainline version.")
133 set(ORTHANC_FRAMEWORK_MAJOR 999) 141 set(ORTHANC_FRAMEWORK_MAJOR 999)
134 set(ORTHANC_FRAMEWORK_MINOR 999) 142 set(ORTHANC_FRAMEWORK_MINOR 999)
135 set(ORTHANC_FRAMEWORK_REVISION 999) 143 set(ORTHANC_FRAMEWORK_REVISION 999)
136 endif() 144 endif()
363 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}") 371 if (NOT IS_DIRECTORY "${ORTHANC_ROOT}")
364 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.") 372 message(FATAL_ERROR "The Orthanc framework was not uncompressed at the proper location. Check the CMake instructions.")
365 endif() 373 endif()
366 endif() 374 endif()
367 endif() 375 endif()
376
377
378
379 ##
380 ## Case of the Orthanc framework installed as a shared library in a
381 ## GNU/Linux distribution (typically Debian)
382 ##
383
384 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
385 set(ORTHANC_FRAMEWORK_LIBDIR "" CACHE PATH "")
386
387 if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND
388 CMAKE_COMPILER_IS_GNUCXX) # MinGW
389 set(DYNAMIC_MINGW_STDLIB ON) # Disable static linking against libc (to throw exceptions)
390 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libstdc++")
391 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
392 endif()
393
394 include(CheckIncludeFile)
395 include(CheckIncludeFileCXX)
396 include(FindPythonInterp)
397 include(${CMAKE_CURRENT_LIST_DIR}/Compiler.cmake)
398 include(${CMAKE_CURRENT_LIST_DIR}/DownloadPackage.cmake)
399 include(${CMAKE_CURRENT_LIST_DIR}/AutoGeneratedCode.cmake)
400 set(EMBED_RESOURCES_PYTHON ${CMAKE_CURRENT_LIST_DIR}/EmbedResources.py)
401
402 if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND
403 NOT ORTHANC_FRAMEWORK_STATIC)
404 # Look for mandatory dependency JsonCpp (cf. JsonCppConfiguration.cmake)
405 find_path(JSONCPP_INCLUDE_DIR json/reader.h
406 /usr/include/jsoncpp
407 /usr/local/include/jsoncpp
408 )
409
410 message("JsonCpp include dir: ${JSONCPP_INCLUDE_DIR}")
411 include_directories(${JSONCPP_INCLUDE_DIR})
412 link_libraries(jsoncpp)
413
414 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
415 if (NOT HAVE_JSONCPP_H)
416 message(FATAL_ERROR "Please install the libjsoncpp-dev package")
417 endif()
418
419 # Look for mandatory dependency Boost (cf. BoostConfiguration.cmake)
420 include(FindBoost)
421 find_package(Boost COMPONENTS filesystem thread system date_time regex)
422
423 if (NOT Boost_FOUND)
424 message(FATAL_ERROR "Unable to locate Boost on this system")
425 endif()
426
427 include_directories(${Boost_INCLUDE_DIRS})
428 link_libraries(${Boost_LIBRARIES})
429
430 # Optional component - Lua
431 if (ENABLE_LUA)
432 include(FindLua)
433
434 if (NOT LUA_FOUND)
435 message(FATAL_ERROR "Please install the liblua-dev package")
436 endif()
437
438 include_directories(${LUA_INCLUDE_DIR})
439 link_libraries(${LUA_LIBRARIES})
440 endif()
441
442 # Optional component - SQLite
443 if (ENABLE_SQLITE)
444 CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H)
445 if (NOT HAVE_SQLITE_H)
446 message(FATAL_ERROR "Please install the libsqlite3-dev package")
447 endif()
448 link_libraries(sqlite3)
449 endif()
450 endif()
451
452 # Optional component - Google Test
453 if (ENABLE_GOOGLE_TEST)
454 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
455 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
456 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
457 include(${CMAKE_CURRENT_LIST_DIR}/GoogleTestConfiguration.cmake)
458 endif()
459
460 # Look for Orthanc framework shared library
461 include(CheckCXXSymbolExists)
462
463 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
464 set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT})
465 include_directories(${ORTHANC_FRAMEWORK_ROOT}/..)
466 else()
467 find_path(ORTHANC_FRAMEWORK_INCLUDE_DIR OrthancFramework.h
468 /usr/include/orthanc-framework
469 /usr/local/include/orthanc-framework
470 ${ORTHANC_FRAMEWORK_ROOT}
471 )
472 endif()
473
474 message("Orthanc framework include dir: ${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
475 include_directories(${ORTHANC_FRAMEWORK_INCLUDE_DIR})
476
477 set(CMAKE_REQUIRED_INCLUDES "${ORTHANC_FRAMEWORK_INCLUDE_DIR}")
478
479 if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
480 set(CMAKE_REQUIRED_LIBRARIES "-L${ORTHANC_FRAMEWORK_LIBDIR} -lOrthancFramework")
481 else()
482 set(CMAKE_REQUIRED_LIBRARIES "OrthancFramework")
483 endif()
484
485 check_cxx_symbol_exists("Orthanc::InitializeFramework" "OrthancFramework.h" HAVE_ORTHANC_FRAMEWORK)
486 if(NOT HAVE_ORTHANC_FRAMEWORK)
487 message(FATAL_ERROR "Cannot find the Orthanc framework")
488 endif()
489
490 if (NOT "${ORTHANC_FRAMEWORK_ROOT}" STREQUAL "")
491 include_directories(${ORTHANC_FRAMEWORK_ROOT})
492 endif()
493
494 if (NOT "${ORTHANC_FRAMEWORK_LIBDIR}" STREQUAL "")
495 link_directories(${ORTHANC_FRAMEWORK_LIBDIR})
496 endif()
497 endif()