2019-08-23 05:03:18 +08:00
|
|
|
#!/bin/sh
|
2021-09-23 05:46:52 +08:00
|
|
|
cd "$(dirname "$0")" || exit 1
|
2018-02-02 07:42:21 +08:00
|
|
|
# some environments have cmake v2 as 'cmake' and v3 as 'cmake3'
|
|
|
|
# check for cmake3 first then fallback to just cmake
|
2019-08-23 05:03:18 +08:00
|
|
|
B_CMAKE=`type cmake3 2>/dev/null`
|
|
|
|
if [ $? -eq 0 ]; then
|
2021-09-23 05:46:52 +08:00
|
|
|
B_CMAKE=`echo "$B_CMAKE" | cut -d' ' -f3`
|
2018-02-25 03:39:30 +08:00
|
|
|
else
|
2019-08-23 05:03:18 +08:00
|
|
|
B_CMAKE=cmake
|
2018-02-25 03:39:30 +08:00
|
|
|
fi
|
2018-02-14 03:49:39 +08:00
|
|
|
# default build configuration
|
|
|
|
B_BUILD_TYPE=${B_BUILD_TYPE:-Debug}
|
2019-08-23 05:03:18 +08:00
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
2018-02-14 03:49:39 +08:00
|
|
|
# OSX needs a lot of extra help, poor thing
|
|
|
|
# run the osx_environment.sh script to fix paths
|
2019-08-23 05:03:18 +08:00
|
|
|
. ./osx_environment.sh
|
2018-07-02 17:12:47 +08: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-14 03:49:39 +08:00
|
|
|
fi
|
2018-02-25 08:39:04 +08:00
|
|
|
# allow local customizations to build environment
|
2019-08-23 05:03:18 +08:00
|
|
|
[ -r ./build_env.sh ] && . ./build_env.sh
|
2020-05-31 05:33:08 +08:00
|
|
|
|
|
|
|
# Initialise Git submodules
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
2019-08-23 05:03:18 +08:00
|
|
|
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=$B_BUILD_TYPE $B_CMAKE_FLAGS"
|
2018-02-25 08:39:04 +08:00
|
|
|
rm -rf build
|
|
|
|
mkdir build || exit 1
|
|
|
|
cd build || exit 1
|
2021-09-23 05:46:52 +08:00
|
|
|
echo "Starting Barrier $B_BUILD_TYPE build..."
|
2019-08-23 05:03:18 +08:00
|
|
|
$B_CMAKE $B_CMAKE_FLAGS .. || exit 1
|
2018-01-28 05:48:17 +08:00
|
|
|
make || exit 1
|
2019-08-23 05:03:18 +08:00
|
|
|
echo "Build completed successfully"
|