From ede43784bb4cf54559a6e5595e5bd52400a58f24 Mon Sep 17 00:00:00 2001 From: zhaozg Date: Sun, 22 Sep 2024 16:07:02 +0800 Subject: [PATCH] fix: XCode 16 and LuaJit no dedup workaround - https://github.com/surge-synthesizer/surge/pull/7793/commits/5ed7e573bd91ece3308d7a3d6ef90da3a840f477 - https://github.com/LuaJIT/LuaJIT/issues/1275 --- Bundle.cmake | 2 +- LuaJIT.cmake | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Bundle.cmake b/Bundle.cmake index bb47798..b757044 100644 --- a/Bundle.cmake +++ b/Bundle.cmake @@ -77,7 +77,7 @@ if(BUNDLE_USE_LUA2C) MAIN_DEPENDENCY ${source_file} DEPENDS ${LUA_TARGET} COMMAND ${BUNDLE_CMD} ARGS - ${BUNDLE_CMD_ARGS} lua2c.lua ${BUNDLE_ENABLE_DEBUG} ${source_file} ${generated_file} + ${BUNDLE_CMD_ARGS} ${LUA_TARGET_PATH}/lua2c.lua ${BUNDLE_ENABLE_DEBUG} ${source_file} ${generated_file} COMMENT "${BUNDLE_CMD} ${BUNDLE_CMD_ARGS} lua2c.lua ${BUNDLE_ENABLE_DEBUG} ${source_file} ${generated_file}" WORKING_DIRECTORY ${LUA_TARGET_PATH}) diff --git a/LuaJIT.cmake b/LuaJIT.cmake index 3b905ad..d39b641 100644 --- a/LuaJIT.cmake +++ b/LuaJIT.cmake @@ -594,6 +594,27 @@ if(IOS) set_xcode_property(libluajit IPHONEOS_DEPLOYMENT_TARGET "9.0" "all") endif() +if(CMAKE_C_COMPILER_ID MATCHES "Clang") + # Any Clang + # Since the assembler part does NOT maintain a frame pointer, it's pointless + # to slow down the C part by not omitting it. Debugging, tracebacks and + # unwinding are not affected -- the assembler part has frame unwind + # information and GCC emits it where needed (x64) or with -g (see CCDEBUG). + add_compile_options(-fomit-frame-pointer) + if(CMAKE_C_COMPILER_ID MATCHES "^AppleClang$") + # Apple Clang only + add_compile_options( + -faligned-allocation + -fasm-blocks + ) + + # LuaJit + XCode 16 goes blammo + add_link_options( + -Wl,-no_deduplicate + ) + endif() +endif() + if("${LJ_TARGET_ARCH}" STREQUAL "x86") if(CMAKE_COMPILER_IS_CLANGXX OR CMAKE_COMPILER_IS_GNUCXX) target_compile_options(libluajit PRIVATE