Skip to content

Initial basic build for core #1959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 14, 2022
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ doxygen/latex/


#cmake artifacts
dependencies
_build
build
_build_*
Expand Down
39 changes: 20 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if (LEGACY_BUILD)
project("aws-cpp-sdk-all" VERSION "${PROJECT_VERSION}" LANGUAGES CXX)
include(legacy_main)
else ()
# -- 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) "
"interface for Amazon Web Services (AWS).")
Expand All @@ -34,7 +35,8 @@ else ()
DESCRIPTION ${DESCRIPTION_STRING}
HOMEPAGE_URL "https://docs.aws.amazon.com/sdk-for-cpp"
)

include(CTest)
# -- Project wide setup --
# Setting C++ minimum requirements
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -71,29 +73,28 @@ else ()
# Options definition
option(BUILD_TESTING "If enabled, the SDK will include tests in the build" OFF)

message(STATUS "Setting toolchain and dependencies")
if (BUILD_TESTING)
message(STATUS "Building tests")
enable_testing()
# Testing dependency
find_package(GTest 1.11 REQUIRED)
include(GoogleTest) # for gtest_discover_tests()
# TODO: redefine below as option with proper defaults per platform
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(ENABLE_COMMONCRYPTO_ENCRYPTION ON)
elseif (CMAKE_SYSTEM_NAME "Windows")
set(ENABLE_BCRYPT_ENCRYPTION ON)
elseif (CMAKE_SYSTEM_NAME "Linux")
set(ENABLE_OPENSSL_ENCRYPTION ON)
else ()
message(FATAL_ERROR "Platform not yet supported by new build scripts")
endif ()

