Skip to content

Commit 669ad9f

Browse files
Merge pull request #102 from tony-ricciardi/build.sh
add scripts/build.sh
2 parents 7d39717 + 7cda955 commit 669ad9f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ WORKDIR /home/pyth
1414

1515
COPY --chown=pyth:pyth ${GITHUB_WORKSPACE} pyth-client/
1616

17-
RUN cd pyth-client && mkdir build && cd build && cmake .. && make && ctest
17+
RUN cd pyth-client && ./scripts/build.sh
1818

1919
RUN echo "\nexport PATH=\$PATH:\$HOME/pyth-client/build" >> .profile
2020

scripts/build.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
if [[ $# -ge 1 ]]
6+
then
7+
BUILD_DIR="$1"
8+
shift
9+
else
10+
THIS_DIR="$( dirname "${BASH_SOURCE[0]}" )"
11+
THIS_DIR="$( cd "${THIS_DIR}" && pwd )"
12+
ROOT_DIR="$( dirname "${THIS_DIR}" )"
13+
BUILD_DIR="${ROOT_DIR}/build"
14+
fi
15+
16+
ROOT_DIR="$( mkdir -p "${BUILD_DIR}" && cd "${BUILD_DIR}/.." && pwd )"
17+
BUILD_DIR="$( realpath --relative-to="${ROOT_DIR}" "${BUILD_DIR}" )"
18+
19+
if [[ ! -v CMAKE_ARGS && $BUILD_DIR == *debug* ]]
20+
then
21+
CMAKE_ARGS=( "-DCMAKE_BUILD_TYPE=Debug" )
22+
fi
23+
24+
set -x
25+
26+
cd "${ROOT_DIR}"
27+
rm -rf "${BUILD_DIR}"
28+
mkdir "${BUILD_DIR}"
29+
30+
cd "${BUILD_DIR}"
31+
cmake ${CMAKE_ARGS[@]+"${CMAKE_ARGS[@]}"} ..
32+
make "$@"
33+
ctest

0 commit comments

Comments
 (0)