Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Latest commit

 

History

History
321 lines (203 loc) · 11 KB

cmake-params.md

File metadata and controls

321 lines (203 loc) · 11 KB

CMake parameters

Use the CMake parameters listed in this section to customize how your SDK builds.

You can set these options with CMake GUI tools or the command line by using -D. For example:

cmake -DENABLE_UNITY_BUILD=ON -DREGENERATE_CLIENTS=1

General CMake Variables and Options

The following are general ** cmake ** variables and options that affect your SDK build.

Note
To use the ADD_CUSTOM_CLIENTS or REGENERATE_CLIENTS variables, you must have Python 2.7, Java (JDK 1.8+), and Maven installed and in your PATH.

Topics

ADD_CUSTOM_CLIENTS

Builds any arbitrary clients based on the API definition. Place your definition in the code-generation/api-definitions folder, and then pass this argument to ** cmake **. The ** cmake ** configure step generates your client and includes it as a subdirectory in your build. This is particularly useful to generate a C++ client for using one of your API Gateway services. For example:

-DADD_CUSTOM_CLIENTS="serviceName=myCustomService,version=2015-12-21;serviceName=someOtherService,version=2015-08-15"

BUILD_ONLY

Builds only the clients you want to use. If set to a high-level SDK such as aws-cpp-sdk-transfer, BUILD_ONLY resolves any low-level client dependencies. It also builds integration and unit tests related to the projects you select, if they exist. This is a list argument, with values separated by semicolon (;) characters. For example:

-DBUILD_ONLY="s3;cognito-identity"

Note
The core SDK module, aws-sdk-cpp-core, is always built, regardless of the value of the BUILD_ONLY parameter.

BUILD_SHARED_LIBS

A built-in CMake option, re-exposed here for visibility. If enabled, it builds shared libraries; otherwise, it builds only static libraries.

Note
To dynamically link to the SDK, you must define the USE_IMPORT_EXPORT symbol for all build targets using the SDK.

Values
ON | OFF

Default
ON

CPP_STANDARD

Specifies a custom C++ standard for use with C++ 14 and 17 code bases.

Values
11 | 14 | 17

Default
11

CURL_INCLUDE_DIR

Path to curl include directory containing libcurl headers.

Values
String path to selected include directory. For example, D:/path/to/dir/with/curl/include.

Default
N/A

CURL_LIBRARY

Path to curl library file to link against. This library can be a static library or an import library, depending on the needs of your application.

Values
String path to the curl library file. For example, D:/path/to/static/libcur/file/ie/libcurl.lib.a.

Default
N/A

CUSTOM_MEMORY_MANAGEMENT

To use a custom memory manager, set the value to 1. You can install a custom allocator so that all STL types use the custom allocation interface. If you set the value 0, you still might want to use the STL template types to help with DLL safety on Windows.

If static linking is enabled, custom memory management defaults to off (0). If dynamic linking is enabled, custom memory management defaults to on (1) and avoids cross-DLL allocation and deallocation.

Note
To prevent linker mismatch errors, you must use the same value (0 or 1) throughout your build system.

To install your own memory manager to handle allocations made by the SDK, you must set -DCUSTOM_MEMORY_MANAGEMENT and define AWS_CUSTOM_MEMORY_MANAGEMENT for all build targets that depend on the SDK.

ENABLE_CURL_LOGGING

If enabled, the internal log for curl is piped to the SDK logger.

Values
ON | OFF

Default
OFF

ENABLE_RTTI

Controls whether the SDK is built to enable run-time type information (RTTI).

Values
ON | OFF

Default
ON

ENABLE_TESTING

Controls whether unit and integration test projects are built during the SDK build.

Values
ON | OFF

Default
ON

ENABLE_UNITY_BUILD

If enabled, most SDK libraries are built as a single, generated .cpp file. This can significantly reduce static library size and speed up compilation time.

Values
ON | OFF

Default
OFF

FORCE_CURL

Windows only. If enabled, forces usage of the curl client instead of the default WinHTTP data transfer provider.

Values
ON | OFF

Default
OFF

FORCE_SHARED_CRT

If enabled, the SDK links to the C runtime dynamically; otherwise, it uses the BUILD_SHARED_LIBS setting (sometimes necessary for backward compatibility with earlier versions of the SDK).

Values
ON | OFF

Default
ON

G

Generates build artifacts, such as Visual Studio solutions and Xcode projects.

For example, on Windows:

-G "Visual Studio 12 Win64"

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

MINIMIZE_SIZE

A superset of ENABLE_UNITY_BUILD. If enabled, this option turns on ENABLE_UNITY_BUILD and additional binary size reduction settings.

Values
ON | OFF

Default
OFF

NO_ENCRYPTION

If enabled, prevents the default platform-specific cryptography implementation from being built into the library. Turn this ON to inject your own cryptography implementation.

Values
ON | OFF

Default
OFF

NO_HTTP_CLIENT

If enabled, prevents the default platform-specific HTTP client from being built into the library. If ON, you will need to provide your own platform-specific HTTP client implementation.

Values
ON | OFF

Default
OFF

REGENERATE_CLIENTS

This argument wipes out all generated code and generates the client directories from the code-generation/api-definitions folder. For example:

-DREGENERATE_CLIENTS=1

SIMPLE_INSTALL

If enabled, the install process does not insert platform-specific intermediate directories underneath bin/ and lib/. Turn OFF if you need to make multiplatform releases under a single install directory.

Values
ON | OFF

Default
ON

TARGET_ARCH

To cross-compile or build for a mobile platform, you must specify the target platform. By default, the build detects the host operating system and builds for the detected operating system.

Note
When TARGET_ARCH is ANDROID, additional options are available. See Android CMake Variables and Options.

Values
WINDOWS | LINUX | APPLE | ANDROID

USE_OPENSSL

If enabled, the SDK builds using OpenSSL; otherwise, it uses https://github.com/awslabs/aws-lc. AWS-LC is a general-purpose cryptographic library maintained by the AWS Cryptography team for AWS and their customers. For more information, see CMake Parameters on GitHub.

Values
ON | OFF

Default
ON

Android CMake Variables and Options

Use the following variables when you are creating an Android build of the SDK (when TARGET_ARCH is set to ANDROID).

Topics

ANDROID_ABI

Controls which Application Binary Interface (ABI) to output code for.

Note
Not all valid Android ABI values are currently supported.

Values
arm64 | armeabi-v7a | x86_64 | x86 | mips64 | mips

Default
armeabi-v7a

ANDROID_NATIVE_API_LEVEL

Controls what API level the SDK builds against. If you set ANDROID_STL to gnustl, you can choose any API level. If you use libc++, you must use an API level of at least 21.

Default
Varies by STL choice.

ANDROID_STL

Controls what flavor of the C++ standard library the SDK uses.

Important
Performance problems can occur within the SDK if the gnustl options are used; we strongly recommend using libc++_shared or libc++_static.

Values
libc++_shared | libc++_static | gnustl_shared | gnustl_static

Default
libc++_shared

ANDROID_TOOLCHAIN_NAME

Controls which compiler is used to build the SDK.

Note
With GCC being deprecated by the Android NDK, we recommend using the default value.

Default
standalone-clang

DISABLE_ANDROID_STANDALONE_BUILD

By default, Android builds use a standalone clang-based toolchain constructed via NDK scripts. To use your own toolchain, turn this option ON.

Values
ON | OFF

Default
OFF

NDK_DIR

Specifies an override path where the build system should find the Android NDK. By default, the build system checks environment variables (ANDROID_NDK) if this variable is not set.