Skip to content

Commit

Permalink
Source code reorganization and cmake version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
sdavtaker committed Jan 24, 2023
1 parent 1d28e78 commit 7150f31
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 66 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ credentials
toolchains/android/

# codegen
code-generation/generator/target/
tools/code-generation/generator/target/

#config output
aws-cpp-sdk-core/include/aws/core/SDKConfig.h
src/aws-cpp-sdk-core/include/aws/core/SDKConfig.h

#nuget
*.nupkg
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Breaking changes in AWS SDK for C++

## [1.10.0]
## [1.11.0](https://github.com/aws/aws-sdk-cpp/tree/1.11.0) (2022-01-24)
This release introduces a refactored Asynchronous API and restructures the File Hierarchy of the project source code. Additionally, the minimum required version of cmake was raised to 3.13.
* Asynchronous API refactoring is a partially breaking, backward incompatible change: all client methods such as OperationAsync and OperationCallable are no longer virtual methods but instead are conditionally compiled template methods. Having these methods as templates reduces the total binary size of the SDK by 40%. Individual client binary size may vary. In addition, it reduces build time of the SDK by up to 50% (release, unity build, SDK clients only).
A code change may be required if your code inherits SDK’s Client classes and overrides the virtual async methods. Regular synchronous/blocking call methods are still available for override.
Code changes are not required and SDK API are backward compatible if virtual async methods were not overwritten before.
* Scripts and IDE project files not using the provided cmake build infrastructure must be reviewed and updated to reflect source tree changes.

## [1.10.0](https://github.com/aws/aws-sdk-cpp/tree/1.10.0) (2021-11-07)
This release introduces a new endpoint resolution based on client configuration and request input parameters. Endpoint Discovery and ARN Resource APIs are deprecated.

## [1.9.0](https://github.com/aws/aws-sdk-cpp/tree/1.9.0) (2021-04-19)
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
#

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_legacy")
include(initialize_project_version)
project("aws-cpp-sdk-all" VERSION "${PROJECT_VERSION}" LANGUAGES CXX)
include(legacy_main)
2 changes: 1 addition & 1 deletion cmake_legacy/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ endfunction()
#
# Uses selection sort (stable).
function(sort_links targets_list)
# Special case of empty input list. Futher code assumes list to be non-empty.
# Special case of empty input list. Further code assumes list to be non-empty.
if(NOT ${targets_list})
return()
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake_legacy/initialize_project_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ endif()

if(NOT VERSION_STRING)
# extract it from the existing generated header file
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/aws-cpp-sdk-core/include/aws/core/VersionConfig.h" __SDK_VERSION_LINE LIMIT_COUNT 1 REGEX "AWS_SDK_VERSION_STRING.*[0-9]+\\.[0-9]+\\.[0-9]+" )
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/src/aws-cpp-sdk-core/include/aws/core/VersionConfig.h" __SDK_VERSION_LINE LIMIT_COUNT 1 REGEX "AWS_SDK_VERSION_STRING.*[0-9]+\\.[0-9]+\\.[0-9]+" )
string( REGEX MATCH "([0-9]+\\.[0-9]+\\.[0-9]+)" VERSION_STRING "${__SDK_VERSION_LINE}" )
endif()

Expand Down
20 changes: 2 additions & 18 deletions cmake_legacy/legacy_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,10 @@
# SPDX-License-Identifier: Apache-2.0.
#

cmake_minimum_required (VERSION 3.1)
if(POLICY CMP0056)
cmake_policy(SET CMP0056 NEW) # CMP0056: Honor link flags in try_compile() source-file signature. Introduced in 3.2
endif()
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW) # CMP0057: Support new IN_LIST if() operator. Introduced in 3.3.
endif()
if (POLICY CMP0077)
cmake_policy(SET CMP0077 OLD) # CMP0077: option() honors normal variables. Introduced in 3.13
endif()

# 3.12 or higher is strongly suggested; build settings (target_compile_options/etc...) sometimes do not get propagated properly under certain conditions prior to this version
# Making this a hard requirement is potentially disruptive to existing customers who aren't affected by the bad behavior though, so just warn for now
if(CMAKE_VERSION VERSION_LESS 3.12)
message(WARNING "Building with CMake 3.12 or higher is strongly suggested; current version is ${CMAKE_VERSION}")
endif()

