Skip to content

Commit

Permalink
Cpp: CodeBuild, update legacy code (awsdocs#6386)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyertst-aws authored May 1, 2024
1 parent 429c855 commit b6adcf4
Show file tree
Hide file tree
Showing 48 changed files with 1,230 additions and 504 deletions.
48 changes: 48 additions & 0 deletions .doc_gen/metadata/codebuild_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,51 @@ codebuild_CreateProject:
- javascript.v3.codebuild.actions.CreateProject
services:
codebuild: {CreateProject}
codebuild_ListBuilds:
title: List &ACB; builds
title_abbrev: List builds
synopsis: list &ACB; builds.
category:
languages:
C++:
versions:
- sdk_version: 1
github: cpp/example_code/codebuild
excerpts:
- description:
snippet_tags:
- cpp.example_code.codebuild.ListBuilds
services:
codebuild: {ListBuilds}
codebuild_ListProjects:
title: List &ACB; projects
title_abbrev: List projects
synopsis: list &ACB; projects.
category:
languages:
C++:
versions:
- sdk_version: 1
github: cpp/example_code/codebuild
excerpts:
- description:
snippet_tags:
- cpp.example_code.codebuild.ListProjects
services:
codebuild: {ListProjects}
codebuild_StartBuild:
title: Start an &ACB; build
title_abbrev: Start a build
synopsis: start an &ACB; build.
category:
languages:
C++:
versions:
- sdk_version: 1
github: cpp/example_code/codebuild
excerpts:
- description:
snippet_tags:
- cpp.example_code.codebuild.StartBuild
services:
codebuild: {StartBuild}
2 changes: 1 addition & 1 deletion cpp/example_code/acm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ endif ()
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})


if (WINDOWS_BUILD)
if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
Expand Down
20 changes: 11 additions & 9 deletions cpp/example_code/acm/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ add_executable(
)

if (WINDOWS_BUILD)
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR} ${BIN_SUB_DIR}
)
if (AWSSDK_INSTALL_AS_SHARED_LIBS)
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR} ${BIN_SUB_DIR}
)
endif()

add_custom_command(
TARGET
Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/aurora/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if(MSVC AND BUILD_SHARED_LIBS)
if(WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
add_definitions(-DUSE_IMPORT_EXPORT)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

Expand Down
2 changes: 1 addition & 1 deletion cpp/example_code/aurora/hello_aurora/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif ()
# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

if (WINDOWS_BUILD)
if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
Expand Down
21 changes: 11 additions & 10 deletions cpp/example_code/aurora/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ add_executable(
# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if (MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DUSE_IMPORT_EXPORT)

set(CMAKE_BUILD_TYPE Debug) #Explicitly setting CMAKE_BUILD_TYPE is necessary in Windows to copy DLLs.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
)
if (AWSSDK_INSTALL_AS_SHARED_LIBS)
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR} ${BIN_SUB_DIR}
)
endif ()

add_custom_command(
TARGET
Expand Down
37 changes: 13 additions & 24 deletions cpp/example_code/autoscaling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ set(SERVICE_COMPONENTS autoscaling ec2 monitoring)
# Set this project's name.
project("${SERVICE_NAME}-examples")

# Build shared libraries by default.
set(BUILD_SHARED_LIBS ON)

# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})

# Set the location of where Windows can find the installed libraries of the SDK.
if(MSVC)
if (WINDOWS_BUILD)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif()
endif ()

# Set the C++ standard to use to build this target.
set(CMAKE_CXX_STANDARD 11)
Expand All @@ -24,26 +30,17 @@ if(BUILD_TESTS)
include(CTest)
endif()

# Build shared libraries by default.
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()

# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if(MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DUSE_IMPORT_EXPORT)
if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

set(CMAKE_BUILD_TYPE Debug) # Explicitly setting CMAKE_BUILD_TYPE is necessary in Windows to copy DLLs.

list(APPEND SERVICE_LIST ${SERVICE_COMPONENTS})
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

AWSSDK_CPY_DYN_LIBS(SERVICE_LIST "" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif()
AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR} ${BIN_SUB_DIR})
endif ()

# AWSDOC_SOURCE can be defined in the command line to limit the files in a build. For example,
# you can limit files to one action.
Expand All @@ -53,14 +50,6 @@ if(NOT DEFINED AWSDOC_SOURCE)
)
endif()

