OpenRCT2/scripts/build-emscripten
2025-01-20 08:06:06 -06:00

36 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
mkdir -p build
cd build
START_DIR=$(pwd)
SPEEXDSP_ROOT=/ext/speexdsp
ICU_ROOT=/ext/icu/icu4c/source
LIBZIP_ROOT=/ext/libzip
JSON_DIR=/usr/include/nlohmann/
emcmake cmake ../ \
-G Ninja \
-DDISABLE_NETWORK=ON \
-DDISABLE_HTTP=ON \
-DDISABLE_TTF=ON \
-DDISABLE_FLAC=ON \
-DDISABLE_DISCORD_RPC=ON \
-DCMAKE_SYSTEM_NAME=Emscripten \
-DCMAKE_BUILD_TYPE=Release \
-DSPEEXDSP_INCLUDE_DIR="$SPEEXDSP_ROOT/include/" \
-DSPEEXDSP_LIBRARY="$SPEEXDSP_ROOT/libspeexdsp/.libs/libspeexdsp.a" \
-DICU_INCLUDE_DIR="$ICU_ROOT/common" \
-DICU_DATA_LIBRARIES=$ICU_ROOT/lib/libicuuc.so \
-DICU_DT_LIBRARY_RELEASE="$ICU_ROOT/stubdata/libicudata.so" \
-DLIBZIP_LIBRARIES="$LIBZIP_ROOT/build/lib/libzip.a" \
-DEMSCRIPTEN_FLAGS="-s USE_SDL=2 -s USE_BZIP2=1 -s USE_LIBPNG=1 -pthread -O3" \
-DEMSCRIPTEN_LDFLAGS="-Wno-pthreads-mem-growth -s ASYNCIFY -s FULL_ES3 -s SAFE_HEAP=0 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4GB -s INITIAL_MEMORY=2GB -s MAX_WEBGL_VERSION=2 -s PTHREAD_POOL_SIZE=120 -pthread -sEXPORTED_RUNTIME_METHODS=ccall,FS,callMain,UTF8ToString,stringToNewUTF8 -lidbfs.js --use-preload-plugins -s MODULARIZE=1 -s 'EXPORT_NAME=\"OPENRCT2_WEB\"'"
emmake ninja
rm -rf www/
mkdir -p www/
cd www/
cp -r ../openrct2.* ./
cp -r ../../emscripten/static/* ./