2019-08-22 21:03:18 +00:00
|
|
|
#!/bin/sh
|
2021-11-04 21:48:48 +00:00
|
|
|
|
2021-09-22 21:46:52 +00:00
|
|
|
cd "$(dirname "$0")" || exit 1
|
2021-11-04 21:48:48 +00:00
|
|
|
|
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
|
2021-11-04 21:48:48 +00:00
|
|
|
|
|
|
|
B_CMAKE=$(command -v cmake3 2>/dev/null)
|
|
|
|
if [ "$?" -eq 0 ]; then
|
|
|
|
continue
|
2018-02-24 19:39:30 +00:00
|
|
|
else
|
2021-11-04 21:48:48 +00:00
|
|
|
# OK, so cmake3 isn't in path, so let's test to see if `cmake` itself exists, before proceeding.
|
|
|
|
if command -v cmake 2>/dev/null; then
|
|
|
|
B_CMAKE=$(command -v cmake)
|
|
|
|
# We have a cmake executable available, now let's proceed!
|
|
|
|
else
|
|
|
|
echo "ERROR: CMake not in $PATH, cannot build! Please install CMake, or if this persists, file a bug report."
|
|
|
|
exit 1
|
|
|
|
fi
|
2018-02-24 19:39:30 +00:00
|
|
|
fi
|
2021-11-04 21:48:48 +00:00
|
|
|
|
2021-11-05 16:25:27 +00:00
|
|
|
B_BUILD_TYPE="${B_BUILD_TYPE:-Debug}"
|
|
|
|
B_CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=${B_BUILD_TYPE} ${B_CMAKE_FLAGS:-}"
|
2021-11-04 21:48:48 +00:00
|
|
|
|
2019-08-22 21:03:18 +00:00
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
2021-11-04 21:48:48 +00:00
|
|
|
# macOS needs a little help, so we source this environment script to fix paths.
|
2021-11-05 20:06:25 +00:00
|
|
|
. ./macos_environment.sh
|
2021-11-04 21:48:48 +00:00
|
|
|
|
2021-11-05 16:25:27 +00:00
|
|
|
B_CMAKE_FLAGS="${B_CMAKE_FLAGS} -DCMAKE_OSX_SYSROOT=$(xcode-select --print-path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
|
2021-11-04 21:48:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Source local build variables to the environment, if available.
|
|
|
|
# If not, continue as normal, and silently.
|
|
|
|
if [ -e "./build_env.sh" ]; then
|
|
|
|
. "./build_env.sh"
|
2018-02-13 19:49:39 +00:00
|
|
|
fi
|
2020-05-30 21:33:08 +00:00
|
|
|
|
|
|
|
# Initialise Git submodules
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
2021-11-05 16:26:48 +00:00
|
|
|
rm -rf ./build
|
2021-11-05 19:59:06 +00:00
|
|
|
mkdir build
|
|
|
|
cd ./build
|
2021-11-04 21:48:48 +00:00
|
|
|
|
2021-11-05 19:59:06 +00:00
|
|
|
$B_CMAKE "$B_CMAKE_FLAGS" .. || exit 1
|
2021-11-04 21:48:48 +00:00
|
|
|
|
|
|
|
echo "INFO: Now commencing Barrier build process..."
|
|
|
|
echo "INFO: We're building an $B_BUILD_TYPE output type."
|
2021-11-05 19:59:06 +00:00
|
|
|
$(command -v make) || exit 1
|