Compare commits

..

No commits in common. "e4fd777d6ad41d338125b095abc98e4dd54c05d7" and "0ad1583a3ab22e42994908c1edd907bd7dee24bf" have entirely different histories.

4 changed files with 2 additions and 126 deletions

22
.gitignore vendored
View File

@ -1,22 +0,0 @@
# Ignore build outputs
/build/
# Ignore xmake temporary files
.xmake/
# Ignore LuaJIT generated files (if any)
luajit/src/*.o
luajit/src/*.obj
luajit/src/*.exe
luajit/src/*.so
luajit/src/*.dll
luajit/src/*.dylib
# Ignore log files
*.log
# Ignore editor/IDE-specific files
.vscode/
.idea/
*.swp
.DS_Store

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "luajit"]
path = luajit
url = https://luajit.org/git/luajit.git
url = https://github.com/LuaJIT/LuaJIT.git

View File

@ -1,3 +1,3 @@
# LuaJIT
A way to build static and dynamic libraries for LuaJIT. Uses xmake and gcc to build and copy over linkable headers/libraries.
Need to be able to build LuaJIT cross-platform for the Go wrapper.

102
xmake.lua
View File

@ -1,102 +0,0 @@
-- Project setup
set_project("LuaJIT")
set_version("2.1.0")
set_config("buildir", "build")
target("luajit")
set_kind("phony")
on_build(function (target)
import("core.tool.toolchain")
import("lib.detect.find_tool")
import("core.project.config")
-- Change to LuaJIT src dir first
os.cd("luajit/src")
-- Get number of CPU cores for parallel build
local cpu_num = os.cpuinfo().ncpu
-- Use gcc
os.setenv("CC", "gcc")
-- Use make/mingw32-make based on platform
if is_plat("windows") then
local make = find_tool("mingw32-make")
if not make then
raise("mingw32-make not found!")
end
-- Build with CMD shell
os.execv(make.program, {"-j" .. cpu_num, "SHELL=cmd.exe"})
else
local make = find_tool("make")
if not make then
raise("make not found!")
end
os.exec(string.format("%s -j%d", make.program, cpu_num))
end
-- Copy build outputs to /build
os.mkdir("../../build")
if is_plat("windows") then
-- Dynamic libraries and executable
os.cp("*.dll", "../../build")
os.cp("luajit.exe", "../../build")
-- Static libraries
os.cp("*.lib", "../../build")
os.cp("*.exp", "../../build")
os.cp("*.a", "../../build")
-- Headers for embedding
os.cp("lua.h", "../../build")
os.cp("luaconf.h", "../../build")
os.cp("lualib.h", "../../build")
os.cp("luajit.h", "../../build")
os.cp("lauxlib.h", "../../build")
else
os.cp("libluajit.so", "../../build", {force = true})
os.cp("libluajit.a", "../../build")
os.cp("luajit", "../../build")
-- Headers for embedding
os.cp("lua.h", "../../build")
os.cp("luaconf.h", "../../build")
os.cp("lualib.h", "../../build")
os.cp("luajit.h", "../../build")
os.cp("lauxlib.h", "../../build")
end
os.cd("../../")
end)
on_clean(function (target)
-- Clean build directory
os.rm("build")
-- Clean generated files in LuaJIT src directory
os.cd("luajit/src")
os.rm("*.o")
os.rm("*.obj")
os.rm("*.lib")
os.rm("*.exp")
os.rm("*.dll")
os.rm("*.exe")
os.rm("*.manifest")
os.rm("*.pdb")
os.rm("*.ilk")
os.rm("*.a")
os.rm("host/*.o")
os.rm("host/*.obj")
os.rm("host/minilua.exe")
os.rm("host/buildvm.exe")
os.rm("lj_vm.S")
os.rm("lj_bcdef.h")
os.rm("lj_ffdef.h")
os.rm("lj_libdef.h")
os.rm("lj_recdef.h")
os.rm("lj_folddef.h")
os.rm("host/buildvm_arch.h")
os.rm("luajit.h")
os.rm("luajit_relver.txt")
os.rm("jit/vmdef.lua")
os.cd("../../")
end)