Skip to content

Commit 50fc570

Browse files
author
Andrew Tang
committed
merge
1 parent 2325298 commit 50fc570

File tree

6,883 files changed

+65375
-49080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,883 files changed

+65375
-49080
lines changed

AWSSDK/AWSSDKConfig.cmake

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
#
2+
# Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
# When using AWSSDK package, users need to tell the installation root dir
17+
# by setting up variable as set(AWSSDK_ROOT_DIR, "<path/to/dir>")
18+
# In Windows the dir is like C:/Progra~1/AWSSDK/
19+
# In Unix like system the dir is like /usr/local/
20+
# if AWSSDK_ROOT_DIR doesn't appear, this module will identify it automatically
21+
22+
# By default:
23+
# The cmake files will all be in <prefix>/lib/cmake dir
24+
# The hearders will all be in <prefix>/include dir
25+
26+
# The libraries will all be in <prefix>/lib/<platform_prefix> dir
27+
# The binaries will all be in <prefix>/bin/<platform_prefix> dir
28+
# The archives will all be in <prefix>/lib/<platform_prefix> dir if target is shared,
29+
# otherwise will be in <prefix>/bin/<platform_prefix> dir.
30+
31+
# Platfrom_prefix is determined on compile time nbu option SIMPLE_INSTALL
32+
# such as "<linux/intel64>"
33+
34+
unset(AWSSDK_FOUND CACHE)
35+
36+
# set default platform prefix to "", but it could be inherited from platfromDeps if any
37+
unset(AWSSDK_PLATFORM_PREFIX CACHE)
38+
39+
include(${CMAKE_CURRENT_LIST_DIR}/AWSSDKConfigVersion.cmake)
40+
include(${CMAKE_CURRENT_LIST_DIR}/sdksCommon.cmake)
41+
include(${CMAKE_CURRENT_LIST_DIR}/platformDeps.cmake)
42+
43+
if (NOT AWSSDK_LIB_INSTALLDIR)
44+
set(AWSSDK_LIB_INSTALLDIR "lib")
45+
endif()
46+
47+
if (NOT AWSSDK_BIN_INSTALLDIR)
48+
set(AWSSDK_BIN_INSTALLDIR "bin")
49+
endif()
50+
51+
if (NOT AWSSDK_INCLUDE_INSTALLDIR)
52+
set(AWSSDK_INCLUDE_INSTALLDIR "include")
53+
endif()
54+
55+
# Compute the default installation root relative to this file.
56+
# from prefix/lib/cmake/AWSSDK/xx.cmake to prefix
57+
get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
58+
get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH)
59+
get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH)
60+
get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH)
61+
if(AWSSDK_DEFAULT_ROOT_DIR STREQUAL "/")
62+
set(AWSSDK_DEFAULT_ROOT_DIR "")
63+
endif()
64+
65+
# currently AWSSDK_ROOT_DIR is either empty or user specified
66+
if (AWSSDK_ROOT_DIR)
67+
find_file(AWSSDK_CORE_HEADER_FILE Aws.h
68+
"${AWSSDK_ROOT_DIR}/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core")
69+
else()
70+
find_file(AWSSDK_CORE_HEADER_FILE Aws.h
71+
"/usr/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
72+
"/usr/local/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
73+
"C:/Progra~1/AWSSDK/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
74+
"C:/Program Files/AWSSDK/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
75+
"C:/Program Files/aws-cpp-sdk-all/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
76+
"C:/Program Files (x86)/aws-cpp-sdk-all/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
77+
"C:/AWSSDK/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
78+
"${AWSSDK_DEFAULT_ROOT_DIR}/${AWSSDK_INCLUDE_INSTALLDIR}/aws/core"
79+
)
80+
endif()
81+
82+
if (NOT AWSSDK_CORE_HEADER_FILE)
83+
Message(FATAL_ERROR "AWSSDK is missing, install it first")
84+
endif()
85+
86+
# based on core header file path, inspects the actual AWSSDK_ROOT_DIR
87+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_CORE_HEADER_FILE}" PATH)
88+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
89+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
90+
get_filename_component(AWSSDK_ROOT_DIR "${AWSSDK_ROOT_DIR}" PATH)
91+
92+
if (NOT AWSSDK_ROOT_DIR)
93+
Message(FATAL_ERROR "AWSSDK core header file is
94+
${AWSSDK_CORE_HEADER_FILE}, but after retrieving, AWSSDK_ROOT_DIR
95+
becomes empty")
96+
endif()
97+
98+
99+
find_library(AWSSDK_CORE_LIB_FILE aws-cpp-sdk-core
100+
"${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}"
101+
"${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}/Debug"
102+
"${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}/DebugOpt"
103+
"${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}/Release"
104+
"${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}/RelWithDebInfo"
105+
"${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}/MinSizeRel"
106+
NO_DEFAULT_PATH)
107+
108+
109+
if (NOT AWSSDK_CORE_LIB_FILE)
110+
Message(FATAL_ERROR "AWSSDK header of core exists, but libray is missing")
111+
endif()
112+
113+
# based on AWSSDK_CORE_LIB_FILE path, inspects the actual AWSSDK_PLATFROM_PREFIX
114+
get_filename_component(TEMP_PATH "${AWSSDK_CORE_LIB_FILE}" PATH)
115+
get_filename_component(TEMP_NAME "${TEMP_PATH}" NAME)
116+
117+
while (NOT TEMP_NAME STREQUAL ${AWSSDK_LIB_INSTALLDIR})
118+
set(TEMP_PLATFORM_PREFIX "${TEMP_NAME}/${TEMP_PLATFORM_PREFIX}")
119+
get_filename_component(TEMP_PATH "${TEMP_PATH}" PATH)
120+
get_filename_component(TEMP_NAME "${TEMP_PATH}" NAME)
121+
endwhile()
122+
123+
set(AWSSDK_PLATFORM_PREFIX "${TEMP_PLATFORM_PREFIX}")
124+
125+
SET(AWSSDK_FOUND "1")
126+
set(AWSSDK_INCLUDE_DIR "${AWSSDK_ROOT_DIR}/${AWSSDK_INCLUDE_INSTALLDIR}")
127+
set(AWSSDK_CMAKE_DIR "${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/cmake")
128+
set(AWSSDK_LIB_DIR "${AWSSDK_ROOT_DIR}/${AWSSDK_LIB_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}")
129+
set(AWSSDK_BIN_DIR "${AWSSDK_ROOT_DIR}/${AWSSDK_BIN_INSTALLDIR}/${AWSSDK_PLATFORM_PREFIX}")
130+
131+
132+
if (AWSSDK_PLATFORM_DEPS_LIBS)
133+
set(AWSSDK_PLATFORM_DEPS "${AWSSDK_PLATFORM_DEPS_LIBS}")
134+
endif()
135+
136+
if (AWSSDK_CRYPTO_LIBS)
137+
set(AWSSDK_PLATFORM_DEPS "${AWSSDK_PLATFORM_DEPS}" "${AWSSDK_CRYPTO_LIBS}")
138+
endif()
139+
140+
if (AWSSDK_CLIENT_LIBS)
141+
set(AWSSDK_PLATFORM_DEPS "${AWSSDK_PLATFORM_DEPS}" "${AWSSDK_CLIENT_LIBS}")
142+
endif()
143+
144+
if (AWSSDK_ADDITIONAL_LIBS)
145+
set(AWSSDK_PLATFORM_DEPS "${AWSSDK_PLATFORM_DEPS}" "${AWSSDK_ADDITIONAL_LIBS}")
146+
endif()
147+
148+
Message(STATUS "Find AWSSDK, Version: ${PACKAGE_VERSION}, install Root:${AWSSDK_ROOT_DIR}, Platform prefix:${AWSSDK_PLATFORM_PREFIX}, Platform Dependent Libraries: ${AWSSDK_PLATFORM_DEPS}")
149+
150+
151+
# copy libs of services in SERVICE_LIST and all there dependent libs to DEST_DIR
152+
# CONFIG denote copy release or debug version
153+
macro(AWSSDK_CPY_DYN_LIBS SERVICE_LIST CONFIG DEST_DIR)
154+
set(ALL_SERVICES "core")
155+
156+
foreach(SVC IN LISTS ${SERVICE_LIST})
157+
list(APPEND ALL_SERVICES ${SVC})
158+
get_dependencies_for_sdk(${SVC} DEPENDENCY_LIST)
159+
if (DEPENDENCY_LIST)
160+
STRING(REPLACE "," ";" LIST_RESULT ${DEPENDENCY_LIST})
161+
list(APPEND ALL_SERVICES ${LIST_RESULT})
162+
endif()
163+
unset(DEPENDENCY_LIST CACHE)
164+
endforeach()
165+
list(REMOVE_DUPLICATES ALL_SERVICES)
166+
167+
foreach(SVC IN LISTS ALL_SERVICES)
168+
find_library(LIB_PATH "aws-cpp-sdk-${SVC}" "${AWSSDK_LIB_DIR}/${CONFIG}" NO_DEFAULT_PATH)
169+
if (NOT LIB_PATH)
170+
Message(FATAL_ERROR "Couldn't find library aws-cpp-sdk-${SVC}")
171+
endif()
172+
execute_process(COMMAND cp ${LIB_PATH} ${DEST_DIR})
173+
unset(LIB_PATH CACHE)
174+
endforeach()
175+
endmacro(AWSSDK_CPY_DYN_LIBS)
176+
177+
# output link libs command to OUTPUT_VAR which required by all services from SERVCE_LIST
178+
macro(AWSSDK_DETERMINE_LIBS_TO_LINK SERVICE_LIST OUTPUT_VAR)
179+
set(ALL_SERVICES "core")
180+
181+
foreach(SVC IN LISTS ${SERVICE_LIST})
182+
list(APPEND ALL_SERVICES ${SVC})
183+
get_dependencies_for_sdk(${SVC} DEPENDENCY_LIST)
184+
if (DEPENDENCY_LIST)
185+
STRING(REPLACE "," ";" LIST_RESULT ${DEPENDENCY_LIST})
186+
list(APPEND ALL_SERVICES ${LIST_RESULT})
187+
endif()
188+
unset(DEPENDENCY_LIST CACHE)
189+
endforeach()
190+
list(REMOVE_DUPLICATES ALL_SERVICES)
191+
set(${OUTPUT_VAR} "")
192+
foreach(DEP IN LISTS ALL_SERVICES)
193+
list(APPEND ${OUTPUT_VAR} "aws-cpp-sdk-${DEP}")
194+
endforeach()
195+
endmacro(AWSSDK_DETERMINE_LIBS_TO_LINK)
196+
197+
# output high level lib dependencies such as for transfter; sqs; dynamodb etc.
198+
macro(AWSSDK_LIB_DEPS HIGH_LEVEL_LIB_NAME OUTPUT_VAR)
199+
get_dependencies_for_sdk(${HIGH_LEVEL_LIB_NAME} DEPENDENCY_LIST)
200+
if (DEPENDENCY_LIST)
201+
STRING(REPLACE "," ";" ${OUTPUT_VAR} ${DEPENDENCY_LIST})
202+
list(APPEND ALL_SERVICES ${LIST_RESULT})
203+
endif()
204+
list(APPEND ${OUTPUT_VAR} "core")
205+
list(REMOVE_DUPLICATES ${OUTPUT_VAR})
206+
endmacro(AWSSDK_LIB_DEPS)

AWSSDK/CMakeLists.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License").
5+
# You may not use this file except in compliance with the License.
6+
# A copy of the License is located at
7+
#
8+
# http://aws.amazon.com/apache2.0
9+
#
10+
# or in the "license" file accompanying this file. This file is distributed
11+
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
# express or implied. See the License for the specific language governing
13+
# permissions and limitations under the License.
14+
#
15+
16+
17+
add_project(AWSSDK "User friendly cmake creator")
18+
19+
# create a new version file for AWSSDK, then find_package will return latest PACKAGE_VERSION
20+
write_basic_package_version_file(
21+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
22+
VERSION ${PROJECT_VERSION}
23+
COMPATIBILITY AnyNewerVersion
24+
)
25+
26+
file(WRITE
27+
"${CMAKE_CURRENT_BINARY_DIR}/platformDeps.cmake"
28+
"#
29+
# Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
30+
#
31+
# Licensed under the Apache License, Version 2.0 (the \"License\").
32+
# You may not use this file except in compliance with the License.
33+
# A copy of the License is located at
34+
#
35+
# http://aws.amazon.com/apache2.0
36+
#
37+
# or in the \"license\" file accompanying this file. This file is distributed
38+
# on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
39+
# express or implied. See the License for the specific language governing
40+
# permissions and limitations under the License.
41+
#\n"
42+
"SET(AWSSDK_PLATFORM_DEPS_LIBS ${PLATFORM_DEP_LIBS_ABSTRACT_NAME})\n"
43+
"SET(AWSSDK_CLIENT_LIBS ${CLIENT_LIBS_ABSTRACT_NAME})\n"
44+
"SET(AWSSDK_CRYPTO_LIBS ${CRYPTO_LIBS_ABSTRACT_NAME})\n"
45+
"SET(AWSSDK_ADDITIONAL_LIBS ${AWS_SDK_ADDITIONAL_LIBRARIES_ABSTRACT_NAME})\n"
46+
"SET(AWSSDK_LIB_INSTALLDIR ${LIBRARY_DIRECTORY})\n"
47+
"SET(AWSSDK_BIN_INSTALLDIR ${BINARY_DIRECTORY})\n"
48+
"SET(AWSSDK_INCLUDE_INSTALLDIR ${INCLUDE_DIRECTORY})\n"
49+
"SET(AWSSDK_ARCHIVE_INSTALLDIR ${ARCHIVE_DIRECTORY})\n"
50+
)
51+
52+
if (NOT SIMPLE_INSTALL)
53+
file(APPEND
54+
"${CMAKE_CURRENT_BINARY_DIR}/platformDeps.cmake"
55+
"SET(AWSSDK_PLATFORM_PREFIX ${SDK_INSTALL_BINARY_PREFIX}/${PLATFORM_INSTALL_QUALIFIER})\n")
56+
endif()
57+
58+
# copy version file to destination
59+
install(
60+
FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
61+
DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}")
62+
63+
# copy config file to destination, this file is vital for cmake to find correct package.
64+
# useful macros and variables will be included in this cmake file for user to use
65+
install(
66+
FILES "${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake"
67+
DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}")
68+
69+
# to make compile time settings consistent with user usage time settings, we copy common settings to
70+
# destination. These settings will be included by ${PROJECT_NAME}-config.cmake
71+
72+
# internal dependencies
73+
install(
74+
FILES "${CMAKE_SOURCE_DIR}/cmake/sdksCommon.cmake"
75+
DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}/")
76+
77+
# platform external dependencies
78+
install(
79+
FILES "${CMAKE_CURRENT_BINARY_DIR}/platformDeps.cmake"
80+
DESTINATION "${LIBRARY_DIRECTORY}/cmake/${PROJECT_NAME}/")

CMakeLists.txt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
# Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License").
55
# You may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ find_package(Git)
2626

2727
# Cmake invocation variables:
2828
# CUSTOM_MEMORY_MANAGEMENT - if set to 1, generates the sdk project files with custom memory management enabled, otherwise disables it
29-
# BUILD_ONLY - a semi-colon delimited list, if this is set we will build only the projects listed. Core will always be built as will its unit tests.
29+
# BUILD_ONLY - only build xxx, a semi-colon delimited list, if this is set we will build only the projects listed. Core will always be built as will its unit tests.
3030
# Also if a high level client is specified then we will build its dependencies as well. If a project has tests, the tests will be built.
3131
# REGENERATE_CLIENTS - all clients being built on this run will be regenerated from the api definitions, this option involves some setup of python, java 8, jdk 1.8, and maven
3232
# ADD_CUSTOM_CLIENTS - semi-colon delimited list of format serviceName=<yourserviceName>,version=<theVersionNumber>;serviceName2=<yourOtherServiceName>,version=<versionNumber2>
@@ -67,8 +67,12 @@ endif()
6767

6868
SET(PYTHON_CMD "python")
6969

70+
# CMAKE_MODULE_PATH is a CMAKE variable. It contains a list of paths
71+
# which could be used to search CMAKE modules by "include()" or "find_package()", but the default value is empty.
72+
# Add cmake dir to search list
7073
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
7174

75+
# include() will "load and run" cmake script
7276
include(resolve_platform)
7377
include(CMakePackageConfigHelpers)
7478

@@ -125,19 +129,45 @@ include(build_external)
125129

126130
if(ENABLE_BCRYPT_ENCRYPTION)
127131
set(CRYPTO_LIBS Bcrypt)
132+
set(CRYPTO_LIBS_ABSTRACT_NAME Bcrypt)
128133
elseif(ENABLE_OPENSSL_ENCRYPTION)
129134
set(CRYPTO_LIBS ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
135+
set(CRYPTO_LIBS_ABSTRACT_NAME ssl z)
130136
endif()
131137

132138
if(ENABLE_CURL_CLIENT)
133139
set(CLIENT_LIBS ${CURL_LIBRARIES})
140+
set(CLIENT_LIBS_ABSTRACT_NAME curl)
134141
elseif(ENABLE_WINDOWS_CLIENT)
135142
if(USE_IXML_HTTP_REQUEST_2)
136143
set(CLIENT_LIBS msxml6 runtimeobject)
144+
set(CLIENT_LIBS_ABSTRACT_NAME msxml6 runtimeobject)
137145
else()
138146
set(CLIENT_LIBS Wininet winhttp)
147+
set(CLIENT_LIBS_ABSTRACT_NAME Wininet winhttp)
139148
endif()
140149
endif()
141150

151+
# setup user specified installation directory if any, regardless previous platform default settings
152+
if (CMAKE_INSTALL_BINDIR)
153+
SET(BINARY_DIRECTORY "${CMAKE_INSTALL_BINDIR}")
154+
endif()
155+
156+
if (CMAKE_INSTALL_LIBDIR)
157+
SET(LIBRARY_DIRECTORY "${CMAKE_INSTALL_LIBDIR}")
158+
endif()
159+
160+
if (CMAKE_INSTALL_INCLUDEDIR)
161+
SET(INCLUDE_DIRECTORY "${CMAKE_INSTALL_INCLUDEDIR}")
162+
endif()
163+
164+
if(BUILD_SHARED_LIBS)
165+
SET(ARCHIVE_DIRECTORY "${BINARY_DIRECTORY}")
166+
else()
167+
SET(ARCHIVE_DIRECTORY "${LIBRARY_DIRECTORY}")
168+
endif()
169+
142170
add_sdks()
143171

172+
# for user friendly sdk manager
173+
add_subdirectory(AWSSDK)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,8 @@ You can use the AWSCredentialProvider interface to provide login credentials to
455455
The default credential provider chain does the following:
456456
* Checks your environment variables for AWS Credentials
457457
* Checks your $HOME/.aws/credentials file for a profile and credentials
458-
* Contacts the EC2MetadataInstanceProfile service to request credentials
458+
* Contacts the ECSCredentialsProvider service to request credentials
459+
* If ECSCredentialsProvider is not available then contacts the EC2MetadataInstanceProfile service to request credentials
459460

460461
The simplest way to communicate with AWS is to ensure we can find your credentials in one of these locations.
461462

0 commit comments

Comments
 (0)