Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .changelog/breaking-change-bounded-default-executor.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "breaking-change",
"category": "aws-cpp-sdk-core",
"contributor": "sbiscigl",
"description": "Each client's default executor is now a PooledThreadExecutor sized to the machine's hardware threads, instead of a new thread for every async call. The thread-per-call executor is renamed UnboundedExecutor, and DefaultExecutor still compiles as a deprecated alias. Set the client configuration's executor to an UnboundedExecutor to keep a thread per call. Each request's user agent now names the executor its client runs on."
}
6 changes: 6 additions & 0 deletions .changelog/breaking-change-cpp17-minimum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "breaking-change",
"category": "cmake",
"contributor": "sbiscigl",
"description": "C++17 is now the default and the minimum for building the SDK. CMake's CMAKE_CXX_STANDARD replaces the SDK's CPP_STANDARD setting, and asking for a standard older than 17 fails the build. The minimum CMake version goes from 3.13 to 3.17."
}
6 changes: 6 additions & 0 deletions .changelog/breaking-change-crt-default-transport.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "breaking-change",
"category": "cmake",
"contributor": "sbiscigl",
"description": "The CRT HTTP client is now the default transport, with non-blocking async I/O on, and the CRT uses its own crypto instead of the system's OpenSSL. A default build no longer needs libcurl, WinHTTP or OpenSSL. Set USE_CRT_HTTP_CLIENT=OFF to build libcurl or WinHTTP instead, or USE_OPENSSL=ON to use the system's OpenSSL."
}
6 changes: 6 additions & 0 deletions .changelog/bugfix-tests-after-1-12-defaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "aws-cpp-sdk-core, tests",
"contributor": "sbiscigl",
"description": "Fix tests and builds that broke once the 1.12 defaults were turned on. The CRT HTTP client now uses httpRequestTimeoutMs, not requestTimeoutMs, as its limit on a whole request, the same as libcurl."
}
6 changes: 6 additions & 0 deletions .changelog/documentation-toolchain-policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "documentation",
"category": "docs",
"contributor": "sbiscigl",
"description": "Add a toolchain policy with the minimum GCC, Clang, Apple Clang, MSVC and CMake versions for building the SDK, and how each one is set. The README's minimum requirements now list the same versions."
}
29 changes: 22 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0.
#

cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
cmake_minimum_required(VERSION 3.17 FATAL_ERROR)

option(LEGACY_BUILD "If enabled, the SDK will use 1.11.0 version of CMake files to build" ON)
if (LEGACY_BUILD)
Expand All @@ -16,6 +16,9 @@ if (LEGACY_BUILD)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 OLD) # CMP0077: option() honors normal variables. Introduced in 3.13
endif ()
# CMP0091: MSVC runtime library flags are selected by an abstraction. Introduced in 3.15. set_msvc_flags()
# picks /MD or /MT by editing CMAKE_CXX_FLAGS, which only works under the old behavior.
cmake_policy(SET CMP0091 OLD)

