Skip to content

Commit 3df56a0

Browse files
Merge pull request #16 from awslabs/FB-EnableTesting
Fb enable testing
2 parents 7161f94 + f1ddf10 commit 3df56a0

File tree

2 files changed

+82
-31
lines changed

2 files changed

+82
-31
lines changed

CMakeLists.txt

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ find_package(Git)
4242

4343
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
4444
# TODO: convert boolean invocation variables to options
45-
option(MINIMIZE_SIZE "If enabled, the SDK will be built via a unity aggregation process that results in smaller static libraries; additionally, release binaries will favor size optimizations over speed" OFF)
4645
option(ENABLE_UNITY_BUILD "If enabled, the SDK will be built using a single unified .cpp file for each service library. Reduces the size of static library binaries on Windows and Linux" OFF)
46+
option(MINIMIZE_SIZE "If enabled, the SDK will be built via a unity aggregation process that results in smaller static libraries; additionally, release binaries will favor size optimizations over speed" OFF)
4747
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)
4848
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)
4949
option(DISABLE_ANDROID_STANDALONE_BUILD "If enabled, the android build will not attempt to generate a standalone toolchain and instead rely on externally passed cmake parameters to specify the complete build environment. The included toolchain file is still used." OFF)
5050
option(SIMPLE_INSTALL "If enabled, removes all the additional indirection (platform/cpu/config) in the bin and lib directories on the install step" ON)
5151
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)
5252
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)
5353
option(ENABLE_RTTI "Flag to enable/disable rtti within the library" ON)
54-
54+
option(ENABLE_TESTING "Flag to enable/disable building unit and integration tests" ON)
5555

5656
# backwards compatibility with old command line params
5757
if("${STATIC_LINKING}" STREQUAL "1")
@@ -1010,8 +1010,6 @@ LIST(APPEND EXPORTS "")
10101010
#sdks
10111011
add_subdirectory(aws-cpp-sdk-core)
10121012
LIST(APPEND EXPORTS "aws-cpp-sdk-core")
1013-
add_subdirectory(testing-resources)
1014-
add_subdirectory(aws-cpp-sdk-core-tests)
10151013

10161014
foreach(SDK IN LISTS SDK_BUILD_LIST)
10171015
SET(SDK_DIR "aws-cpp-sdk-${SDK}")
@@ -1041,30 +1039,35 @@ foreach(custom_client ${ADD_CUSTOM_CLIENTS})
10411039
endforeach(custom_client)
10421040

10431041
#testing
1044-
if(PLATFORM_ANDROID AND NOT BUILD_SHARED_LIBS)
1045-
add_subdirectory(android-unified-tests)
1046-
else()
1047-
foreach(SDK IN LISTS SDK_BUILD_LIST)
1048-
get_test_project_for_service(${SDK} TEST_PROJECT)
1049-
if(TEST_PROJECT)
1050-
# before we add the test, make sure all of its dependencies are present
1051-
set(ADD_TEST 1)
1052-
get_dependencies_for_test(${SDK} DEPENDENCY_LIST)
1053-
if(DEPENDENCY_LIST)
1054-
STRING(REPLACE "," ";" LIST_RESULT ${DEPENDENCY_LIST})
1055-
foreach(DEPENDENCY IN LISTS LIST_RESULT)
1056-
list(FIND SDK_BUILD_LIST ${DEPENDENCY} DEPENDENCY_INDEX)
1057-
if(DEPENDENCY_INDEX LESS 0)
1058-
set(ADD_TEST 0)
1059-
endif()
1060-
endforeach()
1061-
endif()
1042+
if(ENABLE_TESTING)
1043+
add_subdirectory(testing-resources)
10621044

1063-
if(ADD_TEST)
1064-
add_subdirectory(${TEST_PROJECT})
1065-
endif()
1066-
endif()
1067-
endforeach()
1045+
if(PLATFORM_ANDROID AND NOT BUILD_SHARED_LIBS)
1046+
add_subdirectory(android-unified-tests)
1047+
else()
1048+
add_subdirectory(aws-cpp-sdk-core-tests)
1049+
foreach(SDK IN LISTS SDK_BUILD_LIST)
1050+
get_test_project_for_service(${SDK} TEST_PROJECT)
1051+
if(TEST_PROJECT)
1052+
# before we add the test, make sure all of its dependencies are present
1053+
set(ADD_TEST 1)
1054+
get_dependencies_for_test(${SDK} DEPENDENCY_LIST)
1055+
if(DEPENDENCY_LIST)
1056+
STRING(REPLACE "," ";" LIST_RESULT ${DEPENDENCY_LIST})
1057+
foreach(DEPENDENCY IN LISTS LIST_RESULT)
1058+
list(FIND SDK_BUILD_LIST ${DEPENDENCY} DEPENDENCY_INDEX)
1059+
if(DEPENDENCY_INDEX LESS 0)
1060+
set(ADD_TEST 0)
1061+
endif()
1062+
endforeach()
1063+
endif()
1064+
1065+
if(ADD_TEST)
1066+
add_subdirectory(${TEST_PROJECT})
1067+
endif()
1068+
endif()
1069+
endforeach()
1070+
endif()
10681071
endif()
10691072

