Makefile/CMakeLists.txt: factor out stack size setting to here.

This commit is contained in:
Eric Wasylishen 2015-04-25 17:29:23 -06:00
parent 9c521a70d6
commit 02196e2efa
3 changed files with 13 additions and 2 deletions

View File

@ -118,7 +118,10 @@ endif (CMAKE_USE_PTHREADS_INIT)
#FIXME: Should be only for qbsp
add_definitions(-DDOUBLEVEC_T)
set(STACKSIZE 8388608)
add_definitions(-DQ_STACKSIZE=${STACKSIZE})
#request 8MB stack
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS -Wl,--stack,8388608)
set(CMAKE_EXE_LINKER_FLAGS -Wl,--stack,${STACKSIZE})
endif (WIN32)

View File

@ -116,6 +116,14 @@ CFLAGS += $(call cc-option,-ffast-math,)
endif
endif
# give a generous 8MB stack
STACKSIZE := 8388608
CFLAGS += -DQ_STACKSIZE=$(STACKSIZE)
ifeq ($(TARGET_OS),WIN32)
LDFLAGS += -Wl,--stack,$(STACKSIZE)
endif
# ============================================================================
# Helper functions
# ============================================================================

View File

@ -233,7 +233,7 @@ RunThreadsOn(int start, int workcnt, void *(func)(void *), void *arg)
status = pthread_attr_init(&attrib);
if (status)
Error("pthread_attr_init failed");
status = pthread_attr_setstacksize(&attrib, 0x100000);
status = pthread_attr_setstacksize(&attrib, Q_STACKSIZE);
if (status)
Error("pthread_attr_setstacksize failed");