-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
build dev 1.10 pr7 #1933
Conversation
76776e4
to
b020bb5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented on the changes.
@@ -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.") |
There was a problem hiding this comment.
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.
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( |
There was a problem hiding this comment.
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.
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 () |
There was a problem hiding this comment.
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.
message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}") | ||
endif () | ||
endif () | ||
option(BUILD_TESTS "If enabled, the SDK will include tests in the build" OFF) |
There was a problem hiding this comment.
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.
#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@" |
There was a problem hiding this comment.
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.
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() |
There was a problem hiding this comment.
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.
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 () |
There was a problem hiding this comment.
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.
@@ -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(); |
There was a problem hiding this comment.
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.
// 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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added for forward compatibility.
#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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added for forward compatibilty
There was a problem hiding this comment.
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?
Issue #, if available: 1888
Description of changes:
Check all that applies:
No, but there were already.
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.