Mercurial > hg > orthanc-object-storage
annotate Azure/CMakeLists.txt @ 131:9520a6d10992
added install step in CMake
author | Alain Mazy <am@osimis.io> |
---|---|
date | Wed, 29 Nov 2023 09:42:26 +0100 |
parents | 17f350ab12ca |
children | 573585bcc9ff |
rev | line source |
---|---|
56
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
1 # Cloud storage plugins for Orthanc |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
2 # Copyright (C) 2020-2021 Osimis S.A., Belgium |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
3 # |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
4 # This program is free software: you can redistribute it and/or |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
5 # modify it under the terms of the GNU Affero General Public License |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
6 # as published by the Free Software Foundation, either version 3 of |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
7 # the License, or (at your option) any later version. |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
8 # |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
9 # This program is distributed in the hope that it will be useful, but |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
10 # WITHOUT ANY WARRANTY; without even the implied warranty of |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
12 # Affero General Public License for more details. |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
13 # |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
14 # You should have received a copy of the GNU Affero General Public License |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
16 |
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
52
diff
changeset
|
17 |
109
2549eecdc996
updated minimum cmake version for Azure & Google
Alain Mazy <am@osimis.io>
parents:
108
diff
changeset
|
18 cmake_minimum_required(VERSION 3.3) |
1 | 19 |
20 project(OrthancAzureBlobStorage) | |
21 | |
122 | 22 set(PLUGIN_VERSION "mainline") |
1 | 23 |
129 | 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 "mainline") # TODO: update to web - 1.12.2 when available | |
29 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg") | |
30 endif() | |
1 | 31 |
129 | 32 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc framework (can be \"system\", \"hg\", \"archive\", \"web\" or \"path\")") |
33 set(ORTHANC_FRAMEWORK_VERSION "${ORTHANC_FRAMEWORK_DEFAULT_VERSION}" CACHE STRING "Version of the Orthanc framework") | |
34 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") | |
35 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") | |
120
12ea59c97c40
sync orthanc folder + show timings + EnableAwsSdkLogs
Alain Mazy <am@osimis.io>
parents:
115
diff
changeset
|
36 set(ALLOW_DOWNLOADS ON) |
1 | 37 |
129 | 38 include(CheckIncludeFileCXX) |
39 | |
1 | 40 # Download and setup the Orthanc framework |
41 | |
59
f3c44d61e1e1
AWS S3: Support of dynamic linking against the system-wide Orthanc framework library
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
42 include(${CMAKE_SOURCE_DIR}/../Common/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake) |
15 | 43 include(${ORTHANC_FRAMEWORK_ROOT}/../Resources/CMake/OrthancFrameworkParameters.cmake) |
1 | 44 |
45 set(ENABLE_GOOGLE_TEST ON) | |
46 set(ORTHANC_FRAMEWORK_PLUGIN ON) | |
22
319d41a22de4
more lightweight use of Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
18
diff
changeset
|
47 set(ENABLE_MODULE_IMAGES OFF) |
319d41a22de4
more lightweight use of Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
18
diff
changeset
|
48 set(ENABLE_MODULE_JOBS OFF) |
319d41a22de4
more lightweight use of Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
18
diff
changeset
|
49 set(ENABLE_MODULE_DICOM OFF) |
1 | 50 |
15 | 51 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
|
52 include(${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginsExports.cmake) |
1 | 53 |
54 add_definitions( | |
55 -DHAS_ORTHANC_EXCEPTION=1 | |
15 | 56 -DORTHANC_ENABLE_LOGGING=1 |
1 | 57 -DAZURE_STORAGE_PLUGIN=1 |
58 ) | |
59 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}") | |
60 | |
61 include_directories( | |
15 | 62 ${ORTHANC_FRAMEWORK_ROOT} |
63 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Include | |
64 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common | |
1 | 65 ) |
66 | |
67 find_package(cryptopp CONFIG REQUIRED) | |
68 | |
69 # Azure stuff (from https://github.com/Microsoft/vcpkg/issues/6277) | |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
70 find_package(azure-storage-blobs-cpp CONFIG REQUIRED) |
1 | 71 |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
72 # if (NOT WIN32) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
73 # find_package(cpprestsdk CONFIG REQUIRED) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
74 # find_path(WASTORAGE_INCLUDE_DIR was/blob.h) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
75 # find_library(WASTORAGE_LIBRARY azurestorage) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
76 # find_package(Boost REQUIRED COMPONENTS log) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
77 # find_library(UUID_LIBRARY uuid) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
78 # find_package(LibXml2 REQUIRED) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
79 # else() # inspired from https://github.com/phongcao/azure-storage-cpp-sas-sample/blob/master/CMakeLists.txt |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
80 # find_path(WASTORAGE_INCLUDE_DIR was/blob.h) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
81 # find_library(CPPREST_LIBRARY |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
82 # NAMES cpprest cpprest_2_10) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
83 # find_library(WASTORAGE_LIBRARY wastorage) |
34 | 84 |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
85 # set (CMAKE_CXX_STANDARD 11) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
86 # set (CMAKE_CXX_STANDARD_REQUIRED ON) |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
87 # set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa") |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
88 # set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
89 # set (CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF") |
89 | 90 |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
91 # message(INFO "WASTORAGE_INCLUDE_DIR ${WASTORAGE_INCLUDE_DIR}") |
34 | 92 |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
93 # add_definitions(-D_NO_WASTORAGE_API=1) # from https://github.com/Azure/azure-storage-cpp/issues/263 |
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
94 # endif() |
34 | 95 |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
96 # include_directories(${WASTORAGE_INCLUDE_DIR}) |
101
57be7094d6c5
updated Google plugin for latest SDK
Alain Mazy <am@osimis.io>
parents:
100
diff
changeset
|
97 set(CMAKE_CXX_STANDARD 14) |
1 | 98 |
99 set(COMMON_SOURCES | |
78 | 100 ${CMAKE_SOURCE_DIR}/../Common/IStorage.h |
101 ${CMAKE_SOURCE_DIR}/../Common/BaseStorage.h | |
102 ${CMAKE_SOURCE_DIR}/../Common/BaseStorage.cpp | |
1 | 103 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp |
104 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h | |
105 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp | |
106 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h | |
78 | 107 ${CMAKE_SOURCE_DIR}/../Common/FileSystemStorage.h |
108 ${CMAKE_SOURCE_DIR}/../Common/FileSystemStorage.cpp | |
83
431ab61b5760
/move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents:
78
diff
changeset
|
109 ${CMAKE_SOURCE_DIR}/../Common/MoveStorageJob.h |
431ab61b5760
/move-storage when HybridMode is enabled
Alain Mazy <am@osimis.io>
parents:
78
diff
changeset
|
110 ${CMAKE_SOURCE_DIR}/../Common/MoveStorageJob.cpp |
15 | 111 ${ORTHANC_FRAMEWORK_ROOT}/../../OrthancServer/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp |
1 | 112 |
113 ${ORTHANC_CORE_SOURCES} | |
114 ) | |
115 | |
116 add_library(OrthancAzureBlobStorage SHARED | |
117 AzureBlobStoragePlugin.cpp | |
118 AzureBlobStoragePlugin.h | |
119 ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp | |
120 | |
121 ${COMMON_SOURCES} | |
122 ) | |
123 | |
130
17f350ab12ca
conditional usage of DefineSourceBasenameForTarget
Alain Mazy <am@osimis.io>
parents:
129
diff
changeset
|
124 if (DEFINED DefineSourceBasenameForTarget) |
17f350ab12ca
conditional usage of DefineSourceBasenameForTarget
Alain Mazy <am@osimis.io>
parents:
129
diff
changeset
|
125 DefineSourceBasenameForTarget(OrthancAzureBlobStorage) |
17f350ab12ca
conditional usage of DefineSourceBasenameForTarget
Alain Mazy <am@osimis.io>
parents:
129
diff
changeset
|
126 endif() |
105 | 127 |
1 | 128 set_target_properties(OrthancAzureBlobStorage PROPERTIES |
129 VERSION ${PLUGIN_VERSION} | |
130 SOVERSION ${PLUGIN_VERSION} | |
131 ) | |
132 | |
34 | 133 if (NOT WIN32) |
134 | |
135 target_link_libraries(OrthancAzureBlobStorage | |
136 PRIVATE | |
91
7bf31db5497e
fix cryptopp lib name for Linux build
Alain Mazy <am@osimis.io>
parents:
89
diff
changeset
|
137 cryptopp::cryptopp |
100 | 138 Azure::azure-storage-blobs |
34 | 139 ${UUID_LIBRARY} |
140 ${LIBXML2_LIBRARIES} | |
141 ) | |
142 else() | |
143 target_link_libraries(OrthancAzureBlobStorage | |
144 PRIVATE | |
100 | 145 cryptopp::cryptopp |
99
f4e05641c108
rewrote using the latest azure C++ sdk
Alain Mazy <am@osimis.io>
parents:
91
diff
changeset
|
146 Azure::azure-storage-blobs |
34 | 147 ${OPENSSL_LIBRARY} |
148 Winhttp.lib | |
149 Crypt32.lib | |
150 xmllite.lib | |
1 | 151 ) |
152 | |
34 | 153 endif() |
1 | 154 |
131 | 155 install( |
156 TARGETS OrthancAzureBlobStorage | |
157 RUNTIME DESTINATION lib # Destination for Windows | |
158 LIBRARY DESTINATION share/orthanc/plugins # Destination for Linux | |
159 ) | |
160 | |
1 | 161 |
34 | 162 # add_executable(UnitTests |
163 # ${GOOGLE_TEST_SOURCES} | |
164 # ${COMMON_SOURCES} | |
165 | |
166 # ${CMAKE_SOURCE_DIR}/../UnitTestsSources/EncryptionTests.cpp | |
167 # ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp | |
168 # ) | |
1 | 169 |
34 | 170 # target_link_libraries(UnitTests |
171 # PRIVATE | |
172 # cryptopp-static | |
173 # ${GOOGLE_TEST_LIBRARIES} | |
174 # ${WASTORAGE_LIBRARY} | |
175 # # ${UUID_LIBRARY} | |
176 # # ${Boost_LIBRARIES} | |
177 # # ${LIBXML2_LIBRARIES} | |
178 # cpprestsdk::cpprest | |
179 # ) |