Skip to content

build dev 1.10 pr7 #1933

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 1 commit into from
May 20, 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
43 changes: 30 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,57 @@ if (LEGACY_BUILD)
project("aws-cpp-sdk-all" VERSION "${PROJECT_VERSION}" LANGUAGES CXX)
include(legacy_main)
else ()
message(STATUS "Building with 1.10 CMake scripts.")
message(STATUS "Building with new CMake scripts.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking in 1.11 release it may not make sense to keep updating this value.

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).")

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE
STRING "Choose the type of build." FORCE)
# cmake-gui helper
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(sdk_versioning)
obtain_project_version(SDK_PROJECT_VERSION)

find_package(Git QUIET) # Adding development helper tools as git_hash built when available.

include(project_version)
obtain_project_version(SDK_PROJECT_VERSION aws-cpp-sdk_GIT_HASH)

project("aws-cpp-sdk"
LANGUAGES CXX
VERSION ${SDK_PROJECT_VERSION}
DESCRIPTION ${DESCRIPTION_STRING}
HOMEPAGE_URL "https://docs.aws.amazon.com/sdk-for-cpp"
)

# Setting C++ minimum requirements
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

message(STATUS "Building ${PROJECT_NAME} ${CMAKE_PROJECT_VERSION}")

# Setting version header for library
configure_file(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Producing the VersionConfig header for the build.
Different than in LEGACY_BUILD this header is not overriding SRC files, it is produced into the BUILD.
The SRC file version from 1.9 is marked as deprecated for future removal.

VersionConfig.h.in
src/aws-cpp-sdk-core/include/aws/core/VersionConfig.h
@ONLY
)

message(WARNING "Anything below this warning is a TODO not yet implemented.")
# 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)
set(allowed_build_types Debug Release RelWithDebInfo MinSizeRel)
# cmake-gui helper
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${allowed_build_types}")
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build." FORCE)
elseif (NOT CMAKE_BUILD_TYPE IN_LIST allowed_build_types)
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}")
endif ()
endif ()
Comment on lines +53 to +64
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Validating that the right build type is requested and setting the default to RelWithDeb if omitted.

option(BUILD_TESTS "If enabled, the SDK will include tests in the build" OFF)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, no tests are build, creating option to enable them in the build.


message(WARNING "Anything below this warning is a TODO not yet implemented.")
message(STATUS "Detecting toolchain and external dependencies.")
message(STATUS "Prepare CRT dependency.")
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.")
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.10.0
18 changes: 18 additions & 0 deletions VersionConfig.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

#define AWS_CPP_SDK_VERSION_STRING "@aws-cpp-sdk_VERSION_STRING@"
#define AWS_CPP_SDK_VERSION_MAJOR @aws-cpp-sdk_VERSION_MAJOR@
#define AWS_CPP_SDK_VERSION_MINOR @aws-cpp-sdk_VERSION_MINOR@
#define AWS_CPP_SDK_VERSION_PATCH @aws-cpp-sdk_VERSION_PATCH@
#define AWS_CPP_SDK_GIT_HASH "@aws-cpp-sdk_GIT_HASH@"
Comment on lines +6 to +10
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added CPP tot he prefix to avoid collisions with defines in other SDKs that may be build together.


// DEPRECATED in 1.10: The follow defines are kept for backward compatibility
// Please prefer the use the new ones defined above
#define AWS_SDK_VERSION_STRING AWS_CPP_SDK_VERSION_STRING
#define AWS_SDK_VERSION_MAJOR AWS_CPP_SDK_VERSION_MAJOR
#define AWS_SDK_VERSION_MINOR AWS_CPP_SDK_VERSION_MINOR
#define AWS_SDK_VERSION_PATCH AWS_CPP_SDK_VERSION_PATCH

28 changes: 28 additions & 0 deletions cmake/project_version.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
include_guard()

