comparison Aws/CMakeLists.txt @ 59:f3c44d61e1e1

AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Jun 2021 09:22:22 +0200
parents ba1be668e475
children 5fed32546d27 0de1f4e14c1e 39707bf9f1f2 dee640a31111 80792bb9600e
comparison
equal deleted inserted replaced
58:37185ec1cf49 59:f3c44d61e1e1
19 19
20 project(OrthancAwsS3Storage) 20 project(OrthancAwsS3Storage)
21 21
22 set(PLUGIN_VERSION "mainline") 22 set(PLUGIN_VERSION "mainline")
23 23
24 if (PLUGIN_VERSION STREQUAL "mainline")
25 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
26 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
27 else()
28 set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.3")
29 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
30 endif()
31
32 set(STATIC_BUILD OFF CACHE BOOL "Static build of the third-party libraries (necessary for Windows)")
33 set(ALLOW_DOWNLOADS ON CACHE BOOL "Allow CMake to download packages")
34 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"system\", \"hg\", \"archive\", \"web\" or \"path\")")
35 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_FRAMEWORK_DEFAULT_VERSION}" CACHE STRING "Version of the Orthanc framework")
36 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
37 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
38
39 set(USE_VCPKG_PACKAGES ON CACHE BOOL "Use Microsoft vcpkg to link against crypto++ and AWS SDK")
40 set(USE_SYSTEM_CRYPTOPP ON CACHE BOOL "Use the system version of crypto++")
41
24 include(CheckIncludeFileCXX) 42 include(CheckIncludeFileCXX)
25 43
26 set(ORTHANC_FRAMEWORK_SOURCE "hg" CACHE STRING "orthanc source") 44 # Download and setup the Orthanc framework
27 set(ORTHANC_FRAMEWORK_VERSION "1.9.2" CACHE STRING "orthanc framework version") 45 include(${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake)
28 set(USE_VCPKG_PACKAGES ON CACHE BOOL "Use Microsoft vcpkg to link against crypto++ and AWS SDK")
29 set(STATIC_AWS_CLIENT ON CACHE BOOL "Statically link against AWS client library (only if USE_VCPKG_PACKAGES=OFF)")
30 set(USE_SYSTEM_CRYPTOPP ON CACHE BOOL "Use the system version of crypto++")
31 46
32 # Download and setup the Orthanc framework 47 if (ORTHANC_FRAMEWORK_SOURCE STREQUAL "system")
33 set(ALLOW_DOWNLOADS ON) 48 if (ORTHANC_FRAMEWORK_USE_SHARED)
34 include(${CMAKE_SOURCE_DIR}/../Common/Resources/DownloadOrthancFramework.cmake) 49 include(FindBoost)
50 find_package(Boost COMPONENTS filesystem thread)
51
52 if (NOT Boost_FOUND)
53 message(FATAL_ERROR "Unable to locate Boost on this system")
54 endif()
55
56 include(FindOpenSSL)
57 if (NOT OPENSSL_FOUND)
58 message(FATAL_ERROR "Unable to find OpenSSL")
59 endif()
35 60
36 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) 61 include(FindCURL)
62 if (NOT CURL_FOUND)
63 message(FATAL_ERROR "Unable to find LibCurl")
64 endif()
37 65
38 set(ENABLE_CRYPTO_OPTIONS ON) 66 link_libraries(${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} jsoncpp)
39 set(ENABLE_GOOGLE_TEST ON) 67 endif()
40 set(ENABLE_MODULE_DICOM OFF)
41 set(ENABLE_MODULE_IMAGES OFF)
42 set(ENABLE_MODULE_JOBS OFF)
43 set(ENABLE_WEB_CLIENT ON) # Access options related to curl
44 set(ORTHANC_FRAMEWORK_PLUGIN ON)
45 68
46 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) 69 link_libraries(${ORTHANC_FRAMEWORK_LIBRARIES})
47 include(${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake) 70
71 set(USE_SYSTEM_GOOGLE_TEST ON CACHE BOOL "Use the system version of Google Test")
72 set(USE_GOOGLE_TEST_DEBIAN_PACKAGE OFF CACHE BOOL "Use the sources of Google Test shipped with libgtest-dev (Debian only)")
73 mark_as_advanced(USE_GOOGLE_TEST_DEBIAN_PACKAGE)
74 include(${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/CMake/GoogleTestConfiguration.cmake)
75
76 else()
77 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
78
79 set(ENABLE_CRYPTO_OPTIONS ON)
80 set(ENABLE_GOOGLE_TEST ON)
81 set(ENABLE_MODULE_DICOM OFF)
82 set(ENABLE_MODULE_IMAGES OFF)
83 set(ENABLE_MODULE_JOBS OFF)
84 set(ENABLE_WEB_CLIENT ON) # Access options related to curl
85 set(ORTHANC_FRAMEWORK_PLUGIN ON)
86
87 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
88
89 include_directories(
90 ${ORTHANC_FRAMEWORK_ROOT}
91 )
92 endif()
93
94
95 include(${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/Plugins/OrthancPluginsExports.cmake)
48 96
49 97
50 add_definitions( 98 add_definitions(
51 -DHAS_ORTHANC_EXCEPTION=1 99 -DHAS_ORTHANC_EXCEPTION=1
52 -DORTHANC_ENABLE_LOGGING=1 100 -DORTHANC_ENABLE_LOGGING=1
53 -DAWS_STORAGE_PLUGIN=1 101 -DAWS_STORAGE_PLUGIN=1
54 -DPLUGIN_VERSION="${PLUGIN_VERSION}" 102 -DPLUGIN_VERSION="${PLUGIN_VERSION}"
55 ) 103 )
56 104
57 include_directories( 105 include_directories(
58 ${ORTHANC_FRAMEWORK_ROOT} 106 ${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/Plugins/
59 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Include 107 ${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/Sdk-1.9.2/
60 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common
61 ) 108 )
62 109
63 110
64 if (NOT STATIC_BUILD AND USE_VCPKG_PACKAGES) 111 if (NOT STATIC_BUILD AND USE_VCPKG_PACKAGES)
65 # Use vcpkg by Microsoft 112 # Use vcpkg by Microsoft
80 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp 127 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp
81 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp 128 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp
82 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h 129 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h
83 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp 130 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp
84 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h 131 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h
85 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp 132 ${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/Plugins/OrthancPluginCppWrapper.cpp
86 133
87 ${AWS_SOURCES} 134 ${AWS_SOURCES}
88 ${CRYPTOPP_SOURCES} 135 ${CRYPTOPP_SOURCES}
89 ${ORTHANC_CORE_SOURCES} 136 ${ORTHANC_CORE_SOURCES}
90 ) 137 )