get_filename_component(AWS_NATIVE_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

# Cmake invocation variables:
Expand Down Expand Up @@ -114,7 +101,7 @@ set(PYTHON3_CMD ${PYTHON_EXECUTABLE})
# CMAKE_MODULE_PATH is a CMAKE variable. It contains a list of paths
# which could be used to search CMAKE modules by "include()" or "find_package()", but the default value is empty.
# Add ${CMAKE_INSTALL_LIBDIR}/cmake and ${CMAKE_PREFIX_PATH}/lib/cmake to search list
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_legacy")
set(AWS_MODULE_DIR "/${CMAKE_INSTALL_LIBDIR}/cmake")
string(REPLACE ";" "${AWS_MODULE_DIR};" AWS_MODULE_PATH "${CMAKE_PREFIX_PATH}${AWS_MODULE_DIR}")
list(APPEND CMAKE_MODULE_PATH ${AWS_MODULE_PATH})
Expand All @@ -138,8 +125,6 @@ if(COMMAND apply_pre_project_platform_settings)
apply_pre_project_platform_settings()
endif()

include(initialize_project_version)

if (BUILD_SHARED_LIBS OR FORCE_SHARED_CRT)
set(STATIC_CRT OFF)
else()
Expand All @@ -150,7 +135,6 @@ endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH true)

# build the sdk targets
project("aws-cpp-sdk-all" VERSION "${PROJECT_VERSION}" LANGUAGES CXX)

if (UNIX AND NOT APPLE)
include(GNUInstallDirs)
Expand Down Expand Up @@ -185,7 +169,7 @@ set(CMAKE_CONFIGURATION_TYPES
# build third-party targets
if (BUILD_DEPS)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/crt/aws-crt-cpp/crt/aws-c-common/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-common/cmake")

include(AwsFindPackage)

Expand Down
45 changes: 34 additions & 11 deletions cmake_legacy/sdks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ include(sdksCommon)

set(SDK_DEPENDENCY_BUILD_LIST "")

set(NON_GENERATED_CLIENT_LIST access-management text-to-speech core queues s3-encryption identity-management transfer) ## Manually generated code with a name mimicking client name

if(REGENERATE_CLIENTS OR REGENERATE_DEFAULTS)
message(STATUS "Checking for SDK generation requirements")
include(FindJava)
Expand Down Expand Up @@ -53,8 +55,12 @@ else()
# remove any missing targets from the build list, factoring in dependencies appropriately
foreach(SDK IN LISTS TEMP_SDK_BUILD_LIST)
set(REMOVE_SDK 0)

set(SDK_DIR "aws-cpp-sdk-${SDK}")
list (FIND NON_GENERATED_CLIENT_LIST ${SDK} _index)
if (${_index} GREATER -1) # old cmake search in a list syntax
set(SDK_DIR "src/aws-cpp-sdk-${SDK}")
else()
set(SDK_DIR "generated/src/aws-cpp-sdk-${SDK}")
endif()

if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SDK_DIR}" AND NOT REGENERATE_CLIENTS)
set(REMOVE_SDK 1)
Expand All @@ -78,7 +84,6 @@ endif()

if(REGENERATE_CLIENTS OR REGENERATE_DEFAULTS)
message(STATUS "Regenerating clients/defaults that have been selected for build.")
set(NON_GENERATED_CLIENT_LIST access-management text-to-speech core queues s3-encryption identity-management transfer) ## Manually generated code with a name mimicking client name
if(REGENERATE_CLIENTS AND BUILD_ONLY)
foreach(build_only ${BUILD_ONLY})
list (FIND NON_GENERATED_CLIENT_LIST ${build_only} _index)
Expand Down Expand Up @@ -107,7 +112,7 @@ if(REGENERATE_CLIENTS OR REGENERATE_DEFAULTS)
endif()

