2022-03-09 21:15:32 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
set -e
|
2020-01-19 14:04:59 +00:00
|
|
|
|
|
|
|
|
# Ensure we are in root directory
|
2021-01-02 20:32:30 -07: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 14:04:59 +00:00
|
|
|
cd $basedir
|
|
|
|
|
|
2020-01-24 11:46:12 +00:00
|
|
|
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
|
|
|
|
|
# Patch version.h
|
2022-03-09 20:56:47 -08:00
|
|
|
if [[ -n "$OPENRCT2_BUILD" ]]; then
|
2020-01-24 11:46:12 +00:00
|
|
|
echo -e "\033[0;36mPatching version.h...\033[0m"
|
|
|
|
|
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
|
|
|
|
|
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"
|
|
|
|
|
fileversion=${fileversion//./,}
|
2022-04-20 23:41:06 +02:00
|
|
|
# FILEVERSION in the resource file can only take up to 4 digits in the version string, so we remove the surplus of version numbers
|
|
|
|
|
fileversion=$(echo $fileversion | cut -f1-4 -d",")
|
2020-01-24 11:46:12 +00:00
|
|
|
echo "#define OPENRCT2_FILE_VERSION $fileversion" > "resources/version.h"
|
|
|
|
|
echo "#define OPENRCT2_PRODUCT_VERSION \"$productversion\"" >> "resources/version.h"
|
|
|
|
|
cat "resources/version.h"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Build everything
|
|
|
|
|
echo -e "\033[0;36mBuilding OpenRCT2 for Windows $CONFIGURATION|$PLATFORM...\033[0m"
|
2023-05-07 21:53:50 +02:00
|
|
|
vstool msbuild openrct2.proj -t:build -p:Breakpad=true -p:UsePCH=true
|
2020-01-24 11:46:12 +00: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 00:49:04 -07:00
|
|
|
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"
|
2021-01-02 21:31:34 -07:00
|
|
|
|
2022-06-06 10:07:07 +02:00
|
|
|
ninja -k0 all install
|
2020-01-19 14:04:59 +00:00
|
|
|
fi
|