-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor out CMake builds from the CI file
Allow reuse and a centralized place for improvements
- Loading branch information
Showing
6 changed files
with
161 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#! /bin/bash | ||
# | ||
# Copyright 2022 Alexander Grund | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
# Bash script to perform a CMake build of Boost | ||
# | ||
# Requires the following env vars: | ||
# - BOOST_ROOT & SELF (setup step) | ||
# - BCM_GENERATOR | ||
# - BCM_BUILD_TYPE | ||
# - BCM_SHARED_LIBS | ||
# - BCM_ARGS | ||
# - BCM_TARGET | ||
|
||
set -e | ||
|
||
. "$(dirname "${BASH_SOURCE[0]}")"/set_num_jobs.sh | ||
|
||
cd "$BOOST_ROOT" | ||
buildDir=__build | ||
while [ -d "$buildDir" ]; do | ||
buildDir="${buildDir}_2" | ||
done | ||
mkdir "$buildDir" && cd "$buildDir" | ||
|
||
echo "Configuring..." | ||
set -x | ||
cmake -G "$BCM_GENERATOR" -DCMAKE_BUILD_TYPE=$BCM_BUILD_TYPE -DBUILD_SHARED_LIBS=$BCM_SHARED_LIBS -DBOOST_INCLUDE_LIBRARIES=$SELF -DBoost_VERBOSE=ON "${BCM_ARGS[@]}" .. | ||
set +x | ||
|
||
echo "Building..." | ||
cmake --build . --target $BCM_TARGET --config $BCM_BUILD_TYPE -j$B2_JOBS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#! /bin/bash | ||
# | ||
# Copyright 2022 Alexander Grund | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
# Bash script to test consuming a Boost library via CMakes add_subdirectory command | ||
# | ||
# Requires the following env vars: | ||
# - BOOST_ROOT & SELF (setup step) | ||
# - BCM_GENERATOR | ||
# - BCM_BUILD_TYPE | ||
# - BCM_SHARED_LIBS | ||
|
||
set -eu | ||
|
||
echo "Installing Boost via CMake" | ||
BCM_INSTALL_PATH=/tmp/boost_install | ||
|
||
BCM_ARGS=( | ||
-DCMAKE_INSTALL_PREFIX=$BCM_INSTALL_PATH | ||
) | ||
BCM_TARGET=install | ||
|
||
. "$(dirname "${BASH_SOURCE[0]}")"/cmake_build.sh | ||
|
||
cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" | ||
# New unified folder used for the subdir and install test with BOOST_CI_INSTALL_TEST to distinguish in CMake | ||
if [ -d "$cmake_test_folder" ]; then | ||
echo "Using the unified test folder $cmake_test_folder" | ||
|
||
else | ||
cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_install_test" | ||
echo "Using the dedicated install test folder $cmake_test_folder" | ||
fi | ||
|
||
cd "$cmake_test_folder" | ||
mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ | ||
|
||
echo "Configuring..." | ||
cmake -G "$BCM_GENERATOR" -DCMAKE_BUILD_TYPE=$BCM_BUILD_TYPE -DBUILD_SHARED_LIBS=$BCM_SHARED_LIBS -DBOOST_CI_INSTALL_TEST=ON -DCMAKE_PREFIX_PATH=$BCM_INSTALL_PATH .. | ||
|
||
echo "Building..." | ||
cmake --build . --config $BCM_BUILD_TYPE -j$B2_JOBS | ||
|
||
echo "Testing..." | ||
ctest --output-on-failure --build-config $BCM_BUILD_TYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#! /bin/bash | ||
# | ||
# Copyright 2022 Alexander Grund | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
# Bash script to test consuming a Boost library via CMakes add_subdirectory command | ||
# | ||
# Requires the following env vars: | ||
# - BOOST_ROOT & SELF (setup step) | ||
# - BCM_GENERATOR | ||
# - BCM_BUILD_TYPE | ||
# - BCM_SHARED_LIBS | ||
|
||
set -eu | ||
|
||
. "$(dirname "${BASH_SOURCE[0]}")"/set_num_jobs.sh | ||
|
||
cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" | ||
# New unified folder used for the subdir and install test with BOOST_CI_INSTALL_TEST to distinguish in CMake | ||
if [ -d "$cmake_test_folder" ]; then | ||
echo "Using the unified test folder $cmake_test_folder" | ||
|
||
else | ||
cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_subdir_test" | ||
echo "Using the dedicated subdir test folder $cmake_test_folder" | ||
fi | ||
|
||
cd "$cmake_test_folder" | ||
mkdir __build_cmake_subdir_test__ && cd __build_cmake_subdir_test__ | ||
|
||
echo "Configuring..." | ||
cmake -G "$BCM_GENERATOR" -DCMAKE_BUILD_TYPE=$BCM_BUILD_TYPE -DBUILD_SHARED_LIBS=$BCM_SHARED_LIBS -DBOOST_CI_INSTALL_TEST=OFF .. | ||
|
||
echo "Building..." | ||
cmake --build . --config $BCM_BUILD_TYPE -j$B2_JOBS | ||
|
||
echo "Testing..." | ||
ctest --output-on-failure --build-config $BCM_BUILD_TYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#! /bin/bash | ||
# | ||
# Copyright 2022 Alexander Grund | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# (See accompanying file LICENSE_1_0.txt or copy at | ||
# http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
# Bash script to perform a CMake build of Boost | ||
# | ||
# Requires the following env vars: | ||
# - BOOST_ROOT & SELF (setup step) | ||
# - BCM_GENERATOR | ||
# - BCM_BUILD_TYPE | ||
# - BCM_SHARED_LIBS | ||
|
||
set -e | ||
|
||
BCM_ARGS=( | ||
-DBUILD_TESTING=ON | ||
) | ||
BCM_TARGET=tests | ||
|
||
. "$(dirname "${BASH_SOURCE[0]}")"/cmake_build.sh | ||
|
||
echo "Testing..." | ||
ctest --output-on-failure --build-config $BCM_BUILD_TYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters