cmake: fix stack size linker argument on mac

This commit is contained in:
Jacob Young 2022-12-05 03:14:54 -05:00 committed by Andrew Kelley
parent 47a2a526e2
commit fdb98c5ce1

View File

@ -708,21 +708,6 @@ target_link_libraries(zigcpp LINK_PUBLIC
${CMAKE_THREAD_LIBS_INIT}
)
if(MSVC)
set(ZIG_WASM2C_COMPILE_FLAGS "/std:c99 /O2")
set(ZIG1_COMPILE_FLAGS "/std:c99 /Os")
set(ZIG2_COMPILE_FLAGS "/std:c99 /O0")
set(ZIG2_LINK_FLAGS "/STACK:16777216")
else()
set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2")
set(ZIG1_COMPILE_FLAGS "-std=c99 -Os")
set(ZIG2_COMPILE_FLAGS "-std=c99 -O0")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -fbracket-depth=512")
endif()
set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
endif()
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
set(HOST_TARGET_ARCH "x86_64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
@ -737,6 +722,25 @@ else()
endif()
set(HOST_TARGET_TRIPLE "${HOST_TARGET_ARCH}-${HOST_TARGET_OS}")
if(MSVC)
set(ZIG_WASM2C_COMPILE_FLAGS "/std:c99 /O2")
set(ZIG1_COMPILE_FLAGS "/std:c99 /Os")
set(ZIG2_COMPILE_FLAGS "/std:c99 /O0")
set(ZIG2_LINK_FLAGS "/STACK:16777216")
else()
set(ZIG_WASM2C_COMPILE_FLAGS "-std=c99 -O2")
set(ZIG1_COMPILE_FLAGS "-std=c99 -Os")
set(ZIG2_COMPILE_FLAGS "-std=c99 -O0")
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(ZIG1_COMPILE_FLAGS "${ZIG1_COMPILE_FLAGS} -fbracket-depth=512")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
set(ZIG2_LINK_FLAGS "-Wl,-stack_size,0x10000000")
else()
set(ZIG2_LINK_FLAGS "-Wl,-z,stack-size=0x10000000")
endif()
endif()
set(ZIG1_WASM_SOURCE "${CMAKE_SOURCE_DIR}/stage1/zig1.wasm.zst")
set(ZIG1_C_SOURCE "${CMAKE_BINARY_DIR}/zig1.c")
set(ZIG2_C_SOURCE "${CMAKE_BINARY_DIR}/zig2.c")