From 3622be3fbfe3d552dec40ce2a7c54a509910748e Mon Sep 17 00:00:00 2001 From: bones_was_here Date: Mon, 19 Aug 2024 06:12:07 +1000 Subject: [PATCH] build: set stack limit on Windows and Emscripten to match other platforms Linux, FreeBSD, macOS all default to 8MB for the main thread. MSVC defaulted to 1MB, MinGW GCC to 2MB. Optimises Emscripten build slightly and replaces its deprecated TOTAL_STACK setting. Signed-off-by: bones_was_here --- darkplaces-sdl2-vs2019.vcxproj | 4 ++++ makefile.inc | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/darkplaces-sdl2-vs2019.vcxproj b/darkplaces-sdl2-vs2019.vcxproj index f94592a5..f68f7c97 100644 --- a/darkplaces-sdl2-vs2019.vcxproj +++ b/darkplaces-sdl2-vs2019.vcxproj @@ -99,6 +99,7 @@ MachineX86 kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) true + 8388608 @@ -126,6 +127,7 @@ Windows MachineX64 kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + 8388608 @@ -153,6 +155,7 @@ MachineX86 kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) true + 8388608 @@ -182,6 +185,7 @@ true MachineX64 kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + 8388608 diff --git a/makefile.inc b/makefile.inc index c0ec06fe..9cfed413 100644 --- a/makefile.inc +++ b/makefile.inc @@ -236,14 +236,14 @@ LDFLAGS_WASMJS=$(LDFLAGS_UNIXCOMMON) -s USE_SDL=2 \ -s USE_LIBJPEG=1 \ -s USE_ZLIB=1 \ -s INITIAL_MEMORY=128mb \ - -s MAXIMUM_MEMORY=1gb \ + -s MAXIMUM_MEMORY=2gb \ -s SINGLE_FILE \ -s FULL_ES3 \ -s MIN_WEBGL_VERSION=2 \ -s MAX_WEBGL_VERSION=2 \ -s ALLOW_MEMORY_GROWTH=1 \ - -s ASSERTIONS=2 \ - -s TOTAL_STACK=32mb \ + -s ASSERTIONS=1 \ + -s STACK_SIZE=8mb \ -DUSE_GLES2 \ -lidbfs.js \ --pre-js ../../../wasm/pre.js \ @@ -254,14 +254,14 @@ LDFLAGS_WASM=$(LDFLAGS_UNIXCOMMON) -s USE_SDL=2 \ -s USE_LIBJPEG=1 \ -s USE_ZLIB=1 \ -s INITIAL_MEMORY=128mb \ - -s MAXIMUM_MEMORY=1gb \ + -s MAXIMUM_MEMORY=2gb \ -s SINGLE_FILE \ -s FULL_ES3 \ -s MIN_WEBGL_VERSION=2 \ -s MAX_WEBGL_VERSION=2 \ -s ALLOW_MEMORY_GROWTH=1 \ - -s ASSERTIONS=2 \ - -s TOTAL_STACK=32mb \ + -s ASSERTIONS=1 \ + -s STACK_SIZE=8mb \ -DUSE_GLES2 \ -lidbfs.js \ --pre-js ../../../wasm/standaloneprejs.js \ @@ -299,8 +299,8 @@ WINDRES ?= windres # Link # see LDFLAGS_WINCOMMON in makefile -LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) -LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(LDFLAGS_UNIXSDL) -lwinmm -lws2_32 $(LIB_Z) $(LIB_JPEG) $(LIB_SND_XMP) +LDFLAGS_WINSV=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) -mconsole -lwinmm -lws2_32 -Wl,--stack=0x800000 $(LIB_Z) $(LIB_JPEG) +LDFLAGS_WINSDL=$(LDFLAGS_WINCOMMON) $(LIB_CRYPTO) $(LIB_CRYPTO_RIJNDAEL) $(LDFLAGS_UNIXSDL) -lwinmm -lws2_32 -Wl,--stack=0x800000 $(LIB_Z) $(LIB_JPEG) $(LIB_SND_XMP) EXE_WINSV=darkplaces-dedicated.exe EXE_WINSDL=darkplaces-sdl.exe EXE_WINSVNEXUIZ=nexuiz-dedicated.exe -- 2.39.2