1
0
Fork 0
forked from fun/fun

Made MAX_FRAMES, MAX_FRAME_LOCALS, MAX_GLOBALS, OUTPUT_SIZE and STACK_SIZE configurable during build configuration using cmake defines (-D). No code changes. (0.40.5)

This commit is contained in:
Johannes Findeisen 2026-04-10 22:04:27 +02:00
commit bebe6dfda0
4 changed files with 45 additions and 0 deletions

View file

@ -33,3 +33,10 @@ endif()
# Debug option to enable verbose parser/VM logging
option(FUN_DEBUG "Enable extra debug logging in Fun" OFF)
# VM settings (configurable via -D...)
set(MAX_FRAMES 128 CACHE STRING "Maximum depth of the call stack (frames)")
set(MAX_FRAME_LOCALS 64 CACHE STRING "Maximum number of local variables per frame")
set(MAX_GLOBALS 128 CACHE STRING "Maximum number of global variables")
set(OUTPUT_SIZE 1024 CACHE STRING "Size of the VM output buffer (number of values)")
set(STACK_SIZE 1024 CACHE STRING "Size of the VM evaluation stack")

View file

@ -25,6 +25,13 @@ endif()
target_compile_definitions(fun_core PUBLIC FUN_VERSION="${PROJECT_VERSION}")
target_compile_definitions(fun_core PUBLIC DEFAULT_LIB_DIR="${DEFAULT_LIB_DIR}")
# VM configuration
target_compile_definitions(fun_core PUBLIC MAX_FRAMES=${MAX_FRAMES})
target_compile_definitions(fun_core PUBLIC MAX_FRAME_LOCALS=${MAX_FRAME_LOCALS})
target_compile_definitions(fun_core PUBLIC MAX_GLOBALS=${MAX_GLOBALS})
target_compile_definitions(fun_core PUBLIC OUTPUT_SIZE=${OUTPUT_SIZE})
target_compile_definitions(fun_core PUBLIC STACK_SIZE=${STACK_SIZE})
# Apply extension include/link variables discovered in cmake/Extensions
foreach(var_pair
PCSC