build source identity (#3244)
* build source identity * pipeline * PR comments * PR comments * DFETCH cspell * EOL
This commit is contained in:
parent
bd4984015f
commit
88f234d976
1
.vscode/cspell.json
vendored
1
.vscode/cspell.json
vendored
@ -39,6 +39,7 @@
|
||||
"DCMAKE",
|
||||
"deserializers",
|
||||
"Deserializes",
|
||||
"DFETCH",
|
||||
"docfx",
|
||||
"DPAPI",
|
||||
"DRUN",
|
||||
|
||||
@ -8,18 +8,13 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules")
|
||||
set(AZ_ALL_LIBRARIES ON)
|
||||
|
||||
# Compile Options
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
|
||||
option(BUILD_TRANSPORT_CURL "Build an HTTP transport implementation with CURL" OFF)
|
||||
option(BUILD_TRANSPORT_WINHTTP "Build an HTTP transport implementation with WIN HTTP" OFF)
|
||||
option(BUILD_TRANSPORT_CUSTOM "Implementation for AzureSdkGetCustomHttpTransport function must be linked to the final application" OFF)
|
||||
option(BUILD_TESTING "Build test cases" OFF)
|
||||
option(BUILD_SAMPLES "Build sample application for Azure Storage clients" OFF)
|
||||
option(BUILD_RTTI "Build libraries with run-time type information." ON)
|
||||
option(BUILD_CODE_COVERAGE "Build gcov targets for HTML and XML reports. Requires debug build and BUILD_TESTING" OFF)
|
||||
option(BUILD_DOCUMENTATION "Create HTML based API documentation (requires Doxygen)" OFF)
|
||||
option(RUN_LONG_UNIT_TESTS "Tests that takes more than 5 minutes to complete. No effect if BUILD_TESTING is OFF" OFF)
|
||||
option(BUILD_PERFORMANCE_TESTS "Build the performance test library" OFF)
|
||||
option(MSVC_USE_STATIC_CRT "(MSVC only) Set to ON to link SDK with static CRT (/MT or /MTd switch)." OFF)
|
||||
include(FolderList)
|
||||
SetGlobalOptions()
|
||||
|
||||
if(FETCH_SOURCE_DEPS)
|
||||
message(FATAL_ERROR, "FETCH_SOURCE_DEPS flag not for global use, instead use when building individual components")
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(AzureTransportAdapters)
|
||||
include(AzureVcpkg)
|
||||
|
||||
@ -2,38 +2,42 @@ macro(GetFolderList project)
|
||||
message ("project found ${project}")
|
||||
|
||||
if(${project} STREQUAL CERTIFICATES)
|
||||
DownloadDepVersion(sdk/core azure-core 1.3.1)
|
||||
DownloadDepVersion(sdk/core azure-core 1.2.0)
|
||||
DownloadDepVersion(sdk/identity azure-identity 1.1.0)
|
||||
elseif(${project} STREQUAL IDENTITY)
|
||||
DownloadDepVersion(sdk/core azure-core 1.2.0)
|
||||
endif()
|
||||
|
||||
list(REMOVE_DUPLICATES BUILD_FOLDERS)
|
||||
endmacro()
|
||||
|
||||
macro(SetGlobalOptions)
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
|
||||
option(BUILD_TRANSPORT_CURL "Build an HTTP transport implementation with CURL" OFF)
|
||||
option(BUILD_TRANSPORT_WINHTTP "Build an HTTP transport implementation with WIN HTTP" OFF)
|
||||
option(BUILD_TRANSPORT_CUSTOM "Implementation for AzureSdkGetCustomHttpTransport function must be linked to the final application" OFF)
|
||||
option(BUILD_TESTING "Build test cases" OFF)
|
||||
option(BUILD_RTTI "Build libraries with run-time type information." ON)
|
||||
option(BUILD_CODE_COVERAGE "Build gcov targets for HTML and XML reports. Requires debug build and BUILD_TESTING" OFF)
|
||||
option(BUILD_DOCUMENTATION "Create HTML based API documentation (requires Doxygen)" OFF)
|
||||
option(BUILD_SAMPLES "Build sample application for Azure Storage clients" OFF)
|
||||
option(RUN_LONG_UNIT_TESTS "Tests that takes more than 5 minutes to complete. No effect if BUILD_TESTING is OFF" OFF)
|
||||
option(BUILD_PERFORMANCE_TESTS "Build the performance test library" OFF)
|
||||
option(MSVC_USE_STATIC_CRT "(MSVC only) Set to ON to link SDK with static CRT (/MT or /MTd switch)." OFF)
|
||||
option(FETCH_SOURCE_DEPS "fetch source dependencies for a package, not for global use, instead use when building specific component" OFF)
|
||||
endmacro()
|
||||
|
||||
macro(SetCompileOptions project)
|
||||
message ("setting up compile options for ${project}")
|
||||
|
||||
if(${project} STREQUAL CERTIFICATES)
|
||||
|
||||
# Compile Options
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
|
||||
option(BUILD_TRANSPORT_CURL "Build an HTTP transport implementation with CURL" OFF)
|
||||
option(BUILD_TRANSPORT_WINHTTP "Build an HTTP transport implementation with WIN HTTP" OFF)
|
||||
option(BUILD_TRANSPORT_CUSTOM "Implementation for AzureSdkGetCustomHttpTransport function must be linked to the final application" OFF)
|
||||
option(BUILD_TESTING "Build test cases" OFF)
|
||||
option(BUILD_RTTI "Build libraries with run-time type information." ON)
|
||||
option(BUILD_CODE_COVERAGE "Build gcov targets for HTML and XML reports. Requires debug build and BUILD_TESTING" OFF)
|
||||
option(BUILD_DOCUMENTATION "Create HTML based API documentation (requires Doxygen)" OFF)
|
||||
option(RUN_LONG_UNIT_TESTS "Tests that takes more than 5 minutes to complete. No effect if BUILD_TESTING is OFF" OFF)
|
||||
option(BUILD_PERFORMANCE_TESTS "Build the performance test library" OFF)
|
||||
option(MSVC_USE_STATIC_CRT "(MSVC only) Set to ON to link SDK with static CRT (/MT or /MTd switch)." OFF)
|
||||
option(BUILD_FROM_SOURCE_EXPORT "if export is built from source" ON)
|
||||
option(TESTING_BUILD "BUILD test cases" OFF)
|
||||
endif()
|
||||
SetGlobalOptions()
|
||||
endmacro()
|
||||
|
||||
macro(DownloadDepVersion DEP_FOLDER DEP_NAME DEP_VERSION)
|
||||
|
||||
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/${DEP_FOLDER})
|
||||
set(DOWNLOAD_FOLDER ${CMAKE_SOURCE_DIR}/downloads)
|
||||
file(REMOVE_RECURSE ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
|
||||
set(DOWNLOAD_FOLDER ${CMAKE_SOURCE_DIR}/build/downloads)
|
||||
set(DOWNLOAD_FILE ${DEP_NAME}_${DEP_VERSION}.zip)
|
||||
set(DEP_PREFIX azure-sdk-for-cpp)
|
||||
# get the zip
|
||||
@ -42,14 +46,14 @@ macro(DownloadDepVersion DEP_FOLDER DEP_NAME DEP_VERSION)
|
||||
#extract the zip
|
||||
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DOWNLOAD_FILE} DESTINATION ${DOWNLOAD_FOLDER}/${DEP_NAME})
|
||||
#make target folder
|
||||
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/${DEP_FOLDER})
|
||||
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
|
||||
# need a nicer way to copy/move folder
|
||||
# i need to archive the folder then extract at new location
|
||||
execute_process(COMMAND tar -cf ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar -C ${DOWNLOAD_FOLDER}/${DEP_NAME}/${DEP_PREFIX}-${DEP_NAME}_${DEP_VERSION}/${DEP_FOLDER} .)
|
||||
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar DESTINATION ${CMAKE_SOURCE_DIR}/${DEP_FOLDER})
|
||||
file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_FOLDER}/${DEP_NAME}.tar DESTINATION ${CMAKE_SOURCE_DIR}/build/${DEP_FOLDER})
|
||||
#cleanup
|
||||
file(REMOVE_RECURSE ${DOWNLOAD_FOLDER})
|
||||
#add dependency folder to build list
|
||||
list(APPEND BUILD_FOLDERS ${DEP_FOLDER})
|
||||
list(APPEND BUILD_FOLDERS build/${DEP_FOLDER})
|
||||
|
||||
endmacro()
|
||||
|
||||
@ -12,6 +12,14 @@ project(azure-identity LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
# Compile Options
|
||||
option(FETCH_SOURCE_DEPS "build source dependencies" OFF)
|
||||
|
||||
if(FETCH_SOURCE_DEPS)
|
||||
set(AZ_ALL_LIBRARIES ON)
|
||||
include(FolderList)
|
||||
SetCompileOptions(IDENTITY)
|
||||
endif()
|
||||
|
||||
include(AzureVersion)
|
||||
include(AzureCodeCoverage)
|
||||
@ -23,7 +31,13 @@ include(AzureBuildTargetForCI)
|
||||
# Add create_map_file function
|
||||
include(CreateMapFile)
|
||||
|
||||
if(NOT AZ_ALL_LIBRARIES)
|
||||
if(FETCH_SOURCE_DEPS)
|
||||
GetFolderList(IDENTITY)
|
||||
foreach(oneFolder IN LISTS BUILD_FOLDERS)
|
||||
message("add folder ${oneFolder}")
|
||||
add_subdirectory(${oneFolder} EXCLUDE_FROM_ALL)
|
||||
endforeach()
|
||||
elseif(NOT AZ_ALL_LIBRARIES)
|
||||
find_package(azure-core-cpp "1.2.0" CONFIG QUIET)
|
||||
if(NOT azure-core-cpp_FOUND)
|
||||
find_package(azure-core-cpp "1.2.0" REQUIRED)
|
||||
@ -88,7 +102,7 @@ az_rtti_setup(
|
||||
|
||||
if(BUILD_TESTING)
|
||||
# tests
|
||||
if (NOT AZ_ALL_LIBRARIES)
|
||||
if (NOT AZ_ALL_LIBRARIES OR FETCH_SOURCE_DEPS)
|
||||
include(AddGoogleTest)
|
||||
enable_testing ()
|
||||
endif()
|
||||
@ -105,3 +119,5 @@ endif()
|
||||
if (BUILD_PERFORMANCE_TESTS)
|
||||
add_subdirectory(test/perf)
|
||||
endif()
|
||||
|
||||
unset(FETCH_SOURCE_DEPS CACHE)
|
||||
|
||||
@ -36,6 +36,10 @@ stages:
|
||||
- Name: azure-identity
|
||||
Path: azure-identity
|
||||
VcpkgPortName: azure-identity-cpp
|
||||
ArtifactsSource:
|
||||
- Name: azure-identity
|
||||
Path: azure-identity
|
||||
VcpkgPortName: azure-identity-cpp
|
||||
TestEnv:
|
||||
# Tenant ID should use the uniqueID format for playback recordings
|
||||
- Name: AZURE_TENANT_ID
|
||||
@ -53,3 +57,6 @@ stages:
|
||||
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON'
|
||||
- Name: Performance
|
||||
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON'
|
||||
CMakeSourceTestOptions:
|
||||
- Name: Source
|
||||
Value: '-DFETCH_SOURCE_DEPS=ON'
|
||||
|
||||
@ -11,13 +11,13 @@ project(azure-security-keyvault-certificates LANGUAGES CXX)
|
||||
|
||||
|
||||
# Compile Options
|
||||
option(BUILD_SOURCE_DEPS "build source dependencies" OFF)
|
||||
option(FETCH_SOURCE_DEPS "build source dependencies" OFF)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
if(BUILD_SOURCE_DEPS)
|
||||
if(FETCH_SOURCE_DEPS)
|
||||
set(AZ_ALL_LIBRARIES ON)
|
||||
include(FolderList)
|
||||
SetCompileOptions(CERTIFICATES)
|
||||
@ -33,11 +33,11 @@ include(AzureBuildTargetForCI)
|
||||
# Add create_map_file function
|
||||
include(CreateMapFile)
|
||||
|
||||
if(BUILD_SOURCE_DEPS)
|
||||
if(FETCH_SOURCE_DEPS)
|
||||
GetFolderList(CERTIFICATES)
|
||||
foreach(oneFolder IN LISTS BUILD_FOLDERS)
|
||||
message("add folder ${oneFolder}")
|
||||
add_subdirectory(${oneFolder})
|
||||
add_subdirectory(${oneFolder} EXCLUDE_FROM_ALL)
|
||||
endforeach()
|
||||
elseif(NOT AZ_ALL_LIBRARIES)
|
||||
find_package(azure-core-cpp "1.2.0" CONFIG QUIET)
|
||||
@ -74,7 +74,7 @@ target_include_directories(
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/../../../sdk/core/inc>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/sdk/core/azure-core/inc>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/build/sdk/core/azure-core/inc>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
message($<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc)
|
||||
@ -95,7 +95,10 @@ get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp")
|
||||
generate_documentation(azure-security-keyvault-certificates ${AZ_LIBRARY_VERSION})
|
||||
|
||||
if(BUILD_TESTING)
|
||||
if (NOT AZ_ALL_LIBRARIES OR BUILD_SOURCE_DEPS)
|
||||
# define a symbol that enables some test hooks in code
|
||||
add_compile_definitions(TESTING_BUILD)
|
||||
|
||||
if (NOT AZ_ALL_LIBRARIES OR FETCH_SOURCE_DEPS)
|
||||
include(AddGoogleTest)
|
||||
enable_testing ()
|
||||
endif()
|
||||
@ -124,4 +127,6 @@ az_rtti_setup(
|
||||
"azure/keyvault/certificates/rtti.hpp"
|
||||
)
|
||||
|
||||
unset(BUILD_SOURCE_DEPS CACHE)
|
||||
unset(FETCH_SOURCE_DEPS CACHE)
|
||||
unset(FETCH_SOURCE_DEPS PARENT_SCOPE)
|
||||
|
||||
|
||||
@ -71,4 +71,4 @@ stages:
|
||||
Value: '-DBUILD_TESTING=ON -DBUILD_SAMPLES=ON -DBUILD_PERFORMANCE_TESTS=ON'
|
||||
CMakeSourceTestOptions:
|
||||
- Name: Source
|
||||
Value: '-DBUILD_SOURCE_DEPS=ON'
|
||||
Value: '-DFETCH_SOURCE_DEPS=ON'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user