Mercurial > hg > orthanc-object-storage
comparison Aws/CMakeLists.txt @ 26:471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 07 Sep 2020 16:00:59 +0200 |
parents | 319d41a22de4 |
children | 318c1442d9bd |
comparison
equal
deleted
inserted
replaced
25:b0b7eb7cff73 | 26:471eaf5c5d39 |
---|---|
8 | 8 |
9 include(CheckIncludeFileCXX) | 9 include(CheckIncludeFileCXX) |
10 | 10 |
11 set(ORTHANC_FRAMEWORK_SOURCE "hg" CACHE STRING "orthanc source") | 11 set(ORTHANC_FRAMEWORK_SOURCE "hg" CACHE STRING "orthanc source") |
12 set(ORTHANC_FRAMEWORK_VERSION "1.7.3" CACHE STRING "orthanc framework version") | 12 set(ORTHANC_FRAMEWORK_VERSION "1.7.3" CACHE STRING "orthanc framework version") |
13 set(USE_VCPKG_PACKAGES ON CACHE BOOL "Use vcpkg to link against crypto++ and AWS SDK") | |
13 set(ALLOW_DOWNLOADS ON) | 14 set(ALLOW_DOWNLOADS ON) |
14 | 15 |
15 # Download and setup the Orthanc framework | 16 # Download and setup the Orthanc framework |
16 include(${CMAKE_SOURCE_DIR}/../Common/Resources/DownloadOrthancFramework.cmake) | 17 include(${CMAKE_SOURCE_DIR}/../Common/Resources/DownloadOrthancFramework.cmake) |
17 | 18 |
39 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Include | 40 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Include |
40 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common | 41 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common |
41 ) | 42 ) |
42 | 43 |
43 | 44 |
44 find_package(cryptopp CONFIG REQUIRED) | 45 if (USE_VCPKG_PACKAGES) |
45 find_package(AWSSDK REQUIRED COMPONENTS s3) | 46 find_package(cryptopp CONFIG REQUIRED) |
47 find_package(AWSSDK REQUIRED COMPONENTS s3) | |
48 include_directories(${WASTORAGE_INCLUDE_DIR}) | |
49 set(CRYPTOPP_LIBRARIES cryptopp-static) | |
50 else() | |
51 ## | |
52 ## Inclusion of system-wide crypto++ | |
53 ## | |
54 check_include_file_cxx(cryptopp/cryptlib.h HAVE_CRYPTOPP_H) | |
55 if (NOT HAVE_CRYPTOPP_H) | |
56 message(FATAL_ERROR "Please install the libcrypto++-dev package") | |
57 endif() | |
46 | 58 |
47 include_directories(${WASTORAGE_INCLUDE_DIR}) | 59 include(CheckCXXSymbolExists) |
60 set(CMAKE_REQUIRED_LIBRARIES cryptopp) | |
61 check_cxx_symbol_exists("CryptoPP::SHA1::InitState" cryptopp/sha.h HAVE_LIBCRYPTOPP) | |
62 if (NOT HAVE_LIBCRYPTOPP) | |
63 message(FATAL_ERROR "Unable to find the cryptopp library") | |
64 endif() | |
65 | |
66 set(CRYPTOPP_LIBRARIES cryptopp) | |
67 | |
68 ## | |
69 ## Building the C++ SDK for Amazon AWS | |
70 ## WARNING: This is *not* compatible with Ninja (yet) | |
71 ## | |
72 include(ExternalProject) | |
73 externalproject_add(AwsSdkCpp | |
74 GIT_REPOSITORY https://github.com/aws/aws-sdk-cpp | |
75 GIT_TAG 1.8.42 | |
76 | |
77 CMAKE_ARGS | |
78 -DBUILD_ONLY=s3 #-DBUILD_ONLY=s3;transfer | |
79 -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | |
80 -DENABLE_TESTING=OFF | |
81 | |
82 UPDATE_COMMAND "" # Don't run "cmake" on AWS each time "make/ninja" is run | |
83 INSTALL_COMMAND "" # No install | |
84 ) | |
85 | |
86 ExternalProject_Get_Property(AwsSdkCpp SOURCE_DIR) | |
87 include_directories( | |
88 ${SOURCE_DIR}/aws-cpp-sdk-core/include/ | |
89 ${SOURCE_DIR}/aws-cpp-sdk-s3/include/ | |
90 ) | |
91 | |
92 ExternalProject_Get_Property(AwsSdkCpp BINARY_DIR) | |
93 set(AWSSDK_LINK_LIBRARIES | |
94 ${BINARY_DIR}/aws-cpp-sdk-core/libaws-cpp-sdk-core.so | |
95 ${BINARY_DIR}/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so | |
96 ) | |
97 endif() | |
98 | |
48 | 99 |
49 set(COMMON_SOURCES | 100 set(COMMON_SOURCES |
50 ${CMAKE_SOURCE_DIR}/../Common/IStoragePlugin.h | 101 ${CMAKE_SOURCE_DIR}/../Common/IStoragePlugin.h |
51 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.h | 102 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.h |
52 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp | 103 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp |
63 AwsS3StoragePlugin.cpp | 114 AwsS3StoragePlugin.cpp |
64 AwsS3StoragePlugin.h | 115 AwsS3StoragePlugin.h |
65 ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp | 116 ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp |
66 | 117 |
67 ${COMMON_SOURCES} | 118 ${COMMON_SOURCES} |
68 ) | 119 ) |
69 | 120 |
70 set_target_properties(OrthancAwsS3Storage PROPERTIES | 121 set_target_properties(OrthancAwsS3Storage PROPERTIES |
71 VERSION ${PLUGIN_VERSION} | 122 VERSION ${PLUGIN_VERSION} |
72 SOVERSION ${PLUGIN_VERSION} | 123 SOVERSION ${PLUGIN_VERSION} |
73 ) | 124 ) |
74 | 125 |
75 target_link_libraries(OrthancAwsS3Storage | 126 target_link_libraries(OrthancAwsS3Storage |
76 PRIVATE | 127 PRIVATE |
77 cryptopp-static | 128 ${CRYPTOPP_LIBRARIES} |
78 ${AWSSDK_LINK_LIBRARIES} | 129 ${AWSSDK_LINK_LIBRARIES} |
79 ) | 130 ) |
80 | 131 |
81 | 132 |
82 | 133 |
88 ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp | 139 ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp |
89 ) | 140 ) |
90 | 141 |
91 target_link_libraries(UnitTests | 142 target_link_libraries(UnitTests |
92 PRIVATE | 143 PRIVATE |
93 cryptopp-static | |
94 ${GOOGLE_TEST_LIBRARIES} | 144 ${GOOGLE_TEST_LIBRARIES} |
145 ${CRYPTOPP_LIBRARIES} | |
95 ${AWSSDK_LINK_LIBRARIES} | 146 ${AWSSDK_LINK_LIBRARIES} |
96 ) | 147 ) |
148 | |
149 | |
150 if (NOT USE_VCPKG_PACKAGES) | |
151 add_dependencies(OrthancAwsS3Storage AwsSdkCpp) | |
152 add_dependencies(UnitTests AwsSdkCpp) | |
153 endif() |