# Project dependencies http library (curl or OS), tinyxml2, cJSON, ssl (open or other), CRT
find_package(CURL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
pkg_check_modules(tinyxml2 REQUIRED IMPORTED_TARGET tinyxml2>=9.0.0)
pkg_check_modules(CJSON REQUIRED IMPORTED_TARGET libcjson>=1.7.15)
find_package(aws-crt-cpp 0.17.9 EXACT REQUIRED COMPONENTS io)
# -- Dependencies --
add_subdirectory(dependencies)

message(STATUS "Preparing core library build")
# -- main build targets --
add_subdirectory(src)

message(STATUS "Preparing CPack metadata")
add_subdirectory(packaging)

# -- Tests and packaging if running this as top project --
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_subdirectory(tests)
add_subdirectory(packaging)
endif ()
message(WARNING "The dependencies are currently checked only for a basic Linux build, new ones need to be added for other platforms yet")

message(WARNING "Anything below this warning is a TODO not yet implemented.")
Expand Down
22 changes: 20 additions & 2 deletions cmake/Findaws-crt-cpp.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# This is a temporary mock file to be able to test our current build setup.
# The file will later be read from CRTpp installation
message(WARNING "aws-crt-cpp package is mocked for testing of experimental feature branch. Remove this file when CRT starts providing it.")
# The file will later be read from aws-crt-cpp installation
include_guard()
message(WARNING "aws-crt-cpp package is mocked for testing of experimental feature branch. Remove this file when CRT starts providing it.")
# Setting include path to the submodule temporarily to unblock testing
# To make it build the crt submodule needs to be in-source build before calling this so generated files are created.
# Removing this work around soon, working in parallel in making aws-crt-cpp consumable by normal means
set(aws-crt-cpp_INCLUDE_DIRS
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-common/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-io/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-mqtt/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-cal/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-auth/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-http/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-event-stream/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-checksums/include
${CMAKE_CURRENT_LIST_DIR}/../crt/aws-crt-cpp/crt/aws-c-common/generated/include
PARENT_SCOPE
)

4 changes: 2 additions & 2 deletions cmake_legacy/sdks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function(add_sdks)

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

if(ENABLE_FUNCTIONAL_TESTING)
message(STATUS "Clearing existing directory for document-test to prepare for generation.")
Expand Down Expand Up @@ -274,7 +274,7 @@ function(add_sdks)
if (TEST_PROJECT STREQUAL "aws-cpp-sdk-core-tests")
add_subdirectory(src/${TEST_PROJECT})
else()
add_subdirectory(test/${TEST_PROJECT})
add_subdirectory(tests/${TEST_PROJECT})
endif()
endif()
endif()
Expand Down
15 changes: 15 additions & 0 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Testing Dependencies
if (BUILD_TESTING)
message(STATUS "Building tests")
# Testing dependency
find_package(GTest 1.11 REQUIRED)
include(GoogleTest) # for gtest_discover_tests()
endif ()

# Project dependencies http library (curl or OS), tinyxml2, cJSON, ssl (open or other), CRT
find_package(CURL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
pkg_check_modules(tinyxml2 REQUIRED IMPORTED_TARGET tinyxml2>=9.0.0)
pkg_check_modules(CJSON REQUIRED IMPORTED_TARGET libcjson>=1.7.15)
find_package(aws-crt-cpp 0.17.9 EXACT REQUIRED COMPONENTS io)
8 changes: 8 additions & 0 deletions src/aws-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
if (NOT LEGACY_BUILD)
message(WARNING "Building core with new cmake scripts not yet implemented")
add_library(aws-sdk-cpp-core)
add_library(aws-sdk-cpp::core ALIAS aws-sdk-cpp-core)
target_include_directories(
aws-sdk-cpp-core
PRIVATE ${aws-crt-cpp_INCLUDE_DIRS}
)
add_subdirectory(include)
add_subdirectory(source)
else ()
add_project(aws-cpp-sdk-core "Core http and utility library for the AWS C++ SDK")

Expand Down
4 changes: 4 additions & 0 deletions src/aws-cpp-sdk-core/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target_include_directories(
aws-sdk-cpp-core
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
22 changes: 22 additions & 0 deletions src/aws-cpp-sdk-core/source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
add_subdirectory(auth)
add_subdirectory(client)
add_subdirectory(config)
add_subdirectory(http)
add_subdirectory(internal)
add_subdirectory(monitoring)
add_subdirectory(net)
add_subdirectory(platform)
add_subdirectory(utils)

target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AmazonSerializableWebServiceRequest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AmazonStreamingWebServiceRequest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AmazonWebServiceRequest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Aws.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Globals.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Region.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp
)

9 changes: 9 additions & 0 deletions src/aws-cpp-sdk-core/source/auth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/AWSAuthSigner.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AWSAuthSignerProvider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AWSCredentialsProvider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AWSCredentialsProviderChain.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SSOCredentialsProvider.cpp
${CMAKE_CURRENT_SOURCE_DIR}/STSCredentialsProvider.cpp
)
12 changes: 12 additions & 0 deletions src/aws-cpp-sdk-core/source/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/AdaptiveRetryStrategy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AsyncCallerContext.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AWSClient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AWSErrorMarshaller.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ClientConfiguration.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CoreErrors.cpp
${CMAKE_CURRENT_SOURCE_DIR}/DefaultRetryStrategy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/RetryStrategy.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SpecifiedRetryableErrorsRetryStrategy.cpp
)
5 changes: 5 additions & 0 deletions src/aws-cpp-sdk-core/source/config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/defaults/ClientConfigurationDefaults.cpp
${CMAKE_CURRENT_SOURCE_DIR}/AWSProfileConfigLoader.cpp
)
1 change: 1 addition & 0 deletions src/aws-cpp-sdk-core/source/external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
message(FATAL_ERROR "Skip this directory when building with new build system")
15 changes: 15 additions & 0 deletions src/aws-cpp-sdk-core/source/http/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
add_subdirectory(standard)
if (NOT ${USE_CURL})
add_subdirectory(windows)
else ()
add_subdirectory(curl)
endif ()
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/HttpClient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HttpClientFactory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HttpRequest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HttpTypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Scheme.cpp
${CMAKE_CURRENT_SOURCE_DIR}/URI.cpp
)
5 changes: 5 additions & 0 deletions src/aws-cpp-sdk-core/source/http/curl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CurlHandleContainer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CurlHttpClient.cpp
)
5 changes: 5 additions & 0 deletions src/aws-cpp-sdk-core/source/http/standard/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/StandardHttpRequest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/StandardHttpResponse.cpp
)
11 changes: 11 additions & 0 deletions src/aws-cpp-sdk-core/source/http/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
message(FATAL_ERROR "Windows build not yet supported in new build system")
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/IXmlHttpRequest2HttpClient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WinConnectionPoolMgr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WinHttpConnectionPoolMgr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WinHttpSyncHttpClient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WinINetConnectionPoolMgr.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WinINetSyncHttpClient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/WinSyncHttpClient.cpp
)
4 changes: 4 additions & 0 deletions src/aws-cpp-sdk-core/source/internal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/AWSHttpResourceClient.cpp
)
6 changes: 6 additions & 0 deletions src/aws-cpp-sdk-core/source/monitoring/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/DefaultMonitoring.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HttpClientMetrics.cpp
${CMAKE_CURRENT_SOURCE_DIR}/MonitoringManager.cpp
)
21 changes: 21 additions & 0 deletions src/aws-cpp-sdk-core/source/net/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
message(WARNING "aws-sdk-cpp-core net needs refactor on platform dependant codebase")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/windows/Net.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windows/SimpleUDP.cpp
)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/linux-shared/Net.cpp
${CMAKE_CURRENT_SOURCE_DIR}/linux-shared/SimpleUDP.cpp
)
else ()
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Net.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SimpleUDP.cpp
)
endif ()