execute_process(
COMMAND ${PYTHON3_CMD} scripts/run_code_generation.py ${REGENERATE_CLIENTS_ARG} ${MERGED_BUILD_LIST_STR} ${REGENERATE_DEFAULTS_ARG} ${ENABLE_VIRTUAL_OPERATIONS_ARG} --output_location ./
COMMAND ${PYTHON3_CMD} tools/scripts/run_code_generation.py ${REGENERATE_CLIENTS_ARG} ${MERGED_BUILD_LIST_STR} ${REGENERATE_DEFAULTS_ARG} ${ENABLE_VIRTUAL_OPERATIONS_ARG} --output_location ./generated/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE ret
)
Expand Down Expand Up @@ -137,7 +142,7 @@ foreach(custom_client ${ADD_CUSTOM_CLIENTS})
file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/aws-cpp-sdk-${C_SERVICE_NAME}")
message(STATUS "generating client for ${C_SERVICE_NAME} version ${C_VERSION}")
execute_process(
COMMAND ${PYTHON3_CMD} scripts/legacy/generate_sdks.py --serviceName ${C_SERVICE_NAME} --apiVersion ${C_VERSION} ${ENABLE_VIRTUAL_OPERATIONS_ARG} --outputLocation ./
COMMAND ${PYTHON3_CMD} tools/scripts/legacy/generate_sdks.py --serviceName ${C_SERVICE_NAME} --apiVersion ${C_VERSION} ${ENABLE_VIRTUAL_OPERATIONS_ARG} --outputLocation ./generated/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
LIST(APPEND SDK_BUILD_LIST ${C_SERVICE_NAME})
Expand All @@ -149,7 +154,12 @@ endforeach(custom_client)
if(BUILD_ONLY)
# make sure all the sdks/c2js are present; a missing sdk-directory or c2j file is a build error when building a manually-specified set
foreach(SDK IN LISTS SDK_BUILD_LIST)
set(SDK_DIR "aws-cpp-sdk-${SDK}")
list (FIND NON_GENERATED_CLIENT_LIST ${SDK} _index)
if (${_index} GREATER -1) # old cmake search in a list syntax
set(SDK_DIR "src/aws-cpp-sdk-${SDK}")
else()
set(SDK_DIR "generated/src/aws-cpp-sdk-${SDK}")
endif()

if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SDK_DIR}")
message(FATAL_ERROR "${SDK} is required for build, but ${SDK_DIR} directory is missing!")
Expand All @@ -162,7 +172,12 @@ if(BUILD_ONLY)
if(DEPENDENCY_INDEX LESS 0)
# test dependencies should also be built from source instead of locating by calling find_package
# which may cause version conflicts as well as double targeting built targets
set(SDK_DIR "aws-cpp-sdk-${SDK}")
list (FIND NON_GENERATED_CLIENT_LIST ${SDK} _index)
if (${_index} GREATER -1) # old cmake search in a list syntax
set(SDK_DIR "src/aws-cpp-sdk-${SDK}")
else()
set(SDK_DIR "generated/src/aws-cpp-sdk-${SDK}")
endif()
if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SDK_DIR}")
message(FATAL_ERROR "${SDK} is required for build, but ${SDK_DIR} directory is missing!")
endif ()
Expand All @@ -182,23 +197,31 @@ LIST(REMOVE_DUPLICATES SDK_DEPENDENCY_BUILD_LIST)
function(add_sdks)
LIST(APPEND EXPORTS "")
foreach(SDK IN LISTS SDK_BUILD_LIST)
set(SDK_DIR "aws-cpp-sdk-${SDK}")
message(STATUS "Adding ${SDK} to SDK build")
set(SDK_TARGET "aws-cpp-sdk-${SDK}")
list (FIND NON_GENERATED_CLIENT_LIST ${SDK} _index)
if (${_index} GREATER -1) # old cmake search in a list syntax
set(SDK_DIR "src/${SDK_TARGET}")
else()
set(SDK_DIR "generated/src/${SDK_TARGET}")
endif()

add_subdirectory("${SDK_DIR}")
LIST(APPEND EXPORTS "${SDK_DIR}")
LIST(APPEND EXPORTS "${SDK_TARGET}")
unset(SDK_TARGET)
endforeach()

#testing
if(ENABLE_TESTING)
add_subdirectory(testing-resources)
add_subdirectory(tests/testing-resources)

