Skip to content

Commit 7405193

Browse files
authored
Add a script for AL2 build in release mode (#3507)
* add a script for AL2 build in release mode * remove the script for release mode and add an argument to the script for debug mode
1 parent d59ac28 commit 7405193

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tools/scripts/build-tests/build-al2-debug-default.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0.
44

5-
# This script is an example of how to build the SDK on Debug build-type with minimize on and address sanitizers
5+
# This script is an example of how to build the SDK with minimize on (debugging information and address sanitizer enabled for Debug builds)
66
# Directories created and files are prefixed with PREFIX_DIR argument
77
# A clone of aws-sdk-cpp is expected to be in ${PREFIX_DIR}/aws-sdk-cpp
88
# Platform: Amazon Linux 2
99

1010
set -e
1111

12-
if [ "$#" -ne 1 ]; then
13-
echo "Usage: ${0} PREFIX_DIR"
12+
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
13+
echo "Usage: ${0} PREFIX_DIR [BUILD_TYPE]"
14+
echo "BUILD_TYPE defaults to Debug if not provided"
1415
exit 1
1516
fi
1617
PREFIX_DIR="$1"
18+
BUILD_TYPE="${2:-Debug}"
1719

1820
mkdir "${PREFIX_DIR}/al2-build"
1921
mkdir "${PREFIX_DIR}/al2-install"
2022
cd "${PREFIX_DIR}/al2-build"
21-
cmake -GNinja ../aws-sdk-cpp -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-ggdb -fsanitize=address" -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/al2-install" -DBUILD_PERFORMANCE_TESTS=ON
23+
CMAKE_ARGS=(-GNinja ../aws-sdk-cpp -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/al2-install" -DBUILD_PERFORMANCE_TESTS=ON)
24+
if [ "$BUILD_TYPE" = "Debug" ]; then
25+
CMAKE_ARGS+=(-DCMAKE_CXX_FLAGS="-ggdb -fsanitize=address")
26+
fi
27+
cmake "${CMAKE_ARGS[@]}"
2228
ninja-build -j $(grep -c ^processor /proc/cpuinfo)
2329
ninja-build install

0 commit comments

Comments
 (0)