From 828bb4098a4b5dd41e4bd5057f9f35a24ce3d6b3 Mon Sep 17 00:00:00 2001 From: Anton Kolesnyk <41349689+antkmsft@users.noreply.github.com> Date: Wed, 9 Dec 2020 04:02:29 -0800 Subject: [PATCH] Make changes towards making libraries individually buildable (#1108) --- CMakeLists.txt | 2 +- cmake-modules/global_compile_options.cmake | 5 +- sdk/core/azure-core/CMakeLists.txt | 58 ++++++++++++++----- sdk/identity/azure-identity/CMakeLists.txt | 37 ++++++++---- sdk/storage/CMakeLists.txt | 4 -- .../azure-storage-blobs/CMakeLists.txt | 43 ++++++++++---- .../azure-storage-common/CMakeLists.txt | 38 +++++++----- .../CMakeLists.txt | 47 +++++++++++---- .../azure-storage-files-shares/CMakeLists.txt | 44 ++++++++++---- sdk/template/azure-template/CMakeLists.txt | 38 ++++++++---- .../azure-template/inc/azure/template.hpp | 7 +++ 11 files changed, 238 insertions(+), 85 deletions(-) create mode 100644 sdk/template/azure-template/inc/azure/template.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 10d359aac..401a6bfda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) endif() # Project definition -project(az LANGUAGES CXX) +project(azure-sdk LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/cmake-modules/global_compile_options.cmake b/cmake-modules/global_compile_options.cmake index 1845877dd..d86769775 100644 --- a/cmake-modules/global_compile_options.cmake +++ b/cmake-modules/global_compile_options.cmake @@ -25,4 +25,7 @@ else() endif() add_compile_options(-Wall -Wextra -pedantic ${WARNINGS_AS_ERRORS_FLAG}) -endif() \ No newline at end of file +endif() + +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +set(THREADS_PREFER_PTHREAD_FLAG TRUE) diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index fa0491ac2..9382e835c 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -2,14 +2,20 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) -set(azure-core) project(azure-core LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) +include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) -set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads REQUIRED) # min version for `CURLSSLOPT_NO_REVOKE` @@ -34,21 +40,44 @@ message("nlohmann json version ${nlohmann_json_VERSION}") if(BUILD_TRANSPORT_CURL) SET(CURL_TRANSPORT_ADAPTER_SRC src/http/curl/curl.cpp) + SET(CURL_TRANSPORT_ADAPTER_INC inc/azure/core/http/curl/curl.hpp) endif() if(BUILD_TRANSPORT_WINHTTP) SET(WIN_TRANSPORT_ADAPTER_SRC src/http/winhttp/win_http_transport.cpp) + SET(WIN_TRANSPORT_ADAPTER_INC inc/azure/core/http/winhttp/win_http_client.hpp) endif() -# CodeCoverage will validate requirements -include(CodeCoverage) +set( + AZURE_CORE_HEADER + ${CURL_TRANSPORT_ADAPTER_INC} + ${WIN_TRANSPORT_ADAPTER_INC} + inc/azure/core/http/body_stream.hpp + inc/azure/core/http/http.hpp + inc/azure/core/http/pipeline.hpp + inc/azure/core/http/policy.hpp + inc/azure/core/http/transport.hpp + inc/azure/core/internal/contract.hpp + inc/azure/core/internal/log.hpp + inc/azure/core/logging/logging.hpp + inc/azure/core/context.hpp + inc/azure/core/credentials.hpp + inc/azure/core/datetime.hpp + inc/azure/core/exception.hpp + inc/azure/core/nullable.hpp + inc/azure/core/platform.hpp + inc/azure/core/response.hpp + inc/azure/core/strings.hpp + inc/azure/core/uuid.hpp + inc/azure/core/version.hpp + inc/azure/core.hpp +) -add_library ( - azure-core - src/context.cpp - src/datetime.cpp +set( + AZURE_CORE_SOURCE + ${CURL_TRANSPORT_ADAPTER_SRC} + ${WIN_TRANSPORT_ADAPTER_SRC} src/http/bearer_token_authentication_policy.cpp src/http/body_stream.cpp - ${CURL_TRANSPORT_ADAPTER_SRC} src/http/http.cpp src/http/logging_policy.cpp src/http/policy.cpp @@ -58,12 +87,15 @@ add_library ( src/http/telemetry_policy.cpp src/http/transport_policy.cpp src/http/url.cpp - ${BUILD_WIN_TRANSPORT} src/logging/logging.cpp + src/context.cpp + src/datetime.cpp src/strings.cpp src/version.cpp ) +add_library(azure-core ${AZURE_CORE_HEADER} ${AZURE_CORE_SOURCE}) + target_include_directories( azure-core PUBLIC @@ -72,10 +104,10 @@ target_include_directories( ) # make sure that users can consume the project as a library. -add_library (Azure::Core ALIAS azure-core) +add_library(Azure::Core ALIAS azure-core) # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF -create_code_coverage(core azure-core azure-core-test) +create_code_coverage(core azure-core "azure-core-test") target_include_directories(azure-core PUBLIC ${CURL_INCLUDE_DIRS}) target_link_libraries(azure-core PRIVATE CURL::libcurl Threads::Threads) diff --git a/sdk/identity/azure-identity/CMakeLists.txt b/sdk/identity/azure-identity/CMakeLists.txt index 35befd047..63c1585de 100644 --- a/sdk/identity/azure-identity/CMakeLists.txt +++ b/sdk/identity/azure-identity/CMakeLists.txt @@ -1,33 +1,48 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # SPDX-License-Identifier: MIT -cmake_minimum_required (VERSION 3.12) +cmake_minimum_required (VERSION 3.13) +project(azure-identity LANGUAGES CXX) -set (AZURE_IDENTITY_HEADER +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) +include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) + +set( + AZURE_IDENTITY_HEADER inc/azure/identity/client_secret_credential.hpp inc/azure/identity/environment_credential.hpp inc/azure/identity/version.hpp + inc/azure/identity.hpp ) -set (AZURE_IDENTITY_SOURCE +set( + AZURE_IDENTITY_SOURCE src/client_secret_credential.cpp src/environment_credential.cpp src/version.cpp ) -# Uncomment once identity have tests -# CodeCoverage will validate requirements -# include(CodeCoverage) - add_library(azure-identity ${AZURE_IDENTITY_HEADER} ${AZURE_IDENTITY_SOURCE}) -target_include_directories(azure-identity PUBLIC inc) -target_link_libraries(azure-identity azure-core) + +# make sure that users can consume the project as a library. +add_library(azure::identity ALIAS azure-identity) # Uncomment once identity have tests # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF -# create_code_coverage(identity azure-identity "azure-identity-test") +# create_code_coverage(identity azure-identity azure-identity-test) -add_library(azure::identity ALIAS azure-identity) +target_include_directories(azure-identity PUBLIC inc) + +target_link_libraries(azure-identity PUBLIC azure-core) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/identity/version.hpp") generate_documentation(azure-identity ${AZ_LIBRARY_VERSION}) diff --git a/sdk/storage/CMakeLists.txt b/sdk/storage/CMakeLists.txt index 9df7b70d4..c6628928b 100644 --- a/sdk/storage/CMakeLists.txt +++ b/sdk/storage/CMakeLists.txt @@ -4,10 +4,6 @@ cmake_minimum_required (VERSION 3.13) project (azure-storage LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - option(BUILD_STORAGE_SAMPLES "Build storage sample codes" ON) if(BUILD_TESTING) diff --git a/sdk/storage/azure-storage-blobs/CMakeLists.txt b/sdk/storage/azure-storage-blobs/CMakeLists.txt index 09cc1c594..fd55e51ae 100644 --- a/sdk/storage/azure-storage-blobs/CMakeLists.txt +++ b/sdk/storage/azure-storage-blobs/CMakeLists.txt @@ -2,9 +2,23 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) +project(azure-storage-blobs LANGUAGES CXX) -set (AZURE_STORAGE_BLOB_HEADER - inc/azure/storage/blobs.hpp +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) +include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) + +set( + AZURE_STORAGE_BLOB_HEADER + inc/azure/storage/blobs/protocol/blob_rest_client.hpp inc/azure/storage/blobs/append_blob_client.hpp inc/azure/storage/blobs/blob_batch_client.hpp inc/azure/storage/blobs/blob_client.hpp @@ -15,11 +29,12 @@ set (AZURE_STORAGE_BLOB_HEADER inc/azure/storage/blobs/blob_service_client.hpp inc/azure/storage/blobs/block_blob_client.hpp inc/azure/storage/blobs/page_blob_client.hpp - inc/azure/storage/blobs/protocol/blob_rest_client.hpp inc/azure/storage/blobs/version.hpp + inc/azure/storage/blobs.hpp ) -set (AZURE_STORAGE_BLOB_SOURCE +set( + AZURE_STORAGE_BLOB_SOURCE src/append_blob_client.cpp src/blob_batch_client.cpp src/blob_client.cpp @@ -31,17 +46,16 @@ set (AZURE_STORAGE_BLOB_SOURCE ) add_library(azure-storage-blobs ${AZURE_STORAGE_BLOB_HEADER} ${AZURE_STORAGE_BLOB_SOURCE}) + +# make sure that users can consume the project as a library. +add_library(azure::storage::blobs ALIAS azure-storage-blobs) + target_include_directories(azure-storage-blobs PUBLIC inc) target_link_libraries(azure-storage-blobs azure::storage::common) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/storage/blobs/version.hpp") -add_library(azure::storage::blobs ALIAS azure-storage-blobs) - generate_documentation(azure-storage-blobs ${AZ_LIBRARY_VERSION}) -# CodeCoverage will validate requirements -include(CodeCoverage) - # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF create_code_coverage(storage azure-storage-blobs azure-storage-test) @@ -50,12 +64,16 @@ if(BUILD_TESTING) azure-storage-test PRIVATE test/append_blob_client_test.cpp + test/append_blob_client_test.hpp test/blob_batch_client_test.cpp test/blob_container_client_test.cpp + test/blob_container_client_test.hpp test/blob_sas_test.cpp test/blob_service_client_test.cpp test/block_blob_client_test.cpp + test/block_blob_client_test.hpp test/page_blob_client_test.cpp + test/page_blob_client_test.hpp test/storage_retry_policy_test.cpp ) @@ -63,6 +81,11 @@ if(BUILD_TESTING) endif() if(BUILD_STORAGE_SAMPLES) - target_sources(azure-storage-sample PRIVATE sample/blob_getting_started.cpp) + target_sources( + azure-storage-sample + PRIVATE + sample/blob_getting_started.cpp + ) + target_link_libraries(azure-storage-sample PRIVATE azure-storage-blobs) endif() diff --git a/sdk/storage/azure-storage-common/CMakeLists.txt b/sdk/storage/azure-storage-common/CMakeLists.txt index 96549ff02..88195da3e 100644 --- a/sdk/storage/azure-storage-common/CMakeLists.txt +++ b/sdk/storage/azure-storage-common/CMakeLists.txt @@ -2,8 +2,25 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) +project(azure-storage-common LANGUAGES CXX) -set(AZURE_STORAGE_COMMON_HEADER +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) +include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) + +find_package(Threads REQUIRED) +find_package(LibXml2 REQUIRED) + +set( + AZURE_STORAGE_COMMON_HEADER inc/azure/storage/common/access_conditions.hpp inc/azure/storage/common/account_sas_builder.hpp inc/azure/storage/common/concurrent_transfer.hpp @@ -21,7 +38,8 @@ set(AZURE_STORAGE_COMMON_HEADER inc/azure/storage/common/xml_wrapper.hpp ) -set(AZURE_STORAGE_COMMON_SOURCE +set( + AZURE_STORAGE_COMMON_SOURCE src/account_sas_builder.cpp src/crypt.cpp src/file_io.cpp @@ -37,13 +55,11 @@ set(AZURE_STORAGE_COMMON_SOURCE add_library(azure-storage-common ${AZURE_STORAGE_COMMON_HEADER} ${AZURE_STORAGE_COMMON_SOURCE}) -set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -set(THREADS_PREFER_PTHREAD_FLAG TRUE) -find_package(Threads REQUIRED) -find_package(LibXml2 REQUIRED) +# make sure that users can consume the project as a library. +add_library(azure::storage::common ALIAS azure-storage-common) -target_include_directories(azure-storage-common PUBLIC inc ${LIBXML2_INCLUDE_DIR}) -target_link_libraries(azure-storage-common Threads::Threads azure-core azure-identity ${LIBXML2_LIBRARIES}) +target_include_directories(azure-storage-common PUBLIC inc ${LIBXML2_INCLUDE_DIRS}) +target_link_libraries(azure-storage-common Threads::Threads azure-core ${LIBXML2_LIBRARIES}) if(MSVC) target_link_libraries(azure-storage-common bcrypt) # C28020 and C28204 are introduced by nlohmann/json @@ -54,13 +70,8 @@ else() endif() get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/storage/common/version.hpp") -add_library(azure::storage::common ALIAS azure-storage-common) - generate_documentation(azure-storage-common ${AZ_LIBRARY_VERSION}) -# CodeCoverage will validate requirements -include(CodeCoverage) - # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF # excluding json from coverage report create_code_coverage(storage azure-storage-common azure-storage-test "inc/azure/storage/common/json*") @@ -74,6 +85,7 @@ if(BUILD_TESTING) test/metadata_test.cpp test/storage_credential_test.cpp test/test_base.cpp + test/test_base.hpp ) if (MSVC) diff --git a/sdk/storage/azure-storage-files-datalake/CMakeLists.txt b/sdk/storage/azure-storage-files-datalake/CMakeLists.txt index 13eca6169..c50c122ad 100644 --- a/sdk/storage/azure-storage-files-datalake/CMakeLists.txt +++ b/sdk/storage/azure-storage-files-datalake/CMakeLists.txt @@ -2,9 +2,23 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) +project(azure-storage-files-datalake LANGUAGES CXX) -set (AZURE_STORAGE_DATALAKE_HEADER - inc/azure/storage/files/datalake.hpp +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) +include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) + +set( + AZURE_STORAGE_FILES_DATALAKE_HEADER + inc/azure/storage/files/datalake/protocol/datalake_rest_client.hpp inc/azure/storage/files/datalake/datalake_directory_client.hpp inc/azure/storage/files/datalake/datalake_file_client.hpp inc/azure/storage/files/datalake/datalake_file_system_client.hpp @@ -14,11 +28,12 @@ set (AZURE_STORAGE_DATALAKE_HEADER inc/azure/storage/files/datalake/datalake_sas_builder.hpp inc/azure/storage/files/datalake/datalake_service_client.hpp inc/azure/storage/files/datalake/datalake_utilities.hpp - inc/azure/storage/files/datalake/protocol/datalake_rest_client.hpp inc/azure/storage/files/datalake/version.hpp + inc/azure/storage/files/datalake.hpp ) -set (AZURE_STORAGE_DATALAKE_SOURCE +set( + AZURE_STORAGE_FILES_DATALAKE_SOURCE src/datalake_directory_client.cpp src/datalake_file_client.cpp src/datalake_file_system_client.cpp @@ -29,18 +44,18 @@ set (AZURE_STORAGE_DATALAKE_SOURCE src/datalake_utilities.cpp ) -add_library(azure-storage-files-datalake ${AZURE_STORAGE_DATALAKE_HEADER} ${AZURE_STORAGE_DATALAKE_SOURCE}) +add_library(azure-storage-files-datalake ${AZURE_STORAGE_FILES_DATALAKE_HEADER} ${AZURE_STORAGE_FILES_DATALAKE_SOURCE}) + +# make sure that users can consume the project as a library. +add_library(azure::storage::files::datalake ALIAS azure-storage-files-datalake) + target_include_directories(azure-storage-files-datalake PUBLIC inc) + target_link_libraries(azure-storage-files-datalake azure-storage-blobs) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/storage/files/datalake/version.hpp") -add_library(azure::storage::files::datalake ALIAS azure-storage-files-datalake) - generate_documentation(azure-storage-files-datalake ${AZ_LIBRARY_VERSION}) -# CodeCoverage will validate requirements -include(CodeCoverage) - # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF create_code_coverage(storage azure-storage-files-datalake azure-storage-test) @@ -49,17 +64,27 @@ if(BUILD_TESTING) azure-storage-test PRIVATE test/datalake_directory_client_test.cpp + test/datalake_directory_client_test.hpp test/datalake_file_client_test.cpp + test/datalake_file_client_test.hpp test/datalake_file_system_client_test.cpp + test/datalake_file_system_client_test.hpp test/datalake_path_client_test.cpp + test/datalake_path_client_test.hpp test/datalake_sas_test.cpp test/datalake_service_client_test.cpp + test/datalake_service_client_test.hpp ) target_link_libraries(azure-storage-test PRIVATE azure-storage-files-datalake) endif() if(BUILD_STORAGE_SAMPLES) - target_sources(azure-storage-sample PRIVATE sample/datalake_getting_started.cpp) + target_sources( + azure-storage-sample + PRIVATE + sample/datalake_getting_started.cpp + ) + target_link_libraries(azure-storage-sample PRIVATE azure-storage-files-datalake) endif() diff --git a/sdk/storage/azure-storage-files-shares/CMakeLists.txt b/sdk/storage/azure-storage-files-shares/CMakeLists.txt index 6185f096e..fe9d8f15a 100644 --- a/sdk/storage/azure-storage-files-shares/CMakeLists.txt +++ b/sdk/storage/azure-storage-files-shares/CMakeLists.txt @@ -2,9 +2,22 @@ # SPDX-License-Identifier: MIT cmake_minimum_required (VERSION 3.13) +project(azure-storage-files-shares LANGUAGES CXX) -set (AZURE_STORAGE_SHARES_HEADER - inc/azure/storage/files/shares.hpp +set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) +include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) + +set( + AZURE_STORAGE_FILES_SHARES_HEADER inc/azure/storage/files/shares/protocol/share_rest_client.hpp inc/azure/storage/files/shares/share_client.hpp inc/azure/storage/files/shares/share_constants.hpp @@ -16,9 +29,11 @@ set (AZURE_STORAGE_SHARES_HEADER inc/azure/storage/files/shares/share_sas_builder.hpp inc/azure/storage/files/shares/share_service_client.hpp inc/azure/storage/files/shares/version.hpp + inc/azure/storage/files/shares.hpp ) -set (AZURE_STORAGE_SHARES_SOURCE +set( + AZURE_STORAGE_FILES_SHARES_SOURCE src/share_client.cpp src/share_directory_client.cpp src/share_file_client.cpp @@ -26,18 +41,18 @@ set (AZURE_STORAGE_SHARES_SOURCE src/share_service_client.cpp ) -add_library(azure-storage-files-shares ${AZURE_STORAGE_SHARES_HEADER} ${AZURE_STORAGE_SHARES_SOURCE}) +add_library(azure-storage-files-shares ${AZURE_STORAGE_FILES_SHARES_HEADER} ${AZURE_STORAGE_FILES_SHARES_SOURCE}) + +# make sure that users can consume the project as a library. +add_library(azure::storage::files::shares ALIAS azure-storage-files-shares) + target_include_directories(azure-storage-files-shares PUBLIC inc) + target_link_libraries(azure-storage-files-shares azure-storage-common) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/storage/files/shares/version.hpp") -add_library(azure::storage::files::shares ALIAS azure-storage-files-shares) - generate_documentation(azure-storage-files-shares ${AZ_LIBRARY_VERSION}) -# CodeCoverage will validate requirements -include(CodeCoverage) - # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF create_code_coverage(storage azure-storage-files-shares azure-storage-test) @@ -46,16 +61,25 @@ if(BUILD_TESTING) azure-storage-test PRIVATE test/share_client_test.cpp + test/share_client_test.hpp test/share_directory_client_test.cpp + test/share_directory_client_test.hpp test/share_file_client_test.cpp + test/share_file_client_test.hpp test/share_sas_test.cpp test/share_service_client_test.cpp + test/share_service_client_test.hpp ) target_link_libraries(azure-storage-test PRIVATE azure-storage-files-shares) endif() if(BUILD_STORAGE_SAMPLES) - target_sources(azure-storage-sample PRIVATE sample/file_share_getting_started.cpp) + target_sources( + azure-storage-sample + PRIVATE + sample/file_share_getting_started.cpp + ) + target_link_libraries(azure-storage-sample PRIVATE azure-storage-files-shares) endif() diff --git a/sdk/template/azure-template/CMakeLists.txt b/sdk/template/azure-template/CMakeLists.txt index eb988d752..06498f658 100644 --- a/sdk/template/azure-template/CMakeLists.txt +++ b/sdk/template/azure-template/CMakeLists.txt @@ -6,28 +6,44 @@ project(azure-template LANGUAGES CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -# CodeCoverage will validate requirements +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake-modules") + +include(az_version) include(CodeCoverage) +include(DefineTransportAdapter) +include(doxygen_common) +include(global_compile_options) -add_library ( - azure-template - src/version.cpp - src/template_client.cpp +set( + AZURE_TEMPLATE_HEADER + inc/azure/template/template_client.hpp + inc/azure/template/version.hpp + inc/azure/template.hpp ) -target_include_directories (azure-template PUBLIC $) +set( + AZURE_TEMPLATE_SOURCE + src/template_client.cpp + src/version.cpp +) + +add_library(azure-template ${AZURE_TEMPLATE_HEADER} ${AZURE_TEMPLATE_SOURCE}) + +target_include_directories(azure-template PUBLIC inc) +target_link_libraries(azure-identity PUBLIC azure-core) + +# make sure that users can consume the project as a library. +add_library(Azure::Template ALIAS azure-template) # coverage. Has no effect if BUILD_CODE_COVERAGE is OFF create_code_coverage(template azure-template azure-template-test) -# make sure that users can consume the project as a library. -add_library (Azure::Template ALIAS azure-template) +get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/template/version.hpp") +generate_documentation(azure-template ${AZ_LIBRARY_VERSION}) if(BUILD_TESTING) # tests add_subdirectory(test) endif() - -get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/template/version.hpp") -generate_documentation(azure-template ${AZ_LIBRARY_VERSION}) diff --git a/sdk/template/azure-template/inc/azure/template.hpp b/sdk/template/azure-template/inc/azure/template.hpp new file mode 100644 index 000000000..5fd62c195 --- /dev/null +++ b/sdk/template/azure-template/inc/azure/template.hpp @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// SPDX-License-Identifier: MIT + +#pragma once + +#include "azure/template/template_client.hpp" +#include "azure/template/version.hpp"