1
|
1 cmake_minimum_required(VERSION 2.8)
|
|
2
|
|
3 project(OrthancAzureBlobStorage)
|
|
4
|
3
|
5 set(PLUGIN_VERSION "0.9.0")
|
1
|
6 include(CheckIncludeFileCXX)
|
|
7
|
|
8 set(ORTHANC_FRAMEWORK_SOURCE "hg" CACHE STRING "orthanc source")
|
|
9 set(ORTHANC_FRAMEWORK_VERSION "1.7.0" CACHE STRING "orthanc framework version")
|
|
10 set(ALLOW_DOWNLOADS ON)
|
|
11
|
|
12 # Download and setup the Orthanc framework
|
|
13 include(${CMAKE_SOURCE_DIR}/../Common/Resources/DownloadOrthancFramework.cmake)
|
|
14
|
|
15 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkParameters.cmake)
|
|
16
|
|
17 set(ENABLE_GOOGLE_TEST ON)
|
|
18 set(ORTHANC_FRAMEWORK_PLUGIN ON)
|
|
19
|
|
20 include(${ORTHANC_ROOT}/Resources/CMake/OrthancFrameworkConfiguration.cmake)
|
|
21
|
|
22
|
|
23 add_definitions(
|
|
24 -DHAS_ORTHANC_EXCEPTION=1
|
|
25 -DORTHANC_ENABLE_LOGGING_PLUGIN=1
|
|
26 -DAZURE_STORAGE_PLUGIN=1
|
|
27 )
|
|
28 add_definitions(-DPLUGIN_VERSION="${PLUGIN_VERSION}")
|
|
29
|
|
30 include_directories(
|
|
31 ${ORTHANC_ROOT}
|
|
32 ${ORTHANC_ROOT}/Core
|
|
33 ${ORTHANC_ROOT}/Plugins/Include
|
|
34 ${ORTHANC_ROOT}/Plugins/Samples/Common
|
|
35 )
|
|
36
|
|
37
|
|
38 find_package(cryptopp CONFIG REQUIRED)
|
|
39
|
|
40 # Azure stuff (from https://github.com/Microsoft/vcpkg/issues/6277)
|
|
41 find_package(cpprestsdk CONFIG REQUIRED)
|
|
42 find_path(WASTORAGE_INCLUDE_DIR was/blob.h)
|
|
43 find_library(WASTORAGE_LIBRARY azurestorage)
|
|
44 find_package(Boost REQUIRED COMPONENTS log)
|
|
45 find_library(UUID_LIBRARY uuid)
|
|
46 find_package(LibXml2 REQUIRED)
|
|
47
|
|
48 include_directories(${WASTORAGE_INCLUDE_DIR})
|
|
49
|
|
50 set(COMMON_SOURCES
|
|
51 ${CMAKE_SOURCE_DIR}/../Common/IStoragePlugin.h
|
|
52 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.cpp
|
|
53 ${CMAKE_SOURCE_DIR}/../Common/EncryptionHelpers.h
|
|
54 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.cpp
|
|
55 ${CMAKE_SOURCE_DIR}/../Common/EncryptionConfigurator.h
|
|
56 ${ORTHANC_ROOT}/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp
|
|
57
|
|
58 ${ORTHANC_CORE_SOURCES}
|
|
59 )
|
|
60
|
|
61 add_library(OrthancAzureBlobStorage SHARED
|
|
62 AzureBlobStoragePlugin.cpp
|
|
63 AzureBlobStoragePlugin.h
|
|
64 ${CMAKE_SOURCE_DIR}/../Common/StoragePlugin.cpp
|
|
65
|
|
66 ${COMMON_SOURCES}
|
|
67 )
|
|
68
|
|
69 set_target_properties(OrthancAzureBlobStorage PROPERTIES
|
|
70 VERSION ${PLUGIN_VERSION}
|
|
71 SOVERSION ${PLUGIN_VERSION}
|
|
72 )
|
|
73
|
|
74 target_link_libraries(OrthancAzureBlobStorage
|
|
75 PRIVATE
|
|
76 cryptopp-static
|
|
77 ${WASTORAGE_LIBRARY} ${UUID_LIBRARY} ${Boost_LIBRARIES} ${LIBXML2_LIBRARIES} cpprestsdk::cpprest
|
|
78 )
|
|
79
|
|
80
|
|
81
|
|
82 add_executable(UnitTests
|
|
83 ${GOOGLE_TEST_SOURCES}
|
|
84 ${COMMON_SOURCES}
|
|
85
|
|
86 ${CMAKE_SOURCE_DIR}/../UnitTestsSources/EncryptionTests.cpp
|
|
87 ${CMAKE_SOURCE_DIR}/../UnitTestsSources/UnitTestsMain.cpp
|
|
88 )
|
|
89
|
|
90 target_link_libraries(UnitTests
|
|
91 PRIVATE
|
|
92 cryptopp-static
|
|
93 ${GOOGLE_TEST_LIBRARIES}
|
|
94 ${WASTORAGE_LIBRARY} ${UUID_LIBRARY} ${Boost_LIBRARIES} ${LIBXML2_LIBRARIES} cpprestsdk::cpprest
|
|
95 )
|