Skip to content

Commit 06891d7

Browse files
authored
Merge pull request #796 from redboltz/use_boost_manually_on_ci
Install boost manually.
2 parents 0a0c6a9 + 2bf0cfb commit 06891d7

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

.github/depends/boost.sh

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
3+
usage()
4+
{
5+
cat <<EOL
6+
-b - 32-bit or 64-bit library, maybe 32, 64 or both
7+
-t - the toolset, maybe gcc, clang or both
8+
EOL
9+
}
10+
11+
build_boost()
12+
{
13+
BASE=`pwd`/..
14+
./b2 -j4 --toolset=$1 --prefix=${BASE}/usr --with-chrono --with-date_time --with-filesystem --with-system --with-thread --with-program_options --with-log --with-test address-model=$2 install
15+
}
16+
17+
bit="64"
18+
toolset="gcc"
19+
20+
while getopts "b:t:" c; do
21+
case "$c" in
22+
b)
23+
bit="$OPTARG"
24+
[ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
25+
;;
26+
t)
27+
toolset="$OPTARG"
28+
[ "$toolset" != "gcc" ] && [ "$toolset" != "clang" ] && [ "$toolset" != "both" ] && usage && exit 1
29+
;;
30+
?*)
31+
echo "invalid arguments." && exit 1
32+
;;
33+
esac
34+
done
35+
36+
wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2
37+
tar xf boost_1_72_0.tar.bz2
38+
cd boost_1_72_0
39+
./bootstrap.sh
40+
41+
build()
42+
{
43+
if [ "$bit" = "both" ]; then
44+
build_boost $1 32
45+
build_boost $1 64
46+
else
47+
build_boost $1 $bit
48+
fi
49+
}
50+
51+
if [ "$toolset" = "both" ]; then
52+
build gcc
53+
build clang
54+
else
55+
build $toolset
56+
fi

.github/workflows/gha.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ jobs:
5151
steps:
5252
- name: Checkout
5353
uses: actions/checkout@v2
54+
- name: Cache boost
55+
id: cache-boost
56+
uses: actions/cache@v1
57+
with:
58+
path: usr
59+
key: ${{ runner.os }}-boost-20200107
60+
- name: Build boost
61+
if: steps.cache-boost.outputs.cache-hit != 'true'
62+
run: ./.github/depends/boost.sh -b 64 -t gcc
5463
- name: Configure
5564
env:
5665
S_CFLAGS: -Werror -g -Wall -Wextra -Wno-ignored-qualifiers -Wconversion -fno-omit-frame-pointer -fsanitize=address
@@ -73,7 +82,11 @@ jobs:
7382
[ ${{ matrix.pattern }} == 6 ] && FLAGS="-DCMAKE_CXX_COMPILER=g++ -DMQTT_CODECOV=ON -DMQTT_TEST_1=OFF -DMQTT_TEST_2=OFF -DMQTT_TEST_3=OFF -DMQTT_TEST_4=OFF -DMQTT_TEST_5=ON -DMQTT_TEST_6=ON -DMQTT_TEST_7=OFF -DMQTT_BUILD_EXAMPLES=OFF -DMQTT_USE_TLS=ON -DMQTT_USE_WS=ON -DMQTT_USE_STR_CHECK=ON -DMQTT_USE_LOG=OFF -DMQTT_STD_ANY=ON -DMQTT_STD_OPTIONAL=ON -DMQTT_STD_VARIANT=ON -DMQTT_STD_STRING_VIEW=ON -DMQTT_STD_SHARED_PTR_ARRAY=OFF"
7483
[ ${{ matrix.pattern }} == 7 ] && FLAGS="-DCMAKE_CXX_COMPILER=g++ -DMQTT_CODECOV=ON -DMQTT_TEST_1=OFF -DMQTT_TEST_2=OFF -DMQTT_TEST_3=OFF -DMQTT_TEST_4=OFF -DMQTT_TEST_5=OFF -DMQTT_TEST_6=OFF -DMQTT_TEST_7=ON -DMQTT_BUILD_EXAMPLES=ON -DMQTT_USE_TLS=ON -DMQTT_USE_WS=OFF -DMQTT_USE_STR_CHECK=OFF -DMQTT_USE_LOG=ON -DMQTT_STD_ANY=OFF -DMQTT_STD_OPTIONAL=OFF -DMQTT_STD_VARIANT=OFF -DMQTT_STD_STRING_VIEW=OFF -DMQTT_STD_SHARED_PTR_ARRAY=OFF"
7584
76-
BOOST_ROOT=$BOOST_ROOT_1_72_0 cmake -S ${{ github.workspace }} -B ${{ runner.temp }} ${FLAGS} -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}"
85+
echo "begin"
86+
echo ${{env.BOOST_ROOT}}
87+
echo "end"
88+
ls -al /home/runner/work/mqtt_cpp/mqtt_cpp/usr
89+
BOOST_ROOT=/home/runner/work/mqtt_cpp/mqtt_cpp/usr cmake -S ${{ github.workspace }} -B ${{ runner.temp }} ${FLAGS} -DCMAKE_C_FLAGS="${CFLAGS}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}"
7790
- name: Check Header Dependencies
7891
run: |
7992
cmake --build ${{ runner.temp }} --parallel $(nproc) --clean-first --target check_deps

0 commit comments

Comments
 (0)