From a57ebb85810a4da229f1fb40c5b857715d3ff8f3 Mon Sep 17 00:00:00 2001 From: Damian Vicino Date: Thu, 18 Aug 2022 15:43:23 -0400 Subject: [PATCH] Partial implementation of build for core-test Build fails from mixed use of types from CRT and SDK that was fixed after the creation of this branch. The rebase is going to be huge, so breaking the push in 2 steps befor continuing. --- CMakeLists.txt | 14 +----------- cmake/Findaws-crt-cpp.cmake | 12 ---------- cmake/dependencies.cmake | 22 +++++++++++++++++++ cspell.json | 6 +++-- dependencies/CMakeLists.txt | 7 ------ src/aws-cpp-sdk-core-tests/CMakeLists.txt | 19 ++++++++-------- src/aws-cpp-sdk-core/CMakeLists.txt | 4 ++-- .../source/utils/crypto/CMakeLists.txt | 1 - 8 files changed, 39 insertions(+), 46 deletions(-) delete mode 100644 cmake/Findaws-crt-cpp.cmake create mode 100644 cmake/dependencies.cmake delete mode 100644 dependencies/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index e61537422e8..f1014e47a60 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,16 +95,7 @@ else () endif () # -- Dependencies -- - add_subdirectory(dependencies) - if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - # Testing Dependencies - if (BUILD_TESTING) - message(STATUS "Building tests") - # Testing dependency - find_package(GTest 1.11 REQUIRED) - include(GoogleTest) # for gtest_discover_tests() - endif () - endif () + include(dependencies) # -- main build targets -- add_subdirectory(src) @@ -121,9 +112,6 @@ else () message(WARNING "Anything below this warning is a TODO not yet implemented.") - message(STATUS "Setting up core library.") - message(STATUS "Prepare CRT dependency.") - message(STATUS "Building core library.") message(STATUS "Building core library tests.") message(STATUS "Add support for static analysis.") message(STATUS "Building client libraries.") diff --git a/cmake/Findaws-crt-cpp.cmake b/cmake/Findaws-crt-cpp.cmake deleted file mode 100644 index 24de17445cd..00000000000 --- a/cmake/Findaws-crt-cpp.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# This is a temporary mock file to be able to test our current build setup. -# 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_INSTALL_PREFIX}/include PARENT_SCOPE) -set(aws-crt-cpp_LIB_DIRS ${CMAKE_INSTALL_PREFIX}/lib PARENT_SCOPE) - - diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake new file mode 100644 index 00000000000..9c31a386fe2 --- /dev/null +++ b/cmake/dependencies.cmake @@ -0,0 +1,22 @@ +# 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) +message(STATUS "Checking for aws-crt-cpp version 0.18.2") +find_package(aws-crt-cpp 0.18.2 EXACT REQUIRED) +message(STATUS " Found aws-crt-cpp version ${aws-crt-cpp_VERSION}") +# Infer dirs and libs temporarily from aws-crt-cpp_DIR until they get shipped in the new CRT version. +set(aws-crt-cpp_INCLUDE_DIR "${aws-crt-cpp_DIR}/../../../include") +set(aws-crt-cpp_INCLUDE_DIRS "${aws-crt-cpp_DIR}/../../../include") +set(aws-crt-cpp_LIBRARY_DIRS "${aws-crt-cpp_DIR}/../..") +set(aws-crt-cpp_LIBRARIES aws-crt-cpp aws-c-common aws-c-event-stream aws-c-mqtt aws-c-s3 aws-c-auth aws-c-sdkutils aws-c-http aws-c-compression aws-c-io s2n aws-checksums aws-c-common aws-c-cal) +set(aws-crt-cpp_LIBRARY_DIRS "${aws-crt-cpp_DIR}/..") + +if (BUILD_TESTING) + message(STATUS "Building tests") + # Testing dependency + find_package(GTest 1.11 REQUIRED) + include(GoogleTest) # for gtest_discover_tests() +endif () diff --git a/cspell.json b/cspell.json index ce643629f95..6775d6f4101 100644 --- a/cspell.json +++ b/cspell.json @@ -25,7 +25,7 @@ // MSVC "msvc", "MSFT", "LPDWORD", "DATAW", "mkgmtime", "vscprintf", "wtoi", "msxml", "runtimeobject", "winhttp", "Wininet", // Crypto - "decryptor", "encryptor", "NTSTATUS", "PBYTE", "PUCHAR", "noconf", "HAMC", "PBCRYPT", "BCRYPT", "libcrypto", "AWSLC", + "decryptor", "encryptor", "NTSTATUS", "PBYTE", "PUCHAR", "noconf", "HAMC", "PBCRYPT", "BCRYPT", "libcrypto", "AWSLC", "COMMONCRYPTO", // EC2 "IMDS", // Cognito @@ -47,6 +47,8 @@ // in DefaultRateLimiter "renormalize", // parameters defined in tinyxml2 - "uval" + "uval", + // negated option in parameters + "DNON" ] } diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt deleted file mode 100644 index e379e13bcb7..00000000000 --- a/dependencies/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# 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) \ No newline at end of file diff --git a/src/aws-cpp-sdk-core-tests/CMakeLists.txt b/src/aws-cpp-sdk-core-tests/CMakeLists.txt index 3a3e3e645c7..d8281b18275 100644 --- a/src/aws-cpp-sdk-core-tests/CMakeLists.txt +++ b/src/aws-cpp-sdk-core-tests/CMakeLists.txt @@ -7,20 +7,21 @@ if (NOT LEGACY_BUILD) ) add_subdirectory(testing-resources) - add_executable( - aws-core-version - ${CMAKE_CURRENT_LIST_DIR}/VersionTests.cpp - ${CMAKE_CURRENT_LIST_DIR}/RunTests.cpp - ) + add_executable(aws_core_test) target_link_libraries( - aws-core-version + aws_core_test PRIVATE GTest::GTest PRIVATE aws-sdk-cpp::core PRIVATE aws-sdk-cpp::test-resources ) + target_sources(aws_core_test + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/RunTests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/VersionTests.cpp + ) + gtest_discover_tests(aws_core_test) - # add_subdirectory(monitoring) - message(WARNING "Not testing everything yet...") + message(WARNING "Building core test with new cmake scripts not yet implemented") else () add_project(aws-cpp-sdk-core-tests "Tests for the AWS Core C++ Library" @@ -145,4 +146,4 @@ else () if (NOT CMAKE_CROSSCOMPILING) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) endif () -endif () \ No newline at end of file +endif () diff --git a/src/aws-cpp-sdk-core/CMakeLists.txt b/src/aws-cpp-sdk-core/CMakeLists.txt index c170c7a44d7..42999c8a18d 100644 --- a/src/aws-cpp-sdk-core/CMakeLists.txt +++ b/src/aws-cpp-sdk-core/CMakeLists.txt @@ -10,13 +10,13 @@ if (NOT LEGACY_BUILD) ) target_link_directories( aws-sdk-cpp-core - PUBLIC ${aws-crt-cpp_LIB_DIRS} + PUBLIC ${aws-crt-cpp_LIBRARY_DIRS} PUBLIC ${CJSON_LIBRARY_DIRS} PUBLIC ${tinyxml2_LIBRARY_DIRS} ) target_link_libraries( aws-sdk-cpp-core - aws-crt-cpp aws-c-common aws-checksums + ${aws-crt-cpp_LIBRARIES} ${CJSON_LIBRARIES} ${tinyxml2_LIBRARIES} ) diff --git a/src/aws-cpp-sdk-core/source/utils/crypto/CMakeLists.txt b/src/aws-cpp-sdk-core/source/utils/crypto/CMakeLists.txt index 46ad4fd7081..10d0fe10e6b 100644 --- a/src/aws-cpp-sdk-core/source/utils/crypto/CMakeLists.txt +++ b/src/aws-cpp-sdk-core/source/utils/crypto/CMakeLists.txt @@ -1,4 +1,3 @@ -message(WARNING "not complete implementation yet") if (USE_OPENSSL) add_subdirectory(openssl) endif ()