Skip to content

Build dev 1.10 pr11 #2028

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
Aug 10, 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
24 changes: 23 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ else ()
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Setting flags for telling compiler this is a non-legacy build
add_definitions(-DNON_LEGACY_BUILD)

# Setting build to hide symbols in targets by default
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
Expand All @@ -56,6 +59,13 @@ else ()
@ONLY
)

message(STATUS "Generating source file SDKConfig.h for setting memory management options")
configure_file(
SDKConfig.h.in
src/aws-cpp-sdk-core/include/aws/core/SDKConfig.h
@ONLY
)

# Validating config type and setting default if needed
get_property(is_multi_conf_build GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT is_multi_conf_build)
Expand Down Expand Up @@ -86,13 +96,25 @@ else ()

# -- 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not follow HEAD? from their page

GoogleTest now follows the Abseil Live at Head philosophy. We recommend [updating to the latest commit in the main branch as often as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we know what version works with our build at this particular version. If head is not backward compatible at some point tests of old versions of SDK will not work anymore.

include(GoogleTest) # for gtest_discover_tests()
endif ()
endif ()

# -- main build targets --
add_subdirectory(src)

# -- Tests and packaging if running this as top project --
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_subdirectory(tests)
# Testing Dependencies
if (BUILD_TESTING)
add_subdirectory(tests)
endif ()
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")
Expand Down
7 changes: 7 additions & 0 deletions SDKConfig.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#cmakedefine USE_AWS_MEMORY_MANAGEMENT

17 changes: 4 additions & 13 deletions cmake/Findaws-crt-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,8 @@ message(WARNING "aws-crt-cpp package is mocked for testing of experimental featu
# 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
)

set(aws-crt-cpp_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include PARENT_SCOPE)
set(aws-crt-cpp_LIB_DIRS ${CMAKE_INSTALL_PREFIX}/lib PARENT_SCOPE)


1 change: 0 additions & 1 deletion crt/aws-crt-cpp
Submodule aws-crt-cpp deleted from 3e55d5
8 changes: 0 additions & 8 deletions dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# 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)
Expand Down
23 changes: 22 additions & 1 deletion src/aws-cpp-sdk-core-tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
if (NOT LEGACY_BUILD)
message(WARNING "Building core with new cmake scripts not yet implemented")
add_library(aws-sdk-cpp-test-resources)
add_library(aws-sdk-cpp::test-resources ALIAS aws-sdk-cpp-test-resources)
target_link_libraries(
aws-sdk-cpp-test-resources
aws-sdk-cpp::core
)
add_subdirectory(testing-resources)

add_executable(
aws-core-version
${CMAKE_CURRENT_LIST_DIR}/VersionTests.cpp
${CMAKE_CURRENT_LIST_DIR}/RunTests.cpp
)
target_link_libraries(
aws-core-version
PRIVATE GTest::GTest
PRIVATE aws-sdk-cpp::core
PRIVATE aws-sdk-cpp::test-resources
)

# add_subdirectory(monitoring)
message(WARNING "Not testing everything yet...")
else ()
add_project(aws-cpp-sdk-core-tests
"Tests for the AWS Core C++ Library"
Expand Down
4 changes: 4 additions & 0 deletions src/aws-cpp-sdk-core-tests/VersionTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* SPDX-License-Identifier: Apache-2.0.
*/

#ifdef NON_LEGACY_BUILD
#include <gtest/gtest.h>
#else
#include <aws/external/gtest.h>
#endif
#include <aws/core/utils/StringUtils.h>
#include <aws/core/Version.h>

Expand Down
14 changes: 14 additions & 0 deletions src/aws-cpp-sdk-core-tests/monitoring/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_executable(
aws-core-monitoring
${CMAKE_CURRENT_LIST_DIR}/MonitoringEndToEndTest.cpp
${CMAKE_CURRENT_LIST_DIR}/MonitoringTest.cpp
)
target_include_directories(
aws-core-monitoring
PRIVATE GTest::GTest
)
target_link_libraries(
aws-core-monitoring
PRIVATE GTest::GTest
PRIVATE aws-sdk-cpp::core
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* SPDX-License-Identifier: Apache-2.0.
*/

#ifdef NON_LEGACY_BUILD
#include <gtest/gtest.h>
#else
#include <aws/external/gtest.h>
#endif
#include <aws/core/client/AWSError.h>
#include <aws/testing/mocks/aws/client/MockAWSClient.h>
#include <aws/testing/platform/PlatformTesting.h>
Expand Down
5 changes: 4 additions & 1 deletion src/aws-cpp-sdk-core-tests/monitoring/MonitoringTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/

#ifdef NON_LEGACY_BUILD
#include <gtest/gtest.h>
#else
#include <aws/external/gtest.h>
#endif
#include <aws/testing/mocks/aws/client/MockAWSClient.h>
#include <aws/core/monitoring/CoreMetrics.h>
#include <aws/core/monitoring/MonitoringInterface.h>
Expand Down
134 changes: 134 additions & 0 deletions src/aws-cpp-sdk-core-tests/testing-resources/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
#
if (NOT LEGACY_BUILD)
add_subdirectory(include)
add_subdirectory(source)
else()
add_project(testing-resources
"Testing utility library for the AWS C++ SDK"
aws-cpp-sdk-core)

include(GenerateExportHeader)

file(GLOB AWS_TESTING_HEADERS "include/aws/testing/*.h")
file(GLOB AWS_TESTING_EXTERNAL_HEADERS "include/aws/external/*.h")
file(GLOB AWS_TESTING_AUTH_MOCKS_HEADERS "include/aws/testing/mocks/aws/auth/*.h")
file(GLOB AWS_TESTING_EVENT_MOCKS_HEADERS "include/aws/testing/mocks/event/*.h")
file(GLOB AWS_TESTING_HTTP_MOCKS_HEADERS "include/aws/testing/mocks/http/*.h")
file(GLOB AWS_TESTING_CLIENT_MOCKS_HEADERS "include/aws/testing/mocks/aws/client/*.h")
file(GLOB AWS_TESTING_MONITORING_MOCKS_HEADERS "include/aws/testing/mocks/monitoring/*.h")
file(GLOB AWS_TESTING_PLATFORM_HEADERS "include/aws/testing/platform/*.h")

file(GLOB AWS_TESTING_SOURCE "source/*.cpp")
file(GLOB AWS_TESTING_EXTERNAL_SOURCE "source/external/*.cc")

file(GLOB TestingResources_SHARED_SRC
${AWS_TESTING_HEADERS}
${AWS_TESTING_EXTERNAL_HEADERS}
${AWS_TESTING_AUTH_MOCKS_HEADERS}
${AWS_TESTING_EVENT_MOCKS_HEADERS}
${AWS_TESTING_HTTP_MOCKS_HEADERS}
${AWS_TESTING_CLIENT_MOCKS_HEADERS}
${AWS_TESTING_MONITORING_MOCKS_HEADERS}
${AWS_TESTING_PLATFORM_HEADERS}
${AWS_TESTING_SOURCE}
${AWS_TESTING_EXTERNAL_SOURCE}
)

if(PLATFORM_ANDROID)
file(GLOB AWS_TESTING_PLATFORM_ANDROID_HEADERS "include/aws/testing/platform/android/*.h")
file(GLOB AWS_TESTING_PLATFORM_ANDROID_SOURCE "source/platform/android/*.cpp")

file(GLOB TestingResources_PLATFORM_SRC ${AWS_TESTING_ANDROID_HEADERS} ${AWS_TESTING_ANDROID_SOURCE})
file(GLOB TestingResources_PLATFORM_SRC ${AWS_TESTING_PLATFORM_ANDROID_HEADERS} ${AWS_TESTING_PLATFORM_ANDROID_SOURCE})
elseif(PLATFORM_WINDOWS)
file(GLOB TestingResources_PLATFORM_SRC "source/platform/windows/*.cpp")
elseif(PLATFORM_LINUX OR PLATFORM_APPLE)
file(GLOB TestingResources_PLATFORM_SRC "source/platform/linux-shared/*.cpp")
elseif(PLATFORM_CUSTOM)
gather_custom_testing_source(TestingResources_PLATFORM_SRC)
endif()

if(PLATFORM_WINDOWS)
if(MSVC)
source_group("Header Files\\aws\\testing" FILES ${AWS_TESTING_HEADERS})
source_group("Header Files\\aws\\testing\\platform" FILES ${AWS_TESTING_PLATFORM_HEADERS})
source_group("Header Files\\aws\\external" FILES ${AWS_TESTING_EXTERNAL_HEADERS})
source_group("Header Files\\aws\\testing\\mocks\\aws\\auth" FILES ${AWS_TESTING_AUTH_MOCKS_HEADERS})
source_group("Header Files\\aws\\testing\\mocks\\event" FILES ${AWS_TESTING_EVENT_MOCKS_HEADERS})
source_group("Header Files\\aws\\testing\\mocks\\http" FILES ${AWS_TESTING_HTTP_MOCKS_HEADERS})
source_group("Header Files\\aws\\testing\\mocks\\aws\\client" FILES ${AWS_TESTING_CLIENT_MOCKS_HEADERS})
source_group("Header Files\\aws\\testing\\mocks\\monitoring" FILES ${AWS_TESTING_MONITORING_MOCKS_HEADERS})
source_group("Source Files" FILES ${AWS_TESTING_SOURCE})
source_group("Source Files\\external" FILES ${AWS_TESTING_EXTERNAL_SOURCE})
source_group("Source Files\\platform\\windows" FILES ${TestingResources_PLATFORM_SRC})
endif(MSVC)
endif()

file(GLOB TestingResources_SRC
${TestingResources_SHARED_SRC}
${TestingResources_PLATFORM_SRC}
)

set(INCLUDES
"include"
)

if(PLATFORM_CUSTOM)
if(COMMAND add_custom_core_include_directories)
add_custom_core_include_directories(CUSTOM_INCLUDE)
set(INCLUDES ${INCLUDES} ${CUSTOM_INCLUDE})
endif()
if(COMMAND add_custom_definitions)
add_custom_definitions()
endif()
endif()

include_directories(${INCLUDES})

if(USE_WINDOWS_DLL_SEMANTICS AND BUILD_SHARED_LIBS)
add_definitions(-DAWS_TESTING_EXPORTS=1)
add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
endif()

if(PLATFORM_WINDOWS)
add_definitions("-DDISABLE_HOME_DIR_REDIRECT")
endif()

add_library(${PROJECT_NAME} ${TestingResources_SRC})
add_library(AWS::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

set_compiler_flags(${PROJECT_NAME})
set_compiler_warnings(${PROJECT_NAME})

if(PLATFORM_CUSTOM)
add_custom_testing_target_compile_definitions()
endif()

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(${PROJECT_NAME} ${PLATFORM_DEP_LIBS} ${PROJECT_LIBS})

if(COMMAND add_custom_testing_link_libraries)
add_custom_testing_link_libraries()
endif()

if(COMMAND add_custom_testing_target_compile_definitions)
add_custom_testing_target_compile_definitions()
endif()

setup_install()

install (FILES ${AWS_TESTING_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing)
install (FILES ${AWS_TESTING_EXTERNAL_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/external)
install (FILES ${AWS_TESTING_PLATFORM_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing/platform)
install (FILES ${AWS_TESTING_AUTH_MOCKS_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing/mocks/aws/auth)
install (FILES ${AWS_TESTING_CLIENT_MOCKS_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing/mocks/aws/client)
install (FILES ${AWS_TESTING_EVENT_MOCKS_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing/mocks/event)
install (FILES ${AWS_TESTING_HTTP_MOCKS_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing/mocks/http)
install (FILES ${AWS_TESTING_MONITORING_MOCKS_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/testing/mocks/monitoring)

do_packaging()
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target_include_directories(
aws-sdk-cpp-test-resources
BEFORE
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target_sources(
aws-sdk-cpp-test-resources
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/MemoryTesting.cpp
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/TestingEnvironment.cpp
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/platform/linux-shared/PlatformTesting.cpp
)
18 changes: 16 additions & 2 deletions src/aws-cpp-sdk-core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
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}
PUBLIC ${aws-crt-cpp_INCLUDE_DIRS}
PUBLIC ${CJSON_INCLUDE_DIRS}
PUBLIC ${tinyxml2_INCLUDE_DIRS}
)
target_link_directories(
aws-sdk-cpp-core
PUBLIC ${aws-crt-cpp_LIB_DIRS}
PUBLIC ${CJSON_LIBRARY_DIRS}
PUBLIC ${tinyxml2_LIBRARY_DIRS}
)
target_link_libraries(
aws-sdk-cpp-core
aws-crt-cpp aws-c-common aws-checksums
${CJSON_LIBRARIES}
${tinyxml2_LIBRARIES}
)
add_subdirectory(include)
add_subdirectory(source)
Expand Down
2 changes: 2 additions & 0 deletions src/aws-cpp-sdk-core/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
target_include_directories(
aws-sdk-cpp-core
BEFORE
PUBLIC ${CMAKE_CURRENT_BINARY_DIR} #For generated Headers as VersionConfig and SDKConfig
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
Loading