|
| 1 | +# Copyright (c) Microsoft Corporation. |
| 2 | +# Licensed under the MIT License. |
| 3 | + |
| 4 | +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") |
| 5 | +include(AzureVcpkg) |
| 6 | +az_vcpkg_integrate() |
| 7 | + |
| 8 | +cmake_minimum_required (VERSION 3.13) |
| 9 | +project(azure-data-tables LANGUAGES CXX) |
| 10 | + |
| 11 | +set(CMAKE_CXX_STANDARD 14) |
| 12 | +set(CMAKE_CXX_STANDARD_REQUIRED True) |
| 13 | +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) |
| 14 | + |
| 15 | +option(FETCH_SOURCE_DEPS "build source dependencies" OFF) |
| 16 | + |
| 17 | +include(AzureVersion) |
| 18 | +include(AzureCodeCoverage) |
| 19 | +include(AzureTransportAdapters) |
| 20 | +include(AzureDoxygen) |
| 21 | +include(AzureGlobalCompileOptions) |
| 22 | +include(AzureConfigRTTI) |
| 23 | +include(AzureBuildTargetForCI) |
| 24 | +include(CreateMapFile) |
| 25 | + |
| 26 | +if(FETCH_SOURCE_DEPS) |
| 27 | + set(AZ_ALL_LIBRARIES ON) |
| 28 | + include(FolderList) |
| 29 | + SetCompileOptions(DATA_TABLES) |
| 30 | + GetFolderList(DATA_TABLES) |
| 31 | + foreach(oneFolder IN LISTS BUILD_FOLDERS) |
| 32 | + message("add folder ${oneFolder}") |
| 33 | + add_subdirectory(${oneFolder} EXCLUDE_FROM_ALL) |
| 34 | + endforeach() |
| 35 | +elseif(NOT AZ_ALL_LIBRARIES) |
| 36 | + find_package(azure-core-cpp CONFIG QUIET) |
| 37 | + if(NOT azure-core-cpp_FOUND) |
| 38 | + find_package(azure-core-cpp REQUIRED) |
| 39 | + endif() |
| 40 | +endif() |
| 41 | + |
| 42 | +set( |
| 43 | + AZURE_DATA_TABLES_HEADER |
| 44 | + inc/azure/data/tables/account_sas_builder.hpp |
| 45 | + inc/azure/data/tables/dll_import_export.hpp |
| 46 | + inc/azure/data/tables/internal/cryptography/hmacsha256.hpp |
| 47 | + inc/azure/data/tables/internal/cryptography/url_encode.hpp |
| 48 | + inc/azure/data/tables/internal/policies/service_version_policy.hpp |
| 49 | + inc/azure/data/tables/internal/policies/shared_key_lite_policy.hpp |
| 50 | + inc/azure/data/tables/internal/policies/shared_key_policy.hpp |
| 51 | + inc/azure/data/tables/internal/policies/switch_to_secondary_policy.hpp |
| 52 | + inc/azure/data/tables/internal/policies/tenant_bearer_token_policy.hpp |
| 53 | + inc/azure/data/tables/internal/policies/timeout_policy.hpp |
| 54 | + inc/azure/data/tables/internal/serializers.hpp |
| 55 | + inc/azure/data/tables/internal/xml_wrapper.hpp |
| 56 | + inc/azure/data/tables/models.hpp |
| 57 | + inc/azure/data/tables/rtti.hpp |
| 58 | + inc/azure/data/tables.hpp |
| 59 | + inc/azure/data/tables/tables_clients.hpp |
| 60 | + inc/azure/data/tables/transactions.hpp |
| 61 | + inc/azure/data/tables/credentials/shared_key_credential.hpp |
| 62 | +) |
| 63 | + |
| 64 | +set( |
| 65 | + AZURE_DATA_TABLES_SOURCE |
| 66 | + src/account_sas_builder.cpp |
| 67 | + src/credentials/shared_key_credential.cpp |
| 68 | + src/cryptography/hmacsha256.cpp |
| 69 | + src/policies/shared_key_lite_policy.cpp |
| 70 | + src/policies/shared_key_policy.cpp |
| 71 | + src/policies/switch_to_secondary_policy.cpp |
| 72 | + src/policies/tenant_bearer_token_policy.cpp |
| 73 | + src/policies/timeout_policy.cpp |
| 74 | + src/private/package_version.hpp |
| 75 | + src/serializers.cpp |
| 76 | + src/tables_clients.cpp |
| 77 | + src/transactions.cpp |
| 78 | + src/xml_wrapper.cpp |
| 79 | +) |
| 80 | + |
| 81 | +add_library(azure-data-tables ${AZURE_DATA_TABLES_HEADER} ${AZURE_DATA_TABLES_SOURCE}) |
| 82 | +create_per_service_target_build(tables azure-data-tables) |
| 83 | +# make sure that users can consume the project as a library. |
| 84 | +add_library(Azure::azure-data-tables ALIAS azure-data-tables) |
| 85 | + |
| 86 | +if(WIN32) |
| 87 | + target_link_libraries(azure-data-tables PRIVATE bcrypt webservices crypt32) |
| 88 | +else() |
| 89 | + # Required for Hashing (sha ). |
| 90 | + find_package(OpenSSL REQUIRED) |
| 91 | + target_link_libraries(azure-data-tables PRIVATE OpenSSL::SSL) |
| 92 | + find_package(LibXml2 REQUIRED) |
| 93 | + target_include_directories(azure-data-tables SYSTEM PRIVATE ${LIBXML2_INCLUDE_DIRS}) |
| 94 | + target_link_libraries(azure-data-tables PRIVATE ${LIBXML2_LIBRARIES}) |
| 95 | +endif() |
| 96 | + |
| 97 | +target_include_directories( |
| 98 | + azure-data-tables |
| 99 | + PUBLIC |
| 100 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc> |
| 101 | + $<INSTALL_INTERFACE:include> |
| 102 | +) |
| 103 | + |
| 104 | +target_link_libraries(azure-data-tables PUBLIC Azure::azure-core) |
| 105 | + |
| 106 | +get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") |
| 107 | +generate_documentation(azure-data-tables ${AZ_LIBRARY_VERSION}) |
| 108 | + |
| 109 | +az_vcpkg_export( |
| 110 | + azure-data-tables |
| 111 | + DATA_TABLES |
| 112 | + azure/data/tables/dll_import_export.hpp |
| 113 | + ) |
| 114 | + |
| 115 | +az_rtti_setup( |
| 116 | + azure-data-tables |
| 117 | + DATA_TABLES |
| 118 | + azure/data/tables/rtti.hpp |
| 119 | +) |
| 120 | + |
| 121 | +# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF |
| 122 | +create_code_coverage(tables azure-data-tables azure-data-tables-test "tests?/*;samples?/*") |
| 123 | + |
| 124 | +if(BUILD_TESTING) |
| 125 | + add_subdirectory(test/ut) |
| 126 | + add_subdirectory(test/stress) |
| 127 | +endif() |
| 128 | + |
| 129 | +if(BUILD_SAMPLES) |
| 130 | + add_subdirectory(samples) |
| 131 | +endif() |
0 commit comments