Skip to content

Commit 6dea7c3

Browse files
authored
Update luajitlib (surge-synthesizer#7929)
* Update LuaJIT submodule * Rollback amalg option for MSVC builds
1 parent 8912c90 commit 6dea7c3

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
141141
-faligned-allocation
142142
-fasm-blocks
143143
)
144-
145-
# LuaJit + XCode 16 goes blammo
146-
add_link_options(
147-
-Wl,-no_deduplicate
148-
)
149144
endif()
150145
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^GNU$")
151146
# GCC only

libs/luajitlib/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ luajitlib is a collection of scripts and a CMake configuration that attempts to
44

55
## Troubleshooting
66

7-
CMake should output a series of debug messages and a general error message when a build fails and examining these messages is the first step to troubleshoot the problem. See the sections below for more information on specific use scenarios and platforms and refer to the LuaJIT documentation [here](https://luajit.org/install.html) for more information. The `build-[platform]-luajit.*` scripts in the luajitlib directory can also be ran manually by adding a `"[builddir]"` parameter to test without CMake.
7+
CMake should output a series of debug messages and a general error message when a build fails and examining these messages is the first step to troubleshoot the problem. See the sections below for more information on specific use scenarios and platforms and refer to the LuaJIT documentation [here](https://luajit.org/install.html) for more information. The `build-[platform]-luajit.*` scripts in the luajitlib directory can also be run manually by adding a `"[builddir]"` parameter to test without CMake.
88

99
Alternatively, a pre-built statically linked library can be placed directly in the build output directory at `[builddir]/libs/luajitlib/bin` with the header files in `[builddir]/libs/luajitlib/include`. If named either `libluajit.a` or `lua51.lib`, it should be automatically detected and used instead of compiling LuaJIT from source during the CMake configuration process.
1010

11-
Finally, if all other options fail, Lua support can be disabled altogether by adding `-DSURGE_SKIP_LUA=TRUE` in the CMake configuration options.
11+
Finally, if all other options fail, Lua support can be disabled altogether by adding `-DSURGE_SKIP_LUA=TRUE` to the CMake configuration options.
1212

1313
### Cross-compiling
1414

@@ -20,7 +20,7 @@ The macOS build script attempts to build both `arm64` and `x86_64` binaries usin
2020

2121
### *nix
2222

23-
On Unix-like platforms (including macOS), the default is to use the `amalg` build target, which allows for better optimization at the cost of increased memory use during the compiling process. Removing the `amalg` option in the build scripts could help prevent memory use related issues on some systems.
23+
On Unix-like platforms (including macOS), the default is to use the `amalg` build target, which allows for better optimization at the cost of increased memory use during the compiling process. Removing the `amalg` option in the build scripts could help prevent memory usage related issues on some systems.
2424

2525
### Windows + MSVC
2626

libs/luajitlib/build-macos-luajit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ cd "${SD}/LuaJIT" || error=1
2929
export MACOSX_DEPLOYMENT_TARGET=10.9
3030

3131
# Pipe output to /dev/null to suppress linker errors
32-
make amalg -j HOST_CC="clang -target `uname -m`-apple-macos10.9" TARGET_CC="xcrun --toolchain arm64 clang -target arm64-apply-macos10.9 -isysroot $(xcrun --sdk macosx --show-sdk-path) -fvisibility=hidden -fvisibility-inlines-hidden" TARGET_LDFLAGS="-Wl,-no_deduplicate" TARGET_CFLAGS="-O3" > /dev/null 2>&1
32+
make amalg -j HOST_CC="clang -target `uname -m`-apple-macos10.9" TARGET_CC="xcrun --toolchain arm64 clang -target arm64-apply-macos10.9 -isysroot $(xcrun --sdk macosx --show-sdk-path) -fvisibility=hidden -fvisibility-inlines-hidden" TARGET_CFLAGS="-O3" > /dev/null 2>&1
3333
cp src/lib*a "${OD}/arm64" || error=1
3434

3535
make clean || error=1
36-
make amalg -j HOST_CC="clang -target `uname -m`-apple-macos10.9" TARGET_CC="xcrun --toolchain x86_64 clang -target x86_64-apply-macos10.9 -isysroot $(xcrun --sdk macosx --show-sdk-path) -fvisibility=hidden -fvisibility-inlines-hidden" TARGET_LDFLAGS="-Wl,-no_deduplicate" TARGET_CFLAGS="-O3" > /dev/null 2>&1
36+
make amalg -j HOST_CC="clang -target `uname -m`-apple-macos10.9" TARGET_CC="xcrun --toolchain x86_64 clang -target x86_64-apply-macos10.9 -isysroot $(xcrun --sdk macosx --show-sdk-path) -fvisibility=hidden -fvisibility-inlines-hidden" TARGET_CFLAGS="-O3" > /dev/null 2>&1
3737
cp src/lib*a "${OD}/x86_64" || error=1
3838

3939
lipo -create -arch arm64 "${OD}/arm64/libluajit.a" -arch x86_64 "${OD}/x86_64/libluajit.a" -output "${OD}/libluajit.a" || error=1

libs/luajitlib/msvcbuild.bat

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
106106
@if "%1"=="static" goto :STATIC
107107
%LJCOMPILE% %LJDYNBUILD% lj_*.c lib_*.c
108108
@if errorlevel 1 goto :BAD
109-
%LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj
109+
%LJLINK% /DLL /OUT:%LJDLLNAME% lj_*.obj lib_*.obj
110110
@if errorlevel 1 goto :BAD
111111
@goto :MTDLL
112112
:STATIC
@@ -116,17 +116,24 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
116116
@if errorlevel 1 goto :BAD
117117
@goto :MTDLL
118118
:AMALGDLL
119+
@if "%2"=="static" goto :AMALGSTATIC
119120
%LJCOMPILE% %LJDYNBUILD% ljamalg.c
120121
@if errorlevel 1 goto :BAD
121-
%LJLINK% /DLL /out:%LJDLLNAME% ljamalg.obj lj_vm.obj
122+
%LJLINK% /DLL /OUT:%LJDLLNAME% ljamalg.obj lj_vm.obj
123+
@if errorlevel 1 goto :BAD
124+
@goto :MTDLL
125+
:AMALGSTATIC
126+
%LJCOMPILE% ljamalg.c
127+
@if errorlevel 1 goto :BAD
128+
%LJLINK% /OUT:%LJDLLNAME% ljamalg.obj lj_vm.obj
122129
@if errorlevel 1 goto :BAD
123130
:MTDLL
124131
if exist %LJDLLNAME%.manifest^
125132
%LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2
126133

127134
%LJCOMPILE% luajit.c
128135
@if errorlevel 1 goto :BAD
129-
%LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME%
136+
%LJLINK% /OUT:luajit.exe luajit.obj %LJLIBNAME%
130137
@if errorlevel 1 goto :BAD
131138
if exist luajit.exe.manifest^
132139
%LJMT% -manifest luajit.exe.manifest -outputresource:luajit.exe

0 commit comments

Comments
 (0)