comparison OrthancStone/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake @ 1869:da224ae2a994

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Jan 2022 10:57:00 +0100
parents 0830db74be6b
children 7053b8a0aaec
comparison
equal deleted inserted replaced
1868:87de32ac3ea7 1869:da224ae2a994
1 # Orthanc - A Lightweight, RESTful DICOM Store 1 # Orthanc - A Lightweight, RESTful DICOM Store
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3 # Department, University Hospital of Liege, Belgium 3 # Department, University Hospital of Liege, Belgium
4 # Copyright (C) 2017-2021 Osimis S.A., Belgium 4 # Copyright (C) 2017-2021 Osimis S.A., Belgium
5 # Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
5 # 6 #
6 # This program is free software: you can redistribute it and/or 7 # This program is free software: you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public License 8 # modify it under the terms of the GNU Lesser General Public License
8 # as published by the Free Software Foundation, either version 3 of 9 # as published by the Free Software Foundation, either version 3 of
9 # the License, or (at your option) any later version. 10 # the License, or (at your option) any later version.
69 string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION}) 70 string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION})
70 71
71 if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR 72 if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR
72 NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR 73 NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR
73 NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$") 74 NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$")
74 message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}") 75 message("Bad version of the Orthanc framework, assuming a pre-release: ${ORTHANC_FRAMEWORK_VERSION}")
76 set(ORTHANC_FRAMEWORK_MAJOR 999)
77 set(ORTHANC_FRAMEWORK_MINOR 999)
78 set(ORTHANC_FRAMEWORK_REVISION 999)
75 endif() 79 endif()
76 80
77 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1") 81 if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1")
78 set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378") 82 set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378")
79 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2") 83 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2")
156 # PostgreSQL 3.3 (framework pre-1.8.2) 160 # PostgreSQL 3.3 (framework pre-1.8.2)
157 set(ORTHANC_FRAMEWORK_MD5 "2d82bddf06f9cfe82095495cb3b8abde") 161 set(ORTHANC_FRAMEWORK_MD5 "2d82bddf06f9cfe82095495cb3b8abde")
158 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "23ad1b9c7800") 162 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "23ad1b9c7800")
159 # For "Toolbox::ReadJson()" and "Toolbox::Write{...}Json()" (pre-1.9.0) 163 # For "Toolbox::ReadJson()" and "Toolbox::Write{...}Json()" (pre-1.9.0)
160 set(ORTHANC_FRAMEWORK_MD5 "9af92080e57c60dd288eba46ce606c00") 164 set(ORTHANC_FRAMEWORK_MD5 "9af92080e57c60dd288eba46ce606c00")
165 elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "b2e08d83e21d")
166 # WSI 1.1 (framework pre-1.9.8), to remove "-std=c++11"
167 set(ORTHANC_FRAMEWORK_MD5 "2eaa073cbb4b44ffba199ad93393b2b1")
161 endif() 168 endif()
162 endif() 169 endif()
163 endif() 170 endif()
164 171
165 elseif (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path") 172 elseif (ORTHANC_FRAMEWORK_SOURCE STREQUAL "path")
498 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H) 505 CHECK_INCLUDE_FILE_CXX(${JSONCPP_INCLUDE_DIR}/json/reader.h HAVE_JSONCPP_H)
499 if (NOT HAVE_JSONCPP_H) 506 if (NOT HAVE_JSONCPP_H)
500 message(FATAL_ERROR "Please install the libjsoncpp-dev package") 507 message(FATAL_ERROR "Please install the libjsoncpp-dev package")
501 endif() 508 endif()
502 509
503 # Switch to the C++11 standard if the version of JsonCpp is 1.y.z
504 # (same as variable JSONCPP_CXX11 in the source code of Orthanc)
505 if (EXISTS ${JSONCPP_INCLUDE_DIR}/json/version.h)
506 file(STRINGS
507 "${JSONCPP_INCLUDE_DIR}/json/version.h"
508 JSONCPP_VERSION_MAJOR1 REGEX
509 ".*define JSONCPP_VERSION_MAJOR.*")
510
511 if (NOT JSONCPP_VERSION_MAJOR1)
512 message(FATAL_ERROR "Unable to extract the major version of JsonCpp")
513 endif()
514
515 string(REGEX REPLACE
516 ".*JSONCPP_VERSION_MAJOR.*([0-9]+)$" "\\1"
517 JSONCPP_VERSION_MAJOR ${JSONCPP_VERSION_MAJOR1})
518 message("JsonCpp major version: ${JSONCPP_VERSION_MAJOR}")
519
520 if (JSONCPP_VERSION_MAJOR GREATER 0)
521 message("Switching to C++11 standard, as version of JsonCpp is >= 1.0.0")
522 if (CMAKE_COMPILER_IS_GNUCXX)
523 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
524 elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
525 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
526 endif()
527 endif()
528 else()
529 message("Unable to detect the major version of JsonCpp, assuming < 1.0.0")
530 endif()
531
532 # Look for Orthanc framework shared library 510 # Look for Orthanc framework shared library
533 include(CheckCXXSymbolExists) 511 include(CheckCXXSymbolExists)
534 512
535 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") 513 if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
536 set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT}) 514 set(ORTHANC_FRAMEWORK_INCLUDE_DIR ${ORTHANC_FRAMEWORK_ROOT})