if(ENABLE_FUNCTIONAL_TESTING)
message(STATUS "Clearing existing directory for document-test to prepare for generation.")
file(REMOVE_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/aws-cpp-sdk-document-test")

# Generates SDK client based on aws-cpp-sdk-core-tests/resources/api-descriptions/document-test-2021-06-28.normal.json for functional testing.
execute_process(
COMMAND ${PYTHON3_CMD} scripts/legacy/generate_sdks.py --pathToApiDefinitions aws-cpp-sdk-core-tests/resources/api-descriptions --serviceName document-test --apiVersion 2021-06-28 --outputLocation ./ --prepareTool
COMMAND ${PYTHON3_CMD} tools/scripts/legacy/generate_sdks.py --pathToApiDefinitions aws-cpp-sdk-core-tests/resources/api-descriptions --serviceName document-test --apiVersion 2021-06-28 --outputLocation ./generated/ --prepareTool
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
message(STATUS "Generated service: document-test, version: 2021-06-28")
Expand Down
44 changes: 22 additions & 22 deletions cmake_legacy/sdksCommon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ endfunction()
# services have the name format abc.def.ghi will be renamed to ghi-def-abc (dot will not be accepted as Windows directory name )
# and put into C2J_SPECIAL_NAME_LIST, but rumtime.lex will be renamed to lex based on historical reason.
function(build_sdk_list)
file(GLOB ALL_MODEL_FILES "${CMAKE_CURRENT_SOURCE_DIR}/code-generation/api-descriptions/*-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].normal.json")
file(GLOB ALL_MODEL_FILES "${CMAKE_CURRENT_SOURCE_DIR}/tools/code-generation/api-descriptions/*-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].normal.json")
foreach(model IN LISTS ALL_MODEL_FILES)
get_filename_component(modelName "${model}" NAME)
STRING(REGEX MATCH "([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])" date "${modelName}")
Expand Down Expand Up @@ -152,27 +152,27 @@ list(APPEND HIGH_LEVEL_SDK_LIST "s3-encryption")
list(APPEND HIGH_LEVEL_SDK_LIST "text-to-speech")

set(SDK_TEST_PROJECT_LIST "")
list(APPEND SDK_TEST_PROJECT_LIST "cognito-identity:aws-cpp-sdk-cognitoidentity-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "core:aws-cpp-sdk-core-tests")
list(APPEND SDK_TEST_PROJECT_LIST "dynamodb:aws-cpp-sdk-dynamodb-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "ec2:aws-cpp-sdk-ec2-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "elasticfilesystem:aws-cpp-sdk-elasticfilesystem-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "identity-management:aws-cpp-sdk-identity-management-tests")
list(APPEND SDK_TEST_PROJECT_LIST "kinesis:aws-cpp-sdk-kinesis-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "lambda:aws-cpp-sdk-lambda-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "logs:aws-cpp-sdk-logs-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "mediastore-data:aws-cpp-sdk-mediastore-data-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "rds:aws-cpp-sdk-rds-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "redshift:aws-cpp-sdk-redshift-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3:aws-cpp-sdk-s3-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3-crt:aws-cpp-sdk-s3-crt-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3-encryption:aws-cpp-sdk-s3-encryption-tests,aws-cpp-sdk-s3-encryption-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3control:aws-cpp-sdk-s3control-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "sqs:aws-cpp-sdk-sqs-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "transfer:aws-cpp-sdk-transfer-tests")
list(APPEND SDK_TEST_PROJECT_LIST "text-to-speech:aws-cpp-sdk-text-to-speech-tests,aws-cpp-sdk-polly-sample")
list(APPEND SDK_TEST_PROJECT_LIST "transcribestreaming:aws-cpp-sdk-transcribestreaming-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "eventbridge:aws-cpp-sdk-eventbridge-tests")
list(APPEND SDK_TEST_PROJECT_LIST "cognito-identity:tests/aws-cpp-sdk-cognitoidentity-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "core:tests/aws-cpp-sdk-core-tests")
list(APPEND SDK_TEST_PROJECT_LIST "dynamodb:tests/aws-cpp-sdk-dynamodb-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "ec2:tests/aws-cpp-sdk-ec2-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "elasticfilesystem:tests/aws-cpp-sdk-elasticfilesystem-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "identity-management:tests/aws-cpp-sdk-identity-management-tests")
list(APPEND SDK_TEST_PROJECT_LIST "kinesis:tests/aws-cpp-sdk-kinesis-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "lambda:tests/aws-cpp-sdk-lambda-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "logs:tests/aws-cpp-sdk-logs-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "mediastore-data:tests/aws-cpp-sdk-mediastore-data-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "rds:tests/aws-cpp-sdk-rds-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "redshift:tests/aws-cpp-sdk-redshift-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3:tests/aws-cpp-sdk-s3-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3-crt:tests/aws-cpp-sdk-s3-crt-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3-encryption:tests/aws-cpp-sdk-s3-encryption-tests,tests/aws-cpp-sdk-s3-encryption-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "s3control:tests/aws-cpp-sdk-s3control-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "sqs:tests/aws-cpp-sdk-sqs-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "transfer:tests/aws-cpp-sdk-transfer-tests")
list(APPEND SDK_TEST_PROJECT_LIST "text-to-speech:tests/aws-cpp-sdk-text-to-speech-tests,tests/aws-cpp-sdk-polly-sample")
list(APPEND SDK_TEST_PROJECT_LIST "transcribestreaming:tests/aws-cpp-sdk-transcribestreaming-integration-tests")
list(APPEND SDK_TEST_PROJECT_LIST "eventbridge:tests/aws-cpp-sdk-eventbridge-tests")

build_sdk_list()

Expand Down
2 changes: 1 addition & 1 deletion cmake_legacy/setup_cmake_find_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ install(

# copy all cmake files to destination, these files include useful macros, functions and variables for users.
# useful macros and variables will be included in this cmake file for user to use
install(DIRECTORY "${AWS_NATIVE_SDK_ROOT}/cmake/" DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}")
install(DIRECTORY "${AWS_NATIVE_SDK_ROOT}/cmake_legacy/" DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}")

# following two files are vital for cmake to find correct package, but since we copied all files from above
# we left the code here to give you bettern understanding
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#set($metadata = $serviceModel.metadata)
#if($metadata.standalone)
cmake_minimum_required (VERSION 3.1)
cmake_minimum_required (VERSION 3.13 FATAL)

project(aws-cpp-sdk-${metadata.projectName})
find_package(AWSSDK REQUIRED COMPONENTS core)
Expand Down
Loading

0 comments on commit 7150f31

Please sign in to comment.