function(obtain_project_version resultVarVersion resultVarGitHash)
if (GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git describe --abbrev=0 --tags
OUTPUT_VARIABLE VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
RESULT_VARIABLE git_result
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (NOT git_result)
set(${resultVarGitHash} ${GIT_HASH} PARENT_SCOPE)
message(STATUS "Building git hash: ${GIT_HASH}")
endif()
Comment on lines +4 to +19
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In dev environments, inside git repository, the version will be inferred from tags and git hash saved to the build.

endif ()

if (NOT VERSION_STRING) # Non DEV build relays on VERSION file updated by release CI
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" VERSION_STRING)
endif ()
Comment on lines +22 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In non dev builds, those with no git, the version will be read from a VERSION file in the root of the SDK sourcetree. This file is expected to be updated by CI at the release process. The placement in the root is to have easy access to it for human readers.


set(${resultVarVersion} ${VERSION_STRING} PARENT_SCOPE)
message(STATUS "SDK project version: ${VERSION_STRING}")
endfunction()
20 changes: 0 additions & 20 deletions cmake/sdk_versioning.cmake

This file was deleted.

1 change: 1 addition & 0 deletions src/aws-cpp-sdk-core/include/aws/core/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ namespace Version
AWS_CORE_API unsigned GetVersionMinor();
AWS_CORE_API unsigned GetVersionPatch();
AWS_CORE_API const char* GetCompilerVersionString();
AWS_CORE_API const char* GetGitHash();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For development builds, on releases this is empty.

} //namespace Version
} //namespace Aws
8 changes: 8 additions & 0 deletions src/aws-cpp-sdk-core/include/aws/core/VersionConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
* SPDX-License-Identifier: Apache-2.0.
*/

// DEPRECATED: This file is used by legacy_build generators only

#define AWS_SDK_VERSION_STRING "1.9.227"
#define AWS_SDK_VERSION_MAJOR 1
#define AWS_SDK_VERSION_MINOR 9
#define AWS_SDK_VERSION_PATCH 227
// Forward compatible definitions
#define AWS_CPP_SDK_VERSION_STRING AWS_SDK_VERSION_STRING
#define AWS_CPP_SDK_VERSION_MAJOR AWS_SDK_VERSION_MAJOR
#define AWS_CPP_SDK_VERSION_MINOR AWS_SDK_VERSION_MINOR
#define AWS_CPP_SDK_VERSION_PATCH AWS_SDK_VERSION_PATCH
#define AWS_CPP_SDK_GIT_HASH "NoHashAvailableInLegacyBuild"
Comment on lines +12 to +17
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for forward compatibility.

10 changes: 9 additions & 1 deletion src/aws-cpp-sdk-core/include/aws/core/VersionConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
* SPDX-License-Identifier: Apache-2.0.
*/

// DEPRECATED: This file is used by legacy_build generators only

#define AWS_SDK_VERSION_STRING "@AWSSDK_VERSION_STRING@"
#define AWS_SDK_VERSION_MAJOR @AWSSDK_VERSION_MAJOR@
#define AWS_SDK_VERSION_MINOR @AWSSDK_VERSION_MINOR@
#define AWS_SDK_VERSION_PATCH @AWSSDK_VERSION_PATCH@
#define AWS_SDK_VERSION_PATCH @AWSSDK_VERSION_PATCH@
// Forward compatible definitions
#define AWS_CPP_SDK_VERSION_STRING AWS_SDK_VERSION_STRING
#define AWS_CPP_SDK_VERSION_MAJOR AWS_SDK_VERSION_MAJOR
#define AWS_CPP_SDK_VERSION_MINOR AWS_SDK_VERSION_MINOR
#define AWS_CPP_SDK_VERSION_PATCH AWS_SDK_VERSION_PATCH
#define AWS_CPP_SDK_GIT_HASH "NoHashAvailableInLegacyBuild"
Comment on lines +12 to +17
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added for forward compatibilty

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I know CPP SDK sounds better, but we have AWS SDK CPP in most of the places.
nit 2: maybe GIT_SHA1 or _REVISION or GIT_TAG?

12 changes: 8 additions & 4 deletions src/aws-cpp-sdk-core/source/Version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ namespace Version
{
const char* GetVersionString()
{
return AWS_SDK_VERSION_STRING;
return AWS_CPP_SDK_VERSION_STRING;
}

unsigned GetVersionMajor()
{
return AWS_SDK_VERSION_MAJOR;
return AWS_CPP_SDK_VERSION_MAJOR;
}

unsigned GetVersionMinor()
{
return AWS_SDK_VERSION_MINOR;
return AWS_CPP_SDK_VERSION_MINOR;
}

unsigned GetVersionPatch()
{
return AWS_SDK_VERSION_PATCH;
return AWS_CPP_SDK_VERSION_PATCH;
}

const char* GetGitHash(){
return AWS_CPP_SDK_GIT_HASH;
}


Expand Down