# Check whether the target system is Windows, including Win64.
if(WIN32)
# Check whether the compiler is some version of Microsoft Visual C++, or another compiler simulating C++.
if(MSVC)
source_group("Source Files" FILES ${AWSDOC_SOURCE})
endif(MSVC)
endif()

foreach(file ${AWSDOC_SOURCE})
get_filename_component(EXAMPLE ${file} NAME_WE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif ()
# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

if (WINDOWS_BUILD)
if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
Expand Down
36 changes: 18 additions & 18 deletions cpp/example_code/autoscaling/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ if(NOT GTest_FOUND)
FetchContent_MakeAvailable(googletest)
endif()

# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})

# Set the location for Windows to find the installed libraries of the SDK.
if(MSVC)
if (WINDOWS_BUILD)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif()
endif ()

# Build shared libraries by default.
if(NOT BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
set(BUILD_SHARED_LIBS ON)

# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${CURRENT_TARGET_AWS_DEPENDENCIES})
Expand All @@ -50,19 +51,18 @@ add_executable(
${CURRENT_TARGET}
)

# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if(MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DUSE_IMPORT_EXPORT)

set(CMAKE_BUILD_TYPE Debug) # Explicitly set this to support library copying and test automation.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
)
if (WINDOWS_BUILD)
if (AWSSDK_INSTALL_AS_SHARED_LIBS)
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
AWSSDK_CPY_DYN_LIBS(
CURRENT_TARGET_AWS_DEPENDENCIES
""
${CMAKE_CURRENT_BINARY_DIR} ${BIN_SUB_DIR}
)
endif ()

add_custom_command(
TARGET
Expand Down
44 changes: 18 additions & 26 deletions cpp/example_code/cloudwatch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,40 @@ set(SERVICE_COMPONENTS monitoring events logs)
# Set this project's name.
project("${SERVICE_NAME}-examples")

#Set the location of where Windows can find the installed libraries of the SDK.
if(MSVC)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif()
# Build shared libraries by default.
set(BUILD_SHARED_LIBS ON)

# Set the C++ standard to use to build this target.
set(CMAKE_CXX_STANDARD 11)

# Use the MSVC variable to determine if this is a Windows build.
set(WINDOWS_BUILD ${MSVC})

# Set the location of where Windows can find the installed libraries of the SDK.
if (WINDOWS_BUILD)
string(REPLACE ";" "/aws-cpp-sdk-all;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws-cpp-sdk-all")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
endif ()

# Enable CTest for testing these code examples.
if(BUILD_TESTS)
include(CTest)
endif()

# Build shared libraries by default.
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif()
# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})

# If the compiler is some version of Microsoft Visual C++, or another compiler simulating C++,
# and building as shared libraries, then dynamically link to those shared libraries.
if(MSVC AND BUILD_SHARED_LIBS)
add_definitions(-DUSE_IMPORT_EXPORT)
if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.

set(CMAKE_BUILD_TYPE Debug) # Explicitly setting CMAKE_BUILD_TYPE is necessary in Windows to copy DLLs.
# set(BIN_SUB_DIR "/Debug") # If you are building from the command line, you may need to uncomment this
# and set the proper subdirectory to the executables' location.

list(APPEND SERVICE_LIST ${SERVICE_COMPONENTS})

AWSSDK_CPY_DYN_LIBS(SERVICE_LIST "" ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE})
endif()
AWSSDK_CPY_DYN_LIBS(SERVICE_COMPONENTS "" ${CMAKE_CURRENT_BINARY_DIR} ${BIN_SUB_DIR})
endif ()

# AWSDOC_SOURCE can be defined in the command line to limit the files in a build. For example,
# you can limit files to one action.
Expand All @@ -59,14 +59,6 @@ if(NOT DEFINED AWSDOC_SOURCE)
)
endif()

# Check whether the target system is Windows, including Win64.
if(WIN32)
# Check whether the compiler is some version of Microsoft Visual C++, or another compiler simulating C++.
if(MSVC)
source_group("Source Files" FILES ${AWSDOC_SOURCE})
endif(MSVC)
endif()

foreach(file ${AWSDOC_SOURCE})
get_filename_component(EXAMPLE ${file} NAME_WE)

Expand Down
Loading

0 comments on commit b6adcf4

Please sign in to comment.