get_filename_component(AWS_NATIVE_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

Expand All @@ -33,8 +36,8 @@ if (LEGACY_BUILD)
option(BUILD_SHARED_LIBS "If enabled, all aws sdk libraries will be build as shared objects; otherwise all Aws libraries will be built as static objects" ON)
option(FORCE_SHARED_CRT "If enabled, will unconditionally link the standard libraries in dynamically, otherwise the standard library will be linked in based on the BUILD_SHARED_LIBS setting" ON)
option(SIMPLE_INSTALL "If enabled, removes all the additional indirection (platform/cpu/config) in the bin and lib directories on the install step" ON)
option(USE_CRT_HTTP_CLIENT "If enabled, the common runtime HTTP client will be used, and the legacy systems such as WinHttp and libcurl will not be built or included" OFF)
option(USE_CRT_HTTP_CLIENT_ASYNC_IO "If enabled (requires USE_CRT_HTTP_CLIENT), compiles in and uses the non-blocking async I/O request path. Off by default to protect existing customers; flipping it on is the release gate for the new async path." OFF)
option(USE_CRT_HTTP_CLIENT "If enabled, the common runtime HTTP client will be used, and the legacy systems such as WinHttp and libcurl will not be built or included. Turn it off to build libcurl or WinHttp instead" ON)
option(USE_CRT_HTTP_CLIENT_ASYNC_IO "If enabled (requires USE_CRT_HTTP_CLIENT), compiles in and uses the non-blocking async I/O request path" ON)
option(NO_HTTP_CLIENT "If enabled, no platform-default http client will be included in the library. For the library to be used you will need to provide your own platform-specific implementation" OFF)
option(NO_ENCRYPTION "If enabled, no platform-default encryption will be included in the library. For the library to be used you will need to provide your own platform-specific implementations" OFF)
option(USE_IXML_HTTP_REQUEST_2 "If enabled on windows, the com object IXmlHttpRequest2 will be used for the http stack" OFF)
Expand All @@ -49,7 +52,7 @@ if (LEGACY_BUILD)
option(ENABLE_ADDRESS_SANITIZER "Flags to enable/disable Address Sanitizer for gcc or clang" OFF)
option(BYPASS_DEFAULT_PROXY "Bypass the machine's default proxy settings when using IXmlHttpRequest2" ON)
option(BUILD_DEPS "Build third-party dependencies" ON)
option(USE_OPENSSL "Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto" ON)
option(USE_OPENSSL "Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto instead of the CRT's AWS-LC" OFF)
option(ENABLE_CURL_LOGGING "If enabled, Curl's internal log will be piped to SDK's logger" ON)
option(ENABLE_HTTP_CLIENT_TESTING "If enabled, corresponding http client test suites will be built and run" OFF)
option(CUSTOM_MEMORY_MANAGEMENT "If set to ON, generates the sdk project files with custom memory management enabled, otherwise disables it" OFF)
Expand Down Expand Up @@ -80,7 +83,19 @@ if (LEGACY_BUILD)
set(AWS_TEST_REGION "US_EAST_1" CACHE STRING "Region to target integration tests against")
set(AWS_AUTORUN_LD_LIBRARY_PATH CACHE STRING "Path to append into LD_LIBRARY_PATH for unit tests autorun by cmake. Set this if custom runtime libs are required for overridden dependencies.")
set(BUILD_ONLY "" CACHE STRING "A semi-colon delimited list of the projects to build")
set(CPP_STANDARD "11" CACHE STRING "Flag to upgrade the C++ standard used. The default is 11. The minimum is 11.")
if (DEFINED CPP_STANDARD)
message(FATAL_ERROR "CPP_STANDARD was removed in 1.12. Set CMake's CMAKE_CXX_STANDARD instead, for example -DCMAKE_CXX_STANDARD=20.")
endif ()
if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif ()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
set(CMAKE_CXX_EXTENSIONS OFF)
endif ()
if (CMAKE_CXX_STANDARD EQUAL 98 OR CMAKE_CXX_STANDARD LESS 17)
message(FATAL_ERROR "The AWS SDK for C++ requires C++17 or later, and CMAKE_CXX_STANDARD is ${CMAKE_CXX_STANDARD}.")
endif ()

get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT ${is_multi_config})
Expand Down Expand Up @@ -364,7 +379,7 @@ if (LEGACY_BUILD)
else () # End of Legacy Build
# -- Preamble --
message(STATUS "Building with new CMake scripts.")
string(CONCAT DESCRIPTION_STRING "The AWS SDK for C++ provides a modern C++ (standard version C++11 or later) "
string(CONCAT DESCRIPTION_STRING "The AWS SDK for C++ provides a modern C++ (standard version C++17 or later) "
"interface for Amazon Web Services (AWS).")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
Expand All @@ -384,7 +399,7 @@ else () # End of Legacy Build

# -- Project wide setup --
# Setting C++ minimum requirements
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AWS SDK for C++
The AWS SDK for C++ provides a modern C++ (version C++ 11 or later) interface for Amazon Web Services (AWS). It is meant to be performant and fully functioning with low- and high-level SDKs, while minimizing dependencies and providing platform portability (Windows, OSX, Linux, and mobile).
The AWS SDK for C++ provides a modern C++ (version C++17 or later) interface for Amazon Web Services (AWS). It is meant to be performant and fully functioning with low- and high-level SDKs, while minimizing dependencies and providing platform portability (Windows, OSX, Linux, and mobile).

AWS SDK for C++ is now in General Availability and recommended for production use. We invite our customers to join the development efforts by submitting pull requests and sending us feedback and ideas via GitHub Issues.

Expand All @@ -15,15 +15,20 @@ AWS SDK for C++ is now in General Availability and recommended for production us
## Building the SDK:

### Minimum Requirements:
* Visual Studio 2015 or later
* OR GNU Compiler Collection (GCC) 4.9 or later
* OR Clang 3.3 or later
* A compiler with C++17 support
* GNU Compiler Collection (GCC) 7.3 or later
* OR Clang 5 or later
* OR Apple Clang 9.1 (Xcode 9.3) or later
* OR Visual Studio 2017 version 15.7 or later
* CMake 3.17 or later
* 4GB of RAM (required for building some of the larger clients; SDK build may fail on EC2 instance types t2.micro, t2.small, and other small instance types due to insufficient memory)
* Supported platforms
* Amazon Linux
* Windows
* Mac

These minimums follow the SDK's [toolchain policy](./docs/Toolchain_Policy.md).

### Building From Source:

#### To create an **out-of-source build**:
Expand All @@ -50,7 +55,7 @@ AWS SDK for C++ is now in General Availability and recommended for production us
**_NOTE:_** BUILD_ONLY is an optional flag used to list only the services you are using. Building the whole SDK can take a long time. Also, check out the list of [CMake parameters](./docs/CMake_Parameters.md)

#### Other Dependencies:
To compile in Linux, you must have the header files for libcurl, libopenssl. The packages are typically available in your package manager.
A default build sends requests through the CRT, which comes with the SDK, so it doesn't need libcurl or OpenSSL. To build with libcurl instead (`-DUSE_CRT_HTTP_CLIENT=OFF`) on Linux, you must have the header files for libcurl. The packages are typically available in your package manager.

Debian based Linux distributions example:
`sudo apt-get install libcurl-dev`
Expand Down Expand Up @@ -151,6 +156,7 @@ Please make sure to check out our resources too before opening an issue:
# Using the SDK and Other Topics
* Other docs for how to build the sdk
* [CMake Parameters](./docs/CMake_Parameters.md)
* [Toolchain policy](./docs/Toolchain_Policy.md)
* [Add as CMake external project](./docs/CMake_External_Project.md)
* [Building for Docker](https://github.com/aws/aws-sdk-cpp/tree/master/CI/docker-file) (To build for Docker, ensure your container meets the [minimum requirements](#minimum-requirements))
* [Building on an EC2 instance](https://github.com/aws/aws-sdk-cpp/wiki/Building-the-SDK-from-source-on-EC2)
Expand Down
2 changes: 0 additions & 2 deletions cmake/AWSSDKConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH
get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH)
get_filename_component(AWS_NATIVE_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)

set(CPP_STANDARD "11" CACHE STRING "Flag to upgrade the C++ standard used. The default is 11. The minimum is 11.")

if(AWSSDK_DEFAULT_ROOT_DIR STREQUAL "/")
set(AWSSDK_DEFAULT_ROOT_DIR "")
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/compiler_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ macro(set_gcc_flags)
list(APPEND AWS_COMPILER_FLAGS "-fno-exceptions")

if(NOT NO_CPPSTD_IN_PKG_CONFIG)
list(APPEND AWS_COMPILER_FLAGS "-std=c++${CPP_STANDARD}")
list(APPEND AWS_COMPILER_FLAGS "-std=c++${CMAKE_CXX_STANDARD}")
endif()

if(COMPILER_IS_MINGW)
Expand Down
2 changes: 1 addition & 1 deletion cmake/platform/linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ macro(apply_post_project_platform_settings)

# libatomic - some arches need to link against libatomic.so, some don't
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS "-std=c++${CPP_STANDARD}")
list(APPEND CMAKE_REQUIRED_FLAGS "-std=c++${CMAKE_CXX_STANDARD}")
check_cxx_source_compiles("${ATOMIC_TEST_CXX_SOURCE}" HAVE_ATOMICS_WITHOUT_LIBATOMIC)
if(NOT HAVE_ATOMICS_WITHOUT_LIBATOMIC)
set(CMAKE_REQUIRED_LIBRARIES atomic)
Expand Down
15 changes: 9 additions & 6 deletions docs/CMake_Parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Windows example:

For more information, see the CMake documentation for your platform.

### CPP_STANDARD
(Defaults to 11) Allows you to specify a custom c++ standard for use with C++ 14 and 17 code-bases
### CMAKE_CXX_STANDARD
(Defaults to 17) CMake's standard setting for the C++ standard the SDK builds with. The minimum is 17, and setting anything older fails the build. The SDK's own `CPP_STANDARD` setting was removed in 1.12.

### ENABLE_UNITY_BUILD
(Defaults to ON) If enabled, most SDK libraries will be built as a single, generated .cpp file. This can significantly reduce static library size as well as speed up compilation time.
Expand All @@ -61,8 +61,11 @@ For more information, see the CMake documentation for your platform.
### SIMPLE_INSTALL
(Defaults to ON) If enabled, the install process will not insert platform-specific intermediate directories underneath bin/ and lib/. Turn OFF if you need to make multi-platform releases under a single install directory.

### USE_CRT_HTTP_CLIENT
(Defaults to OFF) If enabled, the common runtime HTTP client will be used, and the legacy systems such as WinHttp and libcurl will not be built or included
### USE_CRT_HTTP_CLIENT
(Defaults to ON) If enabled, the common runtime HTTP client will be used, and the legacy systems such as WinHttp and libcurl will not be built or included. Turn it off to build libcurl or WinHttp instead. They get no new features, and new work is built and tested against the CRT.

### USE_CRT_HTTP_CLIENT_ASYNC_IO
(Defaults to ON) If enabled, async calls on the CRT HTTP client use non-blocking I/O, so a request doesn't hold an executor thread while it waits on the network. Has no effect when USE_CRT_HTTP_CLIENT is off.

### NO_HTTP_CLIENT
(Defaults to OFF) If enabled, prevents the default platform-specific http client from being built into the library. Turn this ON if you wish to inject your own http client implementation.
Expand Down Expand Up @@ -95,9 +98,9 @@ For more information, see the CMake documentation for your platform.
(Defaults to ON) Build third-party dependencies

### USE_OPENSSL
(Defaults to ON) Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto
(Defaults to OFF) Set this if you want to use your system's OpenSSL 1.0.2/1.1.1 compatible libcrypto instead of the CRT's own crypto.

If disabled, SDK will build and install [AWS-LC](https://github.com/awslabs/aws-lc) on Linux system when `BUILD_DEPS` is `ON`. This is an experimental feature. It will install AWS-LC as replacement of OpenSSL in the system default directory. Do not use if you have an OpenSSL installation in your system already.
If disabled, the SDK builds [AWS-LC](https://github.com/awslabs/aws-lc) on Linux and macOS when `BUILD_DEPS` is `ON`, and installs its libcrypto alongside the SDK. If you have an OpenSSL installation in the same install prefix, install the SDK to a different prefix.

### ENABLE_CURL_LOGGING
(Defaults to ON) If enabled, Curl's internal log will be piped to SDK's logger
Expand Down
15 changes: 15 additions & 0 deletions docs/Toolchain_Policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Toolchain Policy

The AWS SDK for C++ is written in C++17, and C++17 is the oldest standard it builds with. You can build with a newer standard by setting `CMAKE_CXX_STANDARD`, for example to 20.

Amazon Linux is the SDK's main platform, so it's what our minimums are based on. The minimum GCC and CMake versions are the ones that ship with the oldest Amazon Linux we support. They go up only when that Amazon Linux reaches end of support, not when a compiler or CMake version gets old. Today the oldest is Amazon Linux 2.

The SDK supports Clang, Apple Clang and MSVC as well, so it builds on macOS and Windows, not just Linux. Their minimums don't come from Amazon Linux. For each one, it's the first version with all of C++17's core language features.

| Toolchain | Minimum | Why |
| --- | --- | --- |
| GCC | 7.3 | Amazon Linux 2's `gcc` |
| CMake | 3.17 | Amazon Linux 2's `cmake3` |
| Clang | 5 | First release with all of C++17's core language features |
| Apple Clang | 9.1 (Xcode 9.3) | First release based on Clang 5 |
| MSVC | 19.14 (Visual Studio 2017 version 15.7) | First release with all of C++17's core language features |
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,15 @@ std::shared_ptr<EC2ProtocolEndpointProviderBase>& EC2ProtocolClient::accessEndpo

void EC2ProtocolClient::init(const EC2Protocol::EC2ProtocolClientConfiguration& config) {
AWSClient::SetServiceClientName("EC2 Protocol");
if (!m_clientConfiguration.executor) {
if (!m_clientConfiguration.configFactories.executorCreateFn()) {
AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn");
m_isInitialized = false;
return;
}
if (!m_clientConfiguration.executor && m_clientConfiguration.configFactories.executorCreateFn) {
m_clientConfiguration.executor = m_clientConfiguration.configFactories.executorCreateFn();
}
if (!m_clientConfiguration.executor) {
AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn");
m_isInitialized = false;
return;
}
AWSClient::SetUserAgentExecutor(*m_clientConfiguration.executor);
AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider);
m_endpointProvider->InitBuiltInParameters(config, "ec2query");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@ std::shared_ptr<JsonProtocolEndpointProviderBase>& JsonProtocolClient::accessEnd

void JsonProtocolClient::init(const JsonProtocol::JsonProtocolClientConfiguration& config) {
AWSClient::SetServiceClientName("Json Protocol");
if (!m_clientConfiguration.executor) {
if (!m_clientConfiguration.configFactories.executorCreateFn()) {
AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn");
m_isInitialized = false;
return;
}
if (!m_clientConfiguration.executor && m_clientConfiguration.configFactories.executorCreateFn) {
m_clientConfiguration.executor = m_clientConfiguration.configFactories.executorCreateFn();
}
if (!m_clientConfiguration.executor) {
AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn");
m_isInitialized = false;
return;
}
AWSClient::SetUserAgentExecutor(*m_clientConfiguration.executor);
AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider);
m_endpointProvider->InitBuiltInParameters(config, "jsonprotocol");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,15 @@ std::shared_ptr<JSONRPC10EndpointProviderBase>& JSONRPC10Client::accessEndpointP

void JSONRPC10Client::init(const JSONRPC10::JSONRPC10ClientConfiguration& config) {
AWSClient::SetServiceClientName("JSON RPC 10");
if (!m_clientConfiguration.executor) {
if (!m_clientConfiguration.configFactories.executorCreateFn()) {
AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn");
m_isInitialized = false;
return;
}
if (!m_clientConfiguration.executor && m_clientConfiguration.configFactories.executorCreateFn) {
m_clientConfiguration.executor = m_clientConfiguration.configFactories.executorCreateFn();
}
if (!m_clientConfiguration.executor) {
AWS_LOGSTREAM_FATAL(ALLOCATION_TAG, "Failed to initialize client: config is missing Executor or executorCreateFn");
m_isInitialized = false;
return;
}
AWSClient::SetUserAgentExecutor(*m_clientConfiguration.executor);
AWS_CHECK_PTR(SERVICE_NAME, m_endpointProvider);
m_endpointProvider->InitBuiltInParameters(config, "jsonrpc10");
}
Expand Down
Loading
Loading