8 changes: 8 additions & 0 deletions src/aws-cpp-sdk-core/source/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
message(WARNING "aws-sdk-cpp-core platform needs refactor on platform dependant codebase")
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_subdirectory(windows)
elseif (CMAKE_SYSTEM_NAME STREQUAL "Android")
add_subdirectory(android)
else ()
add_subdirectory(linux-shared)
endif ()
10 changes: 10 additions & 0 deletions src/aws-cpp-sdk-core/source/platform/android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Environment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/FileSystem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/LogcatLogSystem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/OSVersionInfo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Platform.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Security.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Time.cpp
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Environment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/FileSystem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/OSVersionInfo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Security.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Time.cpp
)
8 changes: 8 additions & 0 deletions src/aws-cpp-sdk-core/source/platform/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Environment.cpp
${CMAKE_CURRENT_SOURCE_DIR}/FileSystem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/OSVersionInfo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Security.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Time.cpp
)
24 changes: 24 additions & 0 deletions src/aws-cpp-sdk-core/source/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
add_subdirectory(base64)
add_subdirectory(crypto)
add_subdirectory(event)
add_subdirectory(json)
add_subdirectory(logging)
add_subdirectory(memory)
add_subdirectory(stream)
add_subdirectory(threading)
add_subdirectory(xml)

target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/DateTimeCommon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Directory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/DNS.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Document.cpp
${CMAKE_CURRENT_SOURCE_DIR}/EnumParseOverflowContainer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/FileSystemUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/GetTheLights.cpp
${CMAKE_CURRENT_SOURCE_DIR}/HashingUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/StringUtils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/TempFile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/UUID.cpp
)
4 changes: 4 additions & 0 deletions src/aws-cpp-sdk-core/source/utils/base64/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Base64.cpp
)
33 changes: 33 additions & 0 deletions src/aws-cpp-sdk-core/source/utils/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
message(WARNING "not complete implementation yet")
if (USE_OPENSSL)
add_subdirectory(openssl)
endif ()
if (USE_BCRYPT)

endif ()
if (ENABLE_BCRYPT_ENCRYPTION)
add_subdirectory(bcrypt)
elseif (ENABLE_OPENSSL_ENCRYPTION)
add_subdirectory(openssl)
elseif (ENABLE_COMMONCRYPTO_ENCRYPTION)
add_subdirectory(commoncrypto)
else ()
message(FATAL_ERROR "No crypto library enabled")
endif ()

target_sources(aws-sdk-cpp-core
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Cipher.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ContentCryptoMaterial.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ContentCryptoScheme.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CRC32.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CryptoBuf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/CryptoStream.cpp
${CMAKE_CURRENT_SOURCE_DIR}/EncryptionMaterials.cpp
${CMAKE_CURRENT_SOURCE_DIR}/KeyWrapAlgorithm.cpp
${CMAKE_CURRENT_SOURCE_DIR}/MD5.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Sha1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Sha256.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Sha256HMAC.cpp
${CMAKE_CURRENT_SOURCE_DIR}/factory/Factories.cpp
)
Loading