comparison Azure/CMakeLists.txt @ 1:fc26a8fc54d5

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