From a084f5984d75437b98c24f575d9ac55bd46d0457 Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Fri, 15 Aug 2025 09:04:30 -0600 Subject: [PATCH 1/9] add luajit as a module --- .gitmodules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitmodules b/.gitmodules index 5a5ceef..48ea00c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "Source/lua/lua"] path = Source/lua/lua url = ../../lua/lua.git +[submodule "LuaJIT"] + path = modules/LuaJIT + url = https://luajit.org/git/luajit.git \ No newline at end of file From 065af7a8360f4c4f45a96123fcc87283a6403b88 Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Fri, 15 Aug 2025 09:12:33 -0600 Subject: [PATCH 2/9] add LuaJIT as a submodule --- .gitmodules | 2 +- modules/LuaJIT | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 modules/LuaJIT diff --git a/.gitmodules b/.gitmodules index 48ea00c..9febb12 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,4 +12,4 @@ url = ../../lua/lua.git [submodule "LuaJIT"] path = modules/LuaJIT - url = https://luajit.org/git/luajit.git \ No newline at end of file + url = https://luajit.org/git/luajit.git diff --git a/modules/LuaJIT b/modules/LuaJIT new file mode 160000 index 0000000..871db2c --- /dev/null +++ b/modules/LuaJIT @@ -0,0 +1 @@ +Subproject commit 871db2c84ecefd70a850e03a6c340214a81739f0 From a4ed461887fde299d2844535e7c6e5b4e36959a1 Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Fri, 15 Aug 2025 10:09:47 -0600 Subject: [PATCH 3/9] Switch to LuaJIT --- .gitmodules | 3 -- Source/lua/LuaParser.cpp | 8 ++--- Source/lua/lua | 1 - Source/lua/luaimport.cpp | 1 - Source/lua/luaimport.h | 40 --------------------- luajit_win.bat | 8 +++++ osci-render.jucer | 77 ++++------------------------------------ 7 files changed, 19 insertions(+), 119 deletions(-) delete mode 160000 Source/lua/lua delete mode 100644 Source/lua/luaimport.cpp delete mode 100644 Source/lua/luaimport.h create mode 100644 luajit_win.bat diff --git a/.gitmodules b/.gitmodules index 9febb12..16f29de 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,9 +7,6 @@ [submodule "modules/osci_render_core"] path = modules/osci_render_core url = ../../jameshball/osci_render_core.git -[submodule "Source/lua/lua"] - path = Source/lua/lua - url = ../../lua/lua.git [submodule "LuaJIT"] path = modules/LuaJIT url = https://luajit.org/git/luajit.git diff --git a/Source/lua/LuaParser.cpp b/Source/lua/LuaParser.cpp index d4c366f..f17b815 100644 --- a/Source/lua/LuaParser.cpp +++ b/Source/lua/LuaParser.cpp @@ -1,5 +1,5 @@ #include "LuaParser.h" -#include "luaimport.h" +#include std::function LuaParser::onPrint; std::function LuaParser::onClear; @@ -322,7 +322,7 @@ static int luaPrint(lua_State* L) { int nargs = lua_gettop(L); for (int i = 1; i <= nargs; ++i) { - LuaParser::onPrint(luaL_tolstring(L, i, nullptr)); + LuaParser::onPrint(lua_tolstring(L, i, nullptr)); lua_pop(L, 1); } @@ -468,7 +468,7 @@ void LuaParser::revertToFallback(lua_State*& L) { } void LuaParser::readTable(lua_State*& L, std::vector& values) { - auto length = lua_rawlen(L, -1); + auto length = lua_objlen(L, -1); for (int i = 1; i <= length; i++) { lua_pushinteger(L, i); @@ -493,7 +493,7 @@ std::vector LuaParser::run(lua_State*& L, LuaVariables& vars) { setGlobalVariables(L, vars); // Get the function from the registry - lua_geti(L, LUA_REGISTRYINDEX, functionRef); + lua_rawgeti(L, LUA_REGISTRYINDEX, functionRef); setMaximumInstructions(L, 5000000); diff --git a/Source/lua/lua b/Source/lua/lua deleted file mode 160000 index 3dbb1a4..0000000 --- a/Source/lua/lua +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3dbb1a4b894c0744a331d4319d8d1704dc4ad943 diff --git a/Source/lua/luaimport.cpp b/Source/lua/luaimport.cpp deleted file mode 100644 index 0a804bb..0000000 --- a/Source/lua/luaimport.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "luaimport.h" \ No newline at end of file diff --git a/Source/lua/luaimport.h b/Source/lua/luaimport.h deleted file mode 100644 index 673f56a..0000000 --- a/Source/lua/luaimport.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef LUAIMPORT_H -#define LUAIMPORT_H - -extern "C" { - #include "lua/lapi.c" - #include "lua/lauxlib.c" - #include "lua/lbaselib.c" - #include "lua/lcode.c" - #include "lua/lcorolib.c" - #include "lua/lctype.c" - #include "lua/ldblib.c" - #include "lua/ldebug.c" - #include "lua/ldo.c" - #include "lua/ldump.c" - #include "lua/lfunc.c" - #include "lua/lgc.c" - #include "lua/linit.c" - #include "lua/liolib.c" - #include "lua/llex.c" - #include "lua/lmathlib.c" - #include "lua/lmem.c" - #include "lua/loadlib.c" - #include "lua/lobject.c" - #include "lua/lopcodes.c" - #include "lua/loslib.c" - #include "lua/lparser.c" - #include "lua/lstate.c" - #include "lua/lstring.c" - #include "lua/lstrlib.c" - #include "lua/ltable.c" - #include "lua/ltablib.c" - #include "lua/ltests.c" - #include "lua/ltm.c" - #include "lua/lundump.c" - #include "lua/lutf8lib.c" - #include "lua/lvm.c" - #include "lua/lzio.c" -} - -#endif \ No newline at end of file diff --git a/luajit_win.bat b/luajit_win.bat new file mode 100644 index 0000000..ac070ff --- /dev/null +++ b/luajit_win.bat @@ -0,0 +1,8 @@ +if /I "%VSTEL_MSBuildProjectFullPath:~-18%" neq "SharedCode.vcxproj" ( + goto skip_luajit +) + +cd ..\..\..\modules\LuaJIT\src +.\msvcbuild.bat static + +:skip_luajit \ No newline at end of file diff --git a/osci-render.jucer b/osci-render.jucer index be38c77..453717f 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -365,73 +365,6 @@ file="Source/ixwebsocket/IXWebSocketVersion.h"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -730,11 +663,15 @@ + extraLinkerFlags="/IGNORE:4006" externalLibraries="lua51.lib"> - + + debugInformationFormat="ProgramDatabase" winWarningLevel="2" + prebuildCommand="..\..\..\luajit_win.bat" libraryPath="..\..\..\modules\LuaJIT\src" + headerPath="..\..\..\modules\LuaJIT\src"/> From 2f9ee2c0f1e2af46d3fef1516ed9a10ca593cb8f Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Fri, 15 Aug 2025 10:43:15 -0600 Subject: [PATCH 4/9] Add potential macOS support (needs to be tested) --- osci-render.jucer | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/osci-render.jucer b/osci-render.jucer index 453717f..5aabc9d 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -707,14 +707,18 @@ microphonePermissionNeeded="1" frameworkSearchPaths="/Library/Frameworks" extraCustomFrameworks="/Library/Frameworks/Syphon.framework" hardenedRuntime="1" hardenedRuntimeOptions="com.apple.security.cs.disable-library-validation,com.apple.security.device.audio-input" - iosDevelopmentTeamID="D86A3M3H2L"> + iosDevelopmentTeamID="D86A3M3H2L" prebuildCommand="if [[ $TARGET_NAME == *"Shared Code"* ]]; then cd ..\..\..\modules\LuaJIT\src make -j$(nproc) fi" + externalLibraries="lua51"> + codeSigningIdentity="Developer ID Application: James Ball (D86A3M3H2L)" + headerPath="..\..\..\modules\LuaJIT\src" libraryPath="..\..\..\modules\LuaJIT\src"/> + codeSigningIdentity="Developer ID Application: James Ball (D86A3M3H2L)" + headerPath="..\..\..\modules\LuaJIT\src" libraryPath="..\..\..\modules\LuaJIT\src"/> + codeSigningIdentity="Developer ID Application: James Ball (D86A3M3H2L)" + headerPath="..\..\..\modules\LuaJIT\src" libraryPath="..\..\..\modules\LuaJIT\src"/> From 40f1f602d7ed6f995b4081284ce2901b15495232 Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Sat, 16 Aug 2025 07:44:06 -0600 Subject: [PATCH 5/9] Add Linux build script and notices about syntax errors --- Source/lua/LuaParser.cpp | 4 ++++ luajit_linux.sh | 7 +++++++ luajit_win.bat | 17 +++++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 luajit_linux.sh diff --git a/Source/lua/LuaParser.cpp b/Source/lua/LuaParser.cpp index f17b815..7fa9219 100644 --- a/Source/lua/LuaParser.cpp +++ b/Source/lua/LuaParser.cpp @@ -1,4 +1,8 @@ #include "LuaParser.h" + +// If you haven't compiled LuaJIT yet, this will fail, and you'll get a ton of syntax errors in a few Lua-related files! +// On Windows and MacOS, this will be done automatically as a pre-build step when you compile SharedCode. +// On Linux, you'll have to run the shell script "luajit_linux.sh" in the root of the Git repository. #include std::function LuaParser::onPrint; diff --git a/luajit_linux.sh b/luajit_linux.sh new file mode 100644 index 0000000..609c675 --- /dev/null +++ b/luajit_linux.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Run this if you're on Linux and you haven't already built LuaJIT. +# If you don't, osci-render won't compile. + +cd ..\..\..\modules\LuaJIT\src +make -j$(nproc) \ No newline at end of file diff --git a/luajit_win.bat b/luajit_win.bat index ac070ff..0957fc4 100644 --- a/luajit_win.bat +++ b/luajit_win.bat @@ -1,8 +1,21 @@ +@echo off +if "%VisualStudioVersion%"=="" ( + ECHO Visual Studio command line variables not detected! + ECHO This script will only work if you run it from a Visual Studio command line! + goto error_luajit +) + if /I "%VSTEL_MSBuildProjectFullPath:~-18%" neq "SharedCode.vcxproj" ( - goto skip_luajit + goto finish_luajit ) cd ..\..\..\modules\LuaJIT\src .\msvcbuild.bat static +goto finish_luajit -:skip_luajit \ No newline at end of file +:error_luajit + +timeout /T 10 + +:finish_luajit +@echo on \ No newline at end of file From 59629bc1a89f8c516263faaee29e8a8ac0c90336 Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Sat, 16 Aug 2025 07:55:27 -0600 Subject: [PATCH 6/9] Make LuaJIT build a little more robust --- Source/lua/LuaParser.cpp | 4 ++-- luajit_linux.sh => luajit_linux_macos.sh | 0 osci-render.jucer | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) rename luajit_linux.sh => luajit_linux_macos.sh (100%) diff --git a/Source/lua/LuaParser.cpp b/Source/lua/LuaParser.cpp index 7fa9219..98a4840 100644 --- a/Source/lua/LuaParser.cpp +++ b/Source/lua/LuaParser.cpp @@ -1,8 +1,8 @@ #include "LuaParser.h" // If you haven't compiled LuaJIT yet, this will fail, and you'll get a ton of syntax errors in a few Lua-related files! -// On Windows and MacOS, this will be done automatically as a pre-build step when you compile SharedCode. -// On Linux, you'll have to run the shell script "luajit_linux.sh" in the root of the Git repository. +// On all platforms, this should be done automatically when you run the export. +// If not, use the luajit_win.bat or luajit_linux_macos.sh scripts in the git root from the dev environment. #include std::function LuaParser::onPrint; diff --git a/luajit_linux.sh b/luajit_linux_macos.sh similarity index 100% rename from luajit_linux.sh rename to luajit_linux_macos.sh diff --git a/osci-render.jucer b/osci-render.jucer index 5aabc9d..0573ef5 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -6,7 +6,7 @@ cppLanguageStandard="20" projectLineFeed=" " headerPath="./include" version="2.5.1.1" companyName="James H Ball" companyWebsite="https://osci-render.com" companyEmail="james@ball.sh" defines="NOMINMAX=1 INTERNET_FLAG_NO_AUTO_REDIRECT=0 OSCI_PREMIUM=1 JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1 JUCE_MODAL_LOOPS_PERMITTED=1" - pluginAUMainType="'aumf'"> + pluginAUMainType="'aumf'" postExportShellCommandPosix="cd %%1%%; .\luajit_linux_macos.sh "> @@ -628,10 +628,12 @@ JUCE_WEB_BROWSER="0"/> + bigIcon="pSc1mq" externalLibraries="lua51"> - - + + @@ -666,12 +668,12 @@ extraLinkerFlags="/IGNORE:4006" externalLibraries="lua51.lib"> + libraryPath="..\..\..\modules\LuaJIT\src" headerPath="..\..\..\modules\LuaJIT\src" + prebuildCommand="..\..\..\luajit_win.bat"/> + libraryPath="..\..\..\modules\LuaJIT\src" headerPath="..\..\..\modules\LuaJIT\src" + prebuildCommand="..\..\..\luajit_win.bat"/> @@ -707,8 +709,7 @@ microphonePermissionNeeded="1" frameworkSearchPaths="/Library/Frameworks" extraCustomFrameworks="/Library/Frameworks/Syphon.framework" hardenedRuntime="1" hardenedRuntimeOptions="com.apple.security.cs.disable-library-validation,com.apple.security.device.audio-input" - iosDevelopmentTeamID="D86A3M3H2L" prebuildCommand="if [[ $TARGET_NAME == *"Shared Code"* ]]; then cd ..\..\..\modules\LuaJIT\src make -j$(nproc) fi" - externalLibraries="lua51"> + iosDevelopmentTeamID="D86A3M3H2L" externalLibraries="lua51"> Date: Sat, 16 Aug 2025 09:08:43 -0600 Subject: [PATCH 7/9] fix Linux build --- luajit_linux_macos.sh | 4 ++-- osci-render.jucer | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) mode change 100644 => 100755 luajit_linux_macos.sh diff --git a/luajit_linux_macos.sh b/luajit_linux_macos.sh old mode 100644 new mode 100755 index 609c675..62f5f2f --- a/luajit_linux_macos.sh +++ b/luajit_linux_macos.sh @@ -3,5 +3,5 @@ # Run this if you're on Linux and you haven't already built LuaJIT. # If you don't, osci-render won't compile. -cd ..\..\..\modules\LuaJIT\src -make -j$(nproc) \ No newline at end of file +cd modules/LuaJIT/src +BUILDMODE=static make -j$(nproc) diff --git a/osci-render.jucer b/osci-render.jucer index 0573ef5..4c9fdce 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -6,7 +6,7 @@ cppLanguageStandard="20" projectLineFeed=" " headerPath="./include" version="2.5.1.1" companyName="James H Ball" companyWebsite="https://osci-render.com" companyEmail="james@ball.sh" defines="NOMINMAX=1 INTERNET_FLAG_NO_AUTO_REDIRECT=0 OSCI_PREMIUM=1 JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1 JUCE_MODAL_LOOPS_PERMITTED=1" - pluginAUMainType="'aumf'" postExportShellCommandPosix="cd %%1%%; .\luajit_linux_macos.sh "> + pluginAUMainType="'aumf'" postExportShellCommandPosix="%%1%%/luajit_linux_macos.sh "> @@ -628,12 +628,12 @@ JUCE_WEB_BROWSER="0"/> + bigIcon="pSc1mq" externalLibraries="luajit"> - - + + @@ -709,17 +709,17 @@ microphonePermissionNeeded="1" frameworkSearchPaths="/Library/Frameworks" extraCustomFrameworks="/Library/Frameworks/Syphon.framework" hardenedRuntime="1" hardenedRuntimeOptions="com.apple.security.cs.disable-library-validation,com.apple.security.device.audio-input" - iosDevelopmentTeamID="D86A3M3H2L" externalLibraries="lua51"> + iosDevelopmentTeamID="D86A3M3H2L" externalLibraries="luajit"> + headerPath="../../../modules/LuaJIt/src" libraryPath="../../../modules/LuaJIt/src"/> + headerPath="../../../modules/LuaJIt/src" libraryPath="../../../modules/LuaJIt/src"/> + headerPath="../../../modules/LuaJIt/src" libraryPath="../../../modules/LuaJIt/src"/> From 7bb2a676c4dc9ec200c5c8c48345d8aa29615d70 Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Sat, 16 Aug 2025 10:28:55 -0600 Subject: [PATCH 8/9] Make compilation work out of the box on MacOS by updating LuaJIT script and removing hardcoded developer ID --- luajit_linux_macos.sh | 9 +++++++-- osci-render.jucer | 9 +++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/luajit_linux_macos.sh b/luajit_linux_macos.sh index 62f5f2f..c034cf3 100755 --- a/luajit_linux_macos.sh +++ b/luajit_linux_macos.sh @@ -3,5 +3,10 @@ # Run this if you're on Linux and you haven't already built LuaJIT. # If you don't, osci-render won't compile. -cd modules/LuaJIT/src -BUILDMODE=static make -j$(nproc) +cd "$DIR/modules/LuaJIT/src" + +if [[ "$OSTYPE" == "darwin"* ]]; then + make -j$(sysctl -n hw.logicalcpu) BUILDMODE=static MACOSX_DEPLOYMENT_TARGET=10.13 +else + make -j$(nproc) BUILDMODE=static +fi diff --git a/osci-render.jucer b/osci-render.jucer index ecaf4fb..c6488ff 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -6,7 +6,7 @@ cppLanguageStandard="20" projectLineFeed=" " headerPath="./include" version="2.5.1.1" companyName="James H Ball" companyWebsite="https://osci-render.com" companyEmail="james@ball.sh" defines="NOMINMAX=1 INTERNET_FLAG_NO_AUTO_REDIRECT=0 OSCI_PREMIUM=1 JUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1 JUCE_MODAL_LOOPS_PERMITTED=1" - pluginAUMainType="'aumf'" postExportShellCommandPosix="%%1%%/luajit_linux_macos.sh "> + pluginAUMainType="'aumf'" postExportShellCommandPosix="DIR=%%1%% %%1%%/luajit_linux_macos.sh "> @@ -707,17 +707,14 @@ bigIcon="aZXbCi" applicationCategory="public.app-category.music" microphonePermissionNeeded="1" frameworkSearchPaths="/Library/Frameworks" extraCustomFrameworks="/Library/Frameworks/Syphon.framework" - hardenedRuntime="1" hardenedRuntimeOptions="com.apple.security.cs.disable-library-validation,com.apple.security.device.audio-input" - iosDevelopmentTeamID="D86A3M3H2L" externalLibraries="luajit"> + hardenedRuntime="1" hardenedRuntimeOptions="com.apple.security.cs.allow-jit,com.apple.security.cs.disable-library-validation,com.apple.security.device.audio-input" + externalLibraries="luajit"> From 90585abd549c81c8b910100a4e9a8f0a5aac968f Mon Sep 17 00:00:00 2001 From: DJLevel3 Date: Sat, 16 Aug 2025 12:25:05 -0600 Subject: [PATCH 9/9] revert development id removal --- osci-render.jucer | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osci-render.jucer b/osci-render.jucer index c6488ff..020d707 100644 --- a/osci-render.jucer +++ b/osci-render.jucer @@ -708,14 +708,17 @@ microphonePermissionNeeded="1" frameworkSearchPaths="/Library/Frameworks" extraCustomFrameworks="/Library/Frameworks/Syphon.framework" hardenedRuntime="1" hardenedRuntimeOptions="com.apple.security.cs.allow-jit,com.apple.security.cs.disable-library-validation,com.apple.security.device.audio-input" - externalLibraries="luajit"> + externalLibraries="luajit" iosDevelopmentTeamID="D86A3M3H2L"> + headerPath="../../../modules/LuaJIt/src" libraryPath="../../../modules/LuaJIt/src" + codeSigningIdentity=""Developer ID Application: James Ball (D86A3M3H2L)""/> + headerPath="../../../modules/LuaJIt/src" libraryPath="../../../modules/LuaJIt/src" + codeSigningIdentity=""Developer ID Application: James Ball (D86A3M3H2L)""/> + headerPath="../../../modules/LuaJIt/src" libraryPath="../../../modules/LuaJIt/src" + codeSigningIdentity=""Developer ID Application: James Ball (D86A3M3H2L)""/>