2020-01-19 15:04:59 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Ensure we are in root directory
|
2021-01-03 04:32:30 +01:00
|
|
|
if [[ $(uname) == "Darwin" ]]; then
|
|
|
|
basedir="$(perl -MCwd=abs_path -le 'print abs_path readlink(shift);' `dirname $0`/..)"
|
|
|
|
else
|
|
|
|
basedir="$(readlink -f `dirname $0`/..)"
|
|
|
|
fi
|
2020-01-19 15:04:59 +01:00
|
|
|
cd $basedir
|
|
|
|
|
2020-01-24 12:46:12 +01:00
|
|
|
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
|
|
|
|
# Patch version.h
|
|
|
|
if [[ "$OPENRCT2_BUILD" != "" ]]; then
|
|
|
|
echo -e "\033[0;36mPatching version.h...\033[0m"
|
|
|
|
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
|
|
|
|
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"
|
|
|
|
fileversion=${fileversion//./,}
|
|
|
|
echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h"
|
|
|
|
echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h"
|
|
|
|
cat "resources/version.h"
|
|
|
|
fi
|
2020-01-19 15:04:59 +01:00
|
|
|
|
2020-01-24 12:46:12 +01:00
|
|
|
# Build everything
|
|
|
|
echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m"
|
|
|
|
vstool msbuild openrct2.proj //t:build
|
2020-01-19 15:04:59 +01:00
|
|
|
|
2020-01-24 12:46:12 +01:00
|
|
|
# Create openrct2.exe and openrct2.com with correct subsystem
|
|
|
|
cp bin/openrct2.exe bin/openrct2.com
|
|
|
|
vstool editbin //subsystem:console bin/openrct2.com
|
|
|
|
vstool editbin //subsystem:windows bin/openrct2.exe
|
|
|
|
else
|
|
|
|
echo -e "\033[0;36mBuilding OpenRCT2...\033[0m"
|
|
|
|
mkdir -p bin && cd bin
|
|
|
|
export DESTDIR=install
|
2021-01-10 08:49:04 +01:00
|
|
|
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"
|
2021-01-03 05:31:34 +01:00
|
|
|
|
2020-01-24 12:46:12 +01:00
|
|
|
if [[ "$TESTPAINT" == "true" ]]; then
|
|
|
|
testpaint_target=testpaint
|
|
|
|
fi
|
2021-01-03 05:31:34 +01:00
|
|
|
|
2021-01-10 08:49:04 +01:00
|
|
|
ninja -k0 $testpaint_target all install
|
2020-01-24 12:46:12 +01:00
|
|
|
fi
|