Mercurial > hg > orthanc-object-storage
annotate 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 |
rev | line source |
---|---|
1 | 1 cmake_minimum_required(VERSION 2.8) |
2 | |
3 option(BUILD_SHARED_LIBS "Build shared libraries" ON) | |
4 | |
5 project(OrthancAwsS3Storage) | |
6 | |
2 | 7 set(PLUGIN_VERSION "mainline") |
1 | 8 |
9 include(CheckIncludeFileCXX) | |
10 | |
11 set(ORTHANC_FRAMEWORK_SOURCE "hg" CACHE STRING "orthanc source") | |
15 | 12 set(ORTHANC_FRAMEWORK_VERSION "1.7.3" CACHE STRING "orthanc framework version") |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
13 set(USE_VCPKG_PACKAGES ON CACHE BOOL "Use vcpkg to link against crypto++ and AWS SDK") |
1 | 14 set(ALLOW_DOWNLOADS ON) |
15 | |
16 # Download and setup the Orthanc framework | |
17 include(${CMAKE_SOURCE_DIR}/../Common/Resources/DownloadOrthancFramework.cmake) | |
18 | |
15 | 19 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) |
1 | 20 |
21 set(ENABLE_GOOGLE_TEST ON) | |
22 set(ORTHANC_FRAMEWORK_PLUGIN ON) | |
22
319d41a22de4
more lightweight use of Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
18
diff
changeset
|
23 set(ENABLE_MODULE_IMAGES OFF) |
319d41a22de4
more lightweight use of Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
18
diff
changeset
|
24 set(ENABLE_MODULE_JOBS OFF) |
319d41a22de4
more lightweight use of Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
18
diff
changeset
|
25 set(ENABLE_MODULE_DICOM OFF) |
1 | 26 |
15 | 27 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake) |
18
44de9edf2443
fix compilation to avoid exposing internal symbols which caused a crash at Orthanc startup
Alain Mazy
parents:
15
diff
changeset
|
28 include(${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake) |
1 | 29 |
30 | |
31 add_definitions( | |
32 -DHAS_ORTHANC_EXCEPTION=1 | |
15 | 33 -DORTHANC_ENABLE_LOGGING=1 |
1 | 34 -DAWS_STORAGE_PLUGIN=1 |
35 ) | |
36 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}") | |
37 | |
38 include_directories( | |
15 | 39 ${ORTHANC_FRAMEWORK_ROOT} |
40 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Include | |
41 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common | |
1 | 42 ) |
43 | |
44 | |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
45 if (USE_VCPKG_PACKAGES) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
46 find_package(cryptopp CONFIG REQUIRED) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
47 find_package(AWSSDK REQUIRED COMPONENTS s3) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
48 include_directories(${WASTORAGE_INCLUDE_DIR}) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
49 set(CRYPTOPP_LIBRARIES cryptopp-static) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
50 else() |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
51 ## |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
52 ## Inclusion of system-wide crypto++ |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
53 ## |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
54 check_include_file_cxx(cryptopp/cryptlib.h HAVE_CRYPTOPP_H) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
55 if (NOT HAVE_CRYPTOPP_H) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
56 message(FATAL_ERROR "Please install the libcrypto++-dev package") |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
57 endif() |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
58 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
59 include(CheckCXXSymbolExists) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
60 set(CMAKE_REQUIRED_LIBRARIES cryptopp) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
61 check_cxx_symbol_exists("CryptoPP::SHA1::InitState" cryptopp/sha.h HAVE_LIBCRYPTOPP) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
62 if (NOT HAVE_LIBCRYPTOPP) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
63 message(FATAL_ERROR "Unable to find the cryptopp library") |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
64 endif() |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
65 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
66 set(CRYPTOPP_LIBRARIES cryptopp) |
1 | 67 |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
68 ## |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
69 ## Building the C++ SDK for Amazon AWS |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
70 ## WARNING: This is *not* compatible with Ninja (yet) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
71 ## |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
72 include(ExternalProject) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
73 externalproject_add(AwsSdkCpp |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
74 GIT_REPOSITORY https://github.com/aws/aws-sdk-cpp |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
75 GIT_TAG 1.8.42 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
76 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
77 CMAKE_ARGS |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
78 -DBUILD_ONLY=s3 #-DBUILD_ONLY=s3;transfer |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
79 -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
80 -DENABLE_TESTING=OFF |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
81 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
82 UPDATE_COMMAND "" # Don't run "cmake" on AWS each time "make/ninja" is run |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
83 INSTALL_COMMAND "" # No install |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
84 ) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
85 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
86 ExternalProject_Get_Property(AwsSdkCpp SOURCE_DIR) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
87 include_directories( |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
88 ${SOURCE_DIR}/aws-cpp-sdk-core/include/ |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
89 ${SOURCE_DIR}/aws-cpp-sdk-s3/include/ |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
90 ) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
91 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
92 ExternalProject_Get_Property(AwsSdkCpp BINARY_DIR) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
93 set(AWSSDK_LINK_LIBRARIES |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
94 ${BINARY_DIR}/aws-cpp-sdk-core/libaws-cpp-sdk-core.so |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
95 ${BINARY_DIR}/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
96 ) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
97 endif() |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
98 |
1 | 99 |
100 set(COMMON_SOURCES | |
101 ${CMAKE_SOURCE_DIR}/../Common/IStoragePlugin.h | |
15 | 102 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.h |
103 ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp | |
1 | 104 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp |
105 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h | |
106 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp | |
107 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h | |
15 | 108 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp |
1 | 109 |
110 ${ORTHANC_CORE_SOURCES} | |
111 ) | |
112 | |
113 add_library(OrthancAwsS3Storage SHARED | |
114 AwsS3StoragePlugin.cpp | |
115 AwsS3StoragePlugin.h | |
116 ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp | |
117 | |
118 ${COMMON_SOURCES} | |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
119 ) |
1 | 120 |
121 set_target_properties(OrthancAwsS3Storage PROPERTIES | |
122 VERSION ${PLUGIN_VERSION} | |
123 SOVERSION ${PLUGIN_VERSION} | |
124 ) | |
125 | |
126 target_link_libraries(OrthancAwsS3Storage | |
127 PRIVATE | |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
128 ${CRYPTOPP_LIBRARIES} |
1 | 129 ${AWSSDK_LINK_LIBRARIES} |
130 ) | |
131 | |
132 | |
133 | |
134 add_executable(UnitTests | |
135 ${GOOGLE_TEST_SOURCES} | |
136 ${COMMON_SOURCES} | |
137 | |
138 ${CMAKE_SOURCE_DIR}/../UnitTestsSources/EncryptionTests.cpp | |
139 ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp | |
140 ) | |
141 | |
142 target_link_libraries(UnitTests | |
143 PRIVATE | |
144 ${GOOGLE_TEST_LIBRARIES} | |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
145 ${CRYPTOPP_LIBRARIES} |
1 | 146 ${AWSSDK_LINK_LIBRARIES} |
147 ) | |
26
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
148 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
149 |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
150 if (NOT USE_VCPKG_PACKAGES) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
151 add_dependencies(OrthancAwsS3Storage AwsSdkCpp) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
152 add_dependencies(UnitTests AwsSdkCpp) |
471eaf5c5d39
USE_VCPKG_PACKAGES to avoid using vcpkg
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
22
diff
changeset
|
153 endif() |