2019-08-20 17:08:03 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu # we set this to catch errors and terminate
|
|
|
|
|
|
|
|
cd "$(dirname "$0")" || exit 1
|
|
|
|
|
2018-02-01 23:42:21 +00:00
|
|
|
# some environments have cmake v2 as 'cmake' and v3 as 'cmake3'
|
|
|
|
# check for cmake3 first then fallback to just cmake
|
2019-08-20 17:08:03 +00:00
|
|
|
|
|
|
|
if type cmake3 2>/dev/null; then
|
|
|
|
B_CMAKE=$(command -v "$(echo "$B_CMAKE" | cut -d' ' -f3)")
|
2018-02-24 19:39:30 +00:00
|
|
|
else
|
2019-08-20 17:08:03 +00:00
|
|
|
B_CMAKE=$(command -v cmake)
|
2018-02-24 19:39:30 +00:00
|
|
|
fi
|
2019-08-20 17:08:03 +00:00
|
|
|
|
2018-02-13 19:49:39 +00:00
|
|
|
# default build configuration
|
|
|
|
B_BUILD_TYPE=${B_BUILD_TYPE:-Debug}
|
2019-08-20 17:08:03 +00:00
|
|
|
|
|
|
|
if [ "$(uname -s)" = "Darwin" ]; then
|
2018-02-13 19:49:39 +00:00
|
|
|
# OSX needs a lot of extra help, poor thing
|
|
|
|
# run the osx_environment.sh script to fix paths
|
2019-08-20 17:08:03 +00:00
|
|
|
if [ -f "./osx_environment.sh" ]; then
|
|
|
|
. ./osx_environment.sh
|
|
|
|
fi
|
2018-07-02 09:12:47 +00:00
|
|
|
B_CMAKE_FLAGS="-DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 $B_CMAKE_FLAGS"
|
2018-02-13 19:49:39 +00:00
|
|
|
fi
|
2019-08-20 17:08:03 +00:00
|
|
|
|
2018-02-25 00:39:04 +00:00
|
|
|
# allow local customizations to build environment
|
2019-08-20 17:08:03 +00:00
|
|
|
if [ -f "./build_env.sh" ]; then
|
|
|
|
. ./build_env.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
set +eu # disable this temporarily
|
|
|
|
if [ -n "${B_CMAKE_FLAGS}" ]; then
|
|
|
|
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE ${B_CMAKE_FLAGS}"
|
|
|
|
else
|
|
|
|
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE"
|
|
|
|
fi
|
|
|
|
set -eu # enable this
|
|
|
|
|
2018-02-25 00:39:04 +00:00
|
|
|
rm -rf build
|
|
|
|
mkdir build || exit 1
|
|
|
|
cd build || exit 1
|
2019-08-20 17:08:03 +00:00
|
|
|
|
|
|
|
echo "Starting Barrier build..."
|
|
|
|
echo "Build type: ${B_BUILD_TYPE}"
|
|
|
|
|
|
|
|
"$B_CMAKE" "$B_CMAKE_FLAGS" .. || exit 1
|
|
|
|
|
2018-01-27 21:48:17 +00:00
|
|
|
make || exit 1
|
2019-08-20 17:08:03 +00:00
|
|
|
|
|
|
|
echo "Build completed successfully."
|