10701073
export(TARGETS ${EXPORTS} FILE aws-sdk-cpp-config.cmake)

README.md

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Nmake builds targets in a serial fashion. To make things quicker, we recommend
7272

7373
cmake -G "NMake Makefiles JOM" -DTARGET_ARCH=ANDROID <other options> ..
7474

75-
####CMake Variables
75+
####General CMake Variables
7676

7777
#####BUILD_ONLY
7878
Allows you to only build the clients you want to use. This will resolve low level client dependencies if you set this to a high-level sdk such as aws-cpp-sdk-transfer. This will also build integration and unit tests related to the projects you select if they exist. aws-cpp-sdk-core always builds regardless of the value of this argument. This is a list argument. Example: -DBUILD_ONLY="aws-cpp-sdk-s3;aws-cpp-sdk-dynamodb;aws-cpp-sdk-cognito-identity"
@@ -90,9 +90,6 @@ If static linking is enabled, custom memory management defaults to off. If dynam
9090

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

93-
#####STATIC_LINKING
94-
To use static linking, set the value to 1. By default the build creates shared libraries for each platform. If you dynamically link to the SDK you will need to define the USE_IMPORT_EXPORT symbol for all build targets using the SDK.
95-
9693
#####TARGET_ARCH
9794
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 that operating system.
9895
Options: WINDOWS | LINUX | APPLE | ANDROID
@@ -105,6 +102,57 @@ Windows example:
105102

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

105+
#### General CMake Options
106+
CMake options are variables that can either be ON or OFF, with a controllable default. You can set an option either with CMake Gui tools or the command line via -D.
107+
108+
#####ENABLE_UNITY_BUILD
109+
(Defaults to OFF) 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.
110+
111+
#####MINIMIZE_SIZE
112+
(Defaults to OFF) A superset of ENABLE_UNITY_BUILD, if enabled this option turns on ENABLE_UNITY_BUILD as well as some additional binary size reduction settings. This is a work-in-progress and may change in the future (symbol stripping in particular).
113+
114+
#####BUILD_SHARED_LIBS
115+
(Defaults to ON) A built-in CMake option, reexposed here for visibility. If enabled, shared libraries will be built, otherwise static libraries will be built.
116+
117+
#####FORCE_SHARED_CRT
118+
(Defaults to ON) If enabled, the SDK will link to the C runtime dynamically, otherwise it will use the BUILD_SHARED_LIBS setting (weird but necessary for backwards compatibility with older versions of the SDK)
119+
120+
#####SIMPLE_INSTALL
121+
(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.
122+
123+
#####NO_HTTP_CLIENT
124+
(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.
125+
126+
#####NO_ENCRYPTION
127+
(Defaults to OFF) If enabled, prevents the default platform-specific cryptography implementation from being built into the library. Turn this ON if you wish to inject your own cryptography implementation.
128+
129+
#####ENABLE_RTTI
130+
(Defaults to ON) Controls whether or not the SDK is built with RTTI information
131+
132+
#####ENABLE_TESTING
133+
(Defaults to ON) Controls whether or not the unit and integration test projects are built
134+
135+
#### Android CMake Variables/Options
136+
137+
#####NDK_DIR
138+
An override path for where the build system should find the Android NDK. By default, the build system will check environment variables (ANDROID_NDK) if this CMake variable is not set.
139+
140+
#####DISABLE_ANDROID_STANDALONE_BUILD
141+
(Defaults to OFF) By default, Android builds will use a standalone clang-based toolchain constructed via NDK scripts. If you wish to use your own toolchain, turn this option ON.
142+
143+
#####ANDROID_STL
144+
(Defaults to libc++_shared) Controls what flavor of the C++ standard library the SDK will use. Valid values are one of {libc++_shared, libc++_static, gnustl_shared, gnustl_static}. There are severe performance problems within the SDK if gnustl is used, so we recommend libc++.
145+
146+
#####ANDROID_ABI
147+
(Defaults to armeabi-v7a) Controls what abi to output code for. Not all valid Android ABI values are currently supported, but we intend to provide full coverage in the future. We welcome patches to our Openssl build wrapper that speed this process up. Valid values are one of {arm64, armeabi-v7a, x86_64, x86, mips64, mips}.
148+
149+
#####ANDROID_TOOLCHAIN_NAME
150+
(Defaults to standalone-clang) Controls which compiler is used to build the SDK. With GCC being deprecated by Android NDK, we recommend using the default (clang).
151+
152+
#####ANDROID_NATIVE_API_LEVEL
153+
(Default varies by STL choice) Controls what API level the SDK will be built against. If you use gnustl, you have complete freedom with the choice of API level. If you use libc++, you must use an API level of at least 21.
154+
155+
108156
###Running integration tests:
109157
Several directories are appended with *integration-tests. After building your project, you can run these executables to ensure everything works properly.
110158

0 commit comments

Comments
 (0)