changeset 56:b922ae86bbe1

full static linking against AWS SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 22 Jun 2021 15:00:36 +0200
parents 9d03e24dafc1
children ba1be668e475
files Aws/AwsStaticConfiguration.cmake Aws/CMakeLists.txt Aws/Graveyard/AwsExternalProject.cmake Azure/AzureBlobStoragePlugin.cpp Azure/AzureBlobStoragePlugin.h Azure/CMakeLists.txt Common/BaseStoragePlugin.cpp Common/BaseStoragePlugin.h Common/EncryptionConfigurator.cpp Common/EncryptionHelpers.cpp Common/EncryptionHelpers.h Common/IStoragePlugin.h Common/StoragePlugin.cpp Google/CMakeLists.txt Google/GoogleStoragePlugin.cpp Google/GoogleStoragePlugin.h NEWS UnitTestsSources/EncryptionTests.cpp UnitTestsSources/UnitTestsGcsClient.cpp UnitTestsSources/UnitTestsMain.cpp
diffstat 20 files changed, 404 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Aws/AwsStaticConfiguration.cmake	Tue Jun 22 15:00:36 2021 +0200
@@ -0,0 +1,183 @@
+# Cloud storage plugins for Orthanc
+# Copyright (C) 2020-2021 Osimis S.A., Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+SET(AWS_C_COMMON_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-common-0.6.2)
+SET(AWS_C_COMMON_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-common-0.6.2.tar.gz")
+SET(AWS_C_COMMON_MD5 "aa6dc4bde2d035ad84ec40e3ea1e2bff")
+DownloadPackage(${AWS_C_COMMON_MD5} ${AWS_C_COMMON_URL} "${AWS_C_COMMON_SOURCES_DIR}")
+
+SET(AWS_CHECKSUMS_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-checksums-0.1.11)
+SET(AWS_CHECKSUMS_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-checksums-0.1.11.tar.gz")
+SET(AWS_CHECKSUMS_MD5 "4ec8e8065d0d3cd53c86e16692e79dcb")
+DownloadPackage(${AWS_CHECKSUMS_MD5} ${AWS_CHECKSUMS_URL} "${AWS_CHECKSUMS_SOURCES_DIR}")
+
+SET(AWS_C_AUTH_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-auth-0.6.0)
+SET(AWS_C_AUTH_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-auth-0.6.0.tar.gz")
+SET(AWS_C_AUTH_MD5 "e82d991dbd1c1acee210d4ac1fd518dc")
+DownloadPackage(${AWS_C_AUTH_MD5} ${AWS_C_AUTH_URL} "${AWS_C_AUTH_SOURCES_DIR}")
+
+SET(AWS_C_CAL_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-cal-0.5.11)
+SET(AWS_C_CAL_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-cal-0.5.11.tar.gz")
+SET(AWS_C_CAL_MD5 "2099fc945a02feda56b8ecd1ea77acf9")
+DownloadPackage(${AWS_C_CAL_MD5} ${AWS_C_CAL_URL} "${AWS_C_CAL_SOURCES_DIR}")
+
+SET(AWS_C_COMPRESSION_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-compression-0.2.13)
+SET(AWS_C_COMPRESSION_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-compression-0.2.13.tar.gz")
+SET(AWS_C_COMPRESSION_MD5 "e96ed91a832116a05a60e49e9946623e")
+DownloadPackage(${AWS_C_COMPRESSION_MD5} ${AWS_C_COMPRESSION_URL} "${AWS_C_COMPRESSION_SOURCES_DIR}")
+
+SET(AWS_C_EVENT_STREAM_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-event-stream-0.2.7)
+SET(AWS_C_EVENT_STREAM_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-event-stream-0.2.7.tar.gz")
+SET(AWS_C_EVENT_STREAM_MD5 "5cf71f97962e22c4bc7fd75b9a8daf49")
+DownloadPackage(${AWS_C_EVENT_STREAM_MD5} ${AWS_C_EVENT_STREAM_URL} "${AWS_C_EVENT_STREAM_SOURCES_DIR}")
+
+SET(AWS_C_HTTP_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-http-0.6.4)
+SET(AWS_C_HTTP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-http-0.6.4.tar.gz")
+SET(AWS_C_HTTP_MD5 "7ac847811ff27f1671b31514e3493913")
+DownloadPackage(${AWS_C_HTTP_MD5} ${AWS_C_HTTP_URL} "${AWS_C_HTTP_SOURCES_DIR}")
+
+SET(AWS_C_IO_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-io-0.10.5)
+SET(AWS_C_IO_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-io-0.10.5.tar.gz")
+SET(AWS_C_IO_MD5 "2a450a918184aaf7e80afc80b515397b")
+DownloadPackage(${AWS_C_IO_MD5} ${AWS_C_IO_URL} "${AWS_C_IO_SOURCES_DIR}")
+
+SET(AWS_C_MQTT_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-mqtt-0.7.6)
+SET(AWS_C_MQTT_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-mqtt-0.7.6.tar.gz")
+SET(AWS_C_MQTT_MD5 "29aca202d29b9934f630a204f6731031")
+DownloadPackage(${AWS_C_MQTT_MD5} ${AWS_C_MQTT_URL} "${AWS_C_MQTT_SOURCES_DIR}")
+
+SET(AWS_C_S3_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-s3-0.1.19)
+SET(AWS_C_S3_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-c-s3-0.1.19.tar.gz")
+SET(AWS_C_S3_MD5 "ae5e98f70075fd40093af856b72a04fb")
+DownloadPackage(${AWS_C_S3_MD5} ${AWS_C_S3_URL} "${AWS_C_S3_SOURCES_DIR}")
+
+SET(AWS_CRT_CPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-crt-cpp-0.14.0)
+SET(AWS_CRT_CPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-crt-cpp-0.14.0.tar.gz")
+SET(AWS_CRT_CPP_MD5 "4298ab05b95380f960c7b0184df5c078")
+DownloadPackage(${AWS_CRT_CPP_MD5} ${AWS_CRT_CPP_URL} "${AWS_CRT_CPP_SOURCES_DIR}")
+
+SET(AWS_SDK_CPP_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-sdk-cpp-1.9.45)
+SET(AWS_SDK_CPP_URL "http://orthanc.osimis.io/ThirdPartyDownloads/aws/aws-sdk-cpp-1.9.45.tar.gz")
+SET(AWS_SDK_CPP_MD5 "f2f2d48b119fda2ef17d2604c0cca52e")
+DownloadPackage(${AWS_SDK_CPP_MD5} ${AWS_SDK_CPP_URL} "${AWS_SDK_CPP_SOURCES_DIR}")
+
+
+configure_file(
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/include/aws/core/SDKConfig.h.in
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/include/aws/core/SDKConfig.h
+  )
+
+configure_file(
+  ${AWS_C_COMMON_SOURCES_DIR}/include/aws/common/config.h.in
+  ${AWS_C_COMMON_SOURCES_DIR}/include/aws/common/config.h
+  )
+
+
+include_directories(
+  ${AWS_C_COMMON_SOURCES_DIR}/include/
+  ${AWS_C_AUTH_SOURCES_DIR}/include/
+  ${AWS_C_CAL_SOURCES_DIR}/include/
+  ${AWS_C_COMPRESSION_SOURCES_DIR}/include/
+  ${AWS_C_IO_SOURCES_DIR}/include/
+  ${AWS_C_HTTP_SOURCES_DIR}/include/
+  ${AWS_C_MQTT_SOURCES_DIR}/include/
+  ${AWS_C_S3_SOURCES_DIR}/include/
+  ${AWS_C_EVENT_STREAM_SOURCES_DIR}/include/
+  ${AWS_CHECKSUMS_SOURCES_DIR}/include/
+  ${AWS_CRT_CPP_SOURCES_DIR}/include/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/include/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-s3/include/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-connect/include/
+  )
+
+
+list(APPEND AWS_SOURCES_SUBDIRS
+  ${AWS_C_COMMON_SOURCES_DIR}/source/
+
+  ## C libraries
+  
+  ${AWS_CHECKSUMS_SOURCES_DIR}/source/
+  ${AWS_C_AUTH_SOURCES_DIR}/source/
+  ${AWS_C_CAL_SOURCES_DIR}/source/
+  ${AWS_C_COMPRESSION_SOURCES_DIR}/source/
+  ${AWS_C_EVENT_STREAM_SOURCES_DIR}/source/
+  ${AWS_C_HTTP_SOURCES_DIR}/source/
+  ${AWS_C_IO_SOURCES_DIR}/source/
+  ${AWS_C_MQTT_SOURCES_DIR}/source/
+  ${AWS_C_S3_SOURCES_DIR}/source/
+
+  ## C++ libraries
+  
+  ${AWS_CRT_CPP_SOURCES_DIR}/source/
+  ${AWS_CRT_CPP_SOURCES_DIR}/source/auth/
+  ${AWS_CRT_CPP_SOURCES_DIR}/source/crypto/
+  ${AWS_CRT_CPP_SOURCES_DIR}/source/http/
+  ${AWS_CRT_CPP_SOURCES_DIR}/source/io/
+  ${AWS_CRT_CPP_SOURCES_DIR}/source/external/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-connect/source/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-connect/source/model/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/auth/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/client/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/config/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/external/cjson/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/external/tinyxml2/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/http/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/http/standard/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/internal/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/monitoring/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/net/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/base64/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/crypto/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/crypto/factory/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/event/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/json/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/logging/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/memory/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/stream/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/threading/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/utils/xml/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-s3/source/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-s3/source/model/
+  )
+
+
+add_definitions(
+  -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_PTHREAD_ATTR
+  -DBYO_CRYPTO  # To have "aws_tls_server_ctx_new()" defined
+  )
+
+list(APPEND AWS_SOURCES_SUBDIRS
+  #${AWS_C_CAL_SOURCES_DIR}/source/unix/
+  #${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/net/linux-shared/
+  ${AWS_C_COMMON_SOURCES_DIR}/source/posix/
+  ${AWS_C_IO_SOURCES_DIR}/source/linux/
+  ${AWS_C_IO_SOURCES_DIR}/source/posix/
+  ${AWS_SDK_CPP_SOURCES_DIR}/aws-cpp-sdk-core/source/platform/linux-shared/
+  )
+
+
+foreach(d ${AWS_SOURCES_SUBDIRS})
+  aux_source_directory(${d} AWS_SOURCES)
+endforeach()
+
+
+list(APPEND AWS_SOURCES
+  ${AWS_C_COMMON_SOURCES_DIR}/source/arch/generic/cpuid.c
+  ${AWS_CHECKSUMS_SOURCES_DIR}/source/generic/crc32c_null.c
+  )
--- a/Aws/CMakeLists.txt	Fri May 21 11:36:58 2021 +0200
+++ b/Aws/CMakeLists.txt	Tue Jun 22 15:00:36 2021 +0200
@@ -1,6 +1,21 @@
-cmake_minimum_required(VERSION 2.8)
+# Cloud storage plugins for Orthanc
+# Copyright (C) 2020-2021 Osimis S.A., Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
 
-option(BUILD_SHARED_LIBS "Build shared libraries" ON)
+
+cmake_minimum_required(VERSION 2.8)
 
 project(OrthancAwsS3Storage)
 
@@ -20,23 +35,24 @@
 
 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake)
 
-set(ENABLE_WEB_CLIENT ON)  # Access options related to curl
+set(ENABLE_CRYPTO_OPTIONS ON)
 set(ENABLE_GOOGLE_TEST ON)
-set(ORTHANC_FRAMEWORK_PLUGIN ON)
+set(ENABLE_MODULE_DICOM OFF)
 set(ENABLE_MODULE_IMAGES OFF)
 set(ENABLE_MODULE_JOBS OFF)
-set(ENABLE_MODULE_DICOM OFF)
+# set(ENABLE_WEB_CLIENT ON)  # Access options related to curl
+set(ORTHANC_FRAMEWORK_PLUGIN ON)
 
 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkConfiguration.cmake)
 include(${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake)
 
 
 add_definitions(
-    -DHAS_ORTHANC_EXCEPTION=1
-    -DORTHANC_ENABLE_LOGGING=1
-    -DAWS_STORAGE_PLUGIN=1
-    )
-add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}")
+  -DHAS_ORTHANC_EXCEPTION=1
+  -DORTHANC_ENABLE_LOGGING=1
+  -DAWS_STORAGE_PLUGIN=1
+  -DPLUGIN_VERSION="${PLUGIN_VERSION}"
+  )
 
 include_directories(
   ${ORTHANC_FRAMEWORK_ROOT}
@@ -47,89 +63,39 @@
 
 if (NOT STATIC_BUILD AND USE_VCPKG_PACKAGES)
   # Use vcpkg by Microsoft
+  option(BUILD_SHARED_LIBS "Build shared libraries" ON)
   find_package(cryptopp CONFIG REQUIRED)
   find_package(AWSSDK REQUIRED COMPONENTS s3)
   set(CRYPTOPP_LIBRARIES cryptopp-static)
+  
 else()
   include(${CMAKE_SOURCE_DIR}/../Common/CryptoPPConfiguration.cmake)
-  
-  ##
-  ## Building the C++ SDK for Amazon AWS
-  ## WARNING: This is *not* compatible with Ninja (yet)
-  ##
-  if (STATIC_AWS_CLIENT)
-    set(Flags -DBUILD_SHARED_LIBS=OFF)  # Create static library
-  else()
-    set(Flags -DBUILD_SHARED_LIBS=ON)
-  endif()
-
-  include(ExternalProject)
-  externalproject_add(AwsSdkCpp
-    GIT_REPOSITORY https://github.com/aws/aws-sdk-cpp
-    GIT_TAG 1.8.127
-
-    CMAKE_ARGS
-    -DBUILD_ONLY=s3   #-DBUILD_ONLY=s3;transfer
-    -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-    -DENABLE_TESTING=OFF
-    ${Flags}
-
-    UPDATE_COMMAND ""    # Don't run "cmake" on AWS each time "make/ninja" is run
-    INSTALL_COMMAND ""   # No install
-    )
-
-  ExternalProject_Get_Property(AwsSdkCpp SOURCE_DIR)
-  include_directories(
-    ${SOURCE_DIR}/aws-cpp-sdk-core/include/
-    ${SOURCE_DIR}/aws-cpp-sdk-s3/include/
-    )
-
-  ExternalProject_Get_Property(AwsSdkCpp BINARY_DIR)
-  if (STATIC_AWS_CLIENT)
-    set(AWSSDK_LINK_LIBRARIES
-      ${BINARY_DIR}/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.a
-      ${BINARY_DIR}/aws-cpp-sdk-core/libaws-cpp-sdk-core.a
-      ${BINARY_DIR}/.deps/install/lib/libaws-c-event-stream.a
-      ${BINARY_DIR}/.deps/install/lib/libaws-checksums.a
-      ${BINARY_DIR}/.deps/install/lib/libaws-c-common.a
-      curl
-      crypto
-      )
-    if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-      list(APPEND AWSSDK_LINK_LIBRARIES
-        gcc   # for "undefined reference to `__cpu_model'" on Ubuntu 16.04
-        )
-    endif()
-  else()
-    set(AWSSDK_LINK_LIBRARIES
-      ${BINARY_DIR}/aws-cpp-sdk-core/libaws-cpp-sdk-core.so
-      ${BINARY_DIR}/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so
-      )
-  endif()
+  include(${CMAKE_SOURCE_DIR}/AwsStaticConfiguration.cmake)
 endif()
 
 
 set(COMMON_SOURCES
-    ${CMAKE_SOURCE_DIR}/../Common/IStoragePlugin.h
-    ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.h
-    ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp
-    ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp
-    ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h
-    ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp
-    ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h
-    ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
+  ${CMAKE_SOURCE_DIR}/../Common/IStoragePlugin.h
+  ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.h
+  ${CMAKE_SOURCE_DIR}/../Common/BaseStoragePlugin.cpp
+  ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp
+  ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h
+  ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp
+  ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h
+  ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
 
-    ${ORTHANC_CORE_SOURCES}
-    ${CRYPTOPP_SOURCES}
+  ${AWS_SOURCES}
+  ${CRYPTOPP_SOURCES}
+  ${ORTHANC_CORE_SOURCES}
   )
 
 add_library(OrthancAwsS3Storage SHARED
-    AwsS3StoragePlugin.cpp
-    AwsS3StoragePlugin.h
-    ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp
+  AwsS3StoragePlugin.cpp
+  AwsS3StoragePlugin.h
+  ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp
 
-    ${COMMON_SOURCES}
-    )
+  ${COMMON_SOURCES}
+  )
 
 set_target_properties(OrthancAwsS3Storage PROPERTIES
   VERSION ${PLUGIN_VERSION}
@@ -140,26 +106,25 @@
   PRIVATE
   ${CRYPTOPP_LIBRARIES}
   ${AWSSDK_LINK_LIBRARIES}
+  ${ORTHANC_FRAMEWORK_LIBRARIES}
   )
 
-
-
 add_executable(UnitTests
-    ${GOOGLE_TEST_SOURCES}
-    ${COMMON_SOURCES}
+  ${GOOGLE_TEST_SOURCES}
+  ${COMMON_SOURCES}
 
-    ${CMAKE_SOURCE_DIR}/../UnitTestsSources/EncryptionTests.cpp
-    ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp
-    )
+  ${CMAKE_SOURCE_DIR}/../UnitTestsSources/EncryptionTests.cpp
+  ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp
+  )
 
 target_link_libraries(UnitTests
   PRIVATE
   ${GOOGLE_TEST_LIBRARIES}
   ${CRYPTOPP_LIBRARIES}
   ${AWSSDK_LINK_LIBRARIES}
+  ${ORTHANC_FRAMEWORK_LIBRARIES}
   )
 
-
 if (STATIC_BUILD OR NOT USE_VCPKG_PACKAGES)
   add_dependencies(OrthancAwsS3Storage AwsSdkCpp)
   add_dependencies(UnitTests AwsSdkCpp)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Aws/Graveyard/AwsExternalProject.cmake	Tue Jun 22 15:00:36 2021 +0200
@@ -0,0 +1,70 @@
+# Cloud storage plugins for Orthanc
+# Copyright (C) 2020-2021 Osimis S.A., Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+##
+## Building the C++ SDK for Amazon AWS
+## WARNING: This is *not* compatible with Ninja (yet)
+##
+if (STATIC_AWS_CLIENT)
+  set(Flags -DBUILD_SHARED_LIBS=OFF)  # Create static library
+else()
+  set(Flags -DBUILD_SHARED_LIBS=ON)
+endif()
+
+include(ExternalProject)
+externalproject_add(AwsSdkCpp
+  GIT_REPOSITORY https://github.com/aws/aws-sdk-cpp
+  GIT_TAG 1.8.127
+
+  CMAKE_ARGS
+  -DBUILD_ONLY=s3   #-DBUILD_ONLY=s3;transfer
+  -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+  -DENABLE_TESTING=OFF
+  ${Flags}
+
+  UPDATE_COMMAND ""    # Don't run "cmake" on AWS each time "make/ninja" is run
+  INSTALL_COMMAND ""   # No install
+  )
+
+ExternalProject_Get_Property(AwsSdkCpp SOURCE_DIR)
+include_directories(
+  ${SOURCE_DIR}/aws-cpp-sdk-core/include/
+  ${SOURCE_DIR}/aws-cpp-sdk-s3/include/
+  )
+
+ExternalProject_Get_Property(AwsSdkCpp BINARY_DIR)
+if (STATIC_AWS_CLIENT)
+  set(AWSSDK_LINK_LIBRARIES
+    ${BINARY_DIR}/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.a
+    ${BINARY_DIR}/aws-cpp-sdk-core/libaws-cpp-sdk-core.a
+    ${BINARY_DIR}/.deps/install/lib/libaws-c-event-stream.a
+    ${BINARY_DIR}/.deps/install/lib/libaws-checksums.a
+    ${BINARY_DIR}/.deps/install/lib/libaws-c-common.a
+    curl
+    crypto
+    )
+  if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+    list(APPEND AWSSDK_LINK_LIBRARIES
+      gcc   # for "undefined reference to `__cpu_model'" on Ubuntu 16.04
+      )
+  endif()
+else()
+  set(AWSSDK_LINK_LIBRARIES
+    ${BINARY_DIR}/aws-cpp-sdk-core/libaws-cpp-sdk-core.so
+    ${BINARY_DIR}/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so
+    )
+endif()
--- a/Azure/AzureBlobStoragePlugin.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/Azure/AzureBlobStoragePlugin.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #include "AzureBlobStoragePlugin.h"
 
 #include <was/storage_account.h>
--- a/Azure/AzureBlobStoragePlugin.h	Fri May 21 11:36:58 2021 +0200
+++ b/Azure/AzureBlobStoragePlugin.h	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #pragma once
 
 #include "../Common/BaseStoragePlugin.h"
@@ -26,4 +27,3 @@
   static const char* GetStoragePluginName();
   static IStoragePlugin* CreateStoragePlugin(const OrthancPlugins::OrthancConfiguration& orthancConfig);
 };
-
--- a/Azure/CMakeLists.txt	Fri May 21 11:36:58 2021 +0200
+++ b/Azure/CMakeLists.txt	Tue Jun 22 15:00:36 2021 +0200
@@ -1,3 +1,20 @@
+# Cloud storage plugins for Orthanc
+# Copyright (C) 2020-2021 Osimis S.A., Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
 cmake_minimum_required(VERSION 2.8)
 
 project(OrthancAzureBlobStorage)
--- a/Common/BaseStoragePlugin.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/Common/BaseStoragePlugin.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -1,3 +1,22 @@
+/**
+ * Cloud storage plugins for Orthanc
+ * Copyright (C) 2020-2021 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
 #include "BaseStoragePlugin.h"
 #include <boost/filesystem/fstream.hpp>
 
--- a/Common/BaseStoragePlugin.h	Fri May 21 11:36:58 2021 +0200
+++ b/Common/BaseStoragePlugin.h	Tue Jun 22 15:00:36 2021 +0200
@@ -1,3 +1,22 @@
+/**
+ * Cloud storage plugins for Orthanc
+ * Copyright (C) 2020-2021 Osimis S.A., Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
 #pragma once
 
 #include "IStoragePlugin.h"
--- a/Common/EncryptionConfigurator.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/Common/EncryptionConfigurator.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -17,7 +17,6 @@
  **/
 
 
-
 #include <orthanc/OrthancCPlugin.h>
 #include <OrthancPluginCppWrapper.h>
 
--- a/Common/EncryptionHelpers.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/Common/EncryptionHelpers.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #include "EncryptionHelpers.h"
 #include <assert.h>
 
--- a/Common/EncryptionHelpers.h	Fri May 21 11:36:58 2021 +0200
+++ b/Common/EncryptionHelpers.h	Tue Jun 22 15:00:36 2021 +0200
@@ -15,6 +15,8 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
+
+
 #pragma once
 
 #include <memory.h>
--- a/Common/IStoragePlugin.h	Fri May 21 11:36:58 2021 +0200
+++ b/Common/IStoragePlugin.h	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #pragma once
 
 #include <orthanc/OrthancCPlugin.h>
--- a/Common/StoragePlugin.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/Common/StoragePlugin.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -16,17 +16,18 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #if GOOGLE_STORAGE_PLUGIN==1
-#include "../Google/GoogleStoragePlugin.h"
-#define StoragePluginFactory GoogleStoragePluginFactory
+#  include "../Google/GoogleStoragePlugin.h"
+#  define StoragePluginFactory GoogleStoragePluginFactory
 #elif AZURE_STORAGE_PLUGIN==1
-#include "../Azure/AzureBlobStoragePlugin.h"
-#define StoragePluginFactory AzureBlobStoragePluginFactory
+#  include "../Azure/AzureBlobStoragePlugin.h"
+#  define StoragePluginFactory AzureBlobStoragePluginFactory
 #elif AWS_STORAGE_PLUGIN==1
-#include "../Aws/AwsS3StoragePlugin.h"
-#define StoragePluginFactory AwsS3StoragePluginFactory
+#  include "../Aws/AwsS3StoragePlugin.h"
+#  define StoragePluginFactory AwsS3StoragePluginFactory
 #else
-#pragma message(error  "define a plugin")
+#  pragma message(error  "define a plugin")
 #endif
 
 #include <string.h>
--- a/Google/CMakeLists.txt	Fri May 21 11:36:58 2021 +0200
+++ b/Google/CMakeLists.txt	Tue Jun 22 15:00:36 2021 +0200
@@ -1,3 +1,20 @@
+# Cloud storage plugins for Orthanc
+# Copyright (C) 2020-2021 Osimis S.A., Belgium
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
 cmake_minimum_required(VERSION 2.8)
 
 project(OrthancGoogleCloudStorage)
--- a/Google/GoogleStoragePlugin.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/Google/GoogleStoragePlugin.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #include "GoogleStoragePlugin.h"
 
 #include "google/cloud/storage/client.h"
--- a/Google/GoogleStoragePlugin.h	Fri May 21 11:36:58 2021 +0200
+++ b/Google/GoogleStoragePlugin.h	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #pragma once
 
 #include "../Common/BaseStoragePlugin.h"
--- a/NEWS	Fri May 21 11:36:58 2021 +0200
+++ b/NEWS	Tue Jun 22 15:00:36 2021 +0200
@@ -5,6 +5,8 @@
   encrypted files with a previous version of the plugin and/or with a Orthanc 1.9.1 or 1.9.2, you might have to rename
   all your *.unk files into *.dcm.head files or your *dcm.head files into *.dcm.head files.
 * AWS S3: if no access & secret keys are provided, now getting the credentials from the default credentials manager
+* AWS S3: Full static linking is possible
+
 
 2021-04-26 - v 1.2.0
 ====================
@@ -26,6 +28,7 @@
 
 * Internal change: fix compilation to avoid exposing internal symbols which caused a crash at Orthanc startup
 
+
 2020-09-01 - v 1.0.0
 ====================
 
@@ -40,16 +43,19 @@
 
 * Azure: now removing spaces and CR at the end of the connectionString since it prevented the plugin to initialize.
 
+
 2020-07-20 - v 0.9.2
 ====================
 
 * Prevent Orthanc to start if plugin fails to start
 
+
 2020-07-15 - v 0.9.1
 ====================
 
 * AWS: added 3 configurations: Endpoint, ConnectionTimeout, RequestTimeout
 
+
 2020-07-03 - v 0.9.0
 ====================
 
--- a/UnitTestsSources/EncryptionTests.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/UnitTestsSources/EncryptionTests.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -15,6 +15,8 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
+
+
 #include "gtest/gtest.h"
 
 #include "../Common/EncryptionHelpers.h"
--- a/UnitTestsSources/UnitTestsGcsClient.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/UnitTestsSources/UnitTestsGcsClient.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -15,6 +15,8 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
+
+
 #include "gtest/gtest.h"
 #include <threads.h>
 #include <thread>
--- a/UnitTestsSources/UnitTestsMain.cpp	Fri May 21 11:36:58 2021 +0200
+++ b/UnitTestsSources/UnitTestsMain.cpp	Tue Jun 22 15:00:36 2021 +0200
@@ -16,6 +16,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  **/
 
+
 #include "gtest/gtest.h"
 
 int main(int argc, char **argv)