Add generate to the go.mod

This commit is contained in:
Sky Johnson 2025-01-25 22:10:49 -06:00
parent a691e7add6
commit 7385e0870e
4 changed files with 10 additions and 9 deletions

View File

@ -2,7 +2,5 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/luajit" vcs="Git" />
<mapping directory="$PROJECT_DIR$/luajit/luajit" vcs="Git" />
</component>
</project>

6
generate.go Normal file
View File

@ -0,0 +1,6 @@
//go:build exclude
package luajit
//go:generate cp -r ../include ./include
//go:generate cp -r ../lib ./lib

2
go.mod
View File

@ -1,3 +1,3 @@
module git.sharkk.net/Sky/LuaJIT-to-Go
go 1.23.4
go 1.23.4

View File

@ -1,24 +1,21 @@
package luajit
/*
#cgo CFLAGS: -I${SRCDIR}/luajit
#cgo windows LDFLAGS: -L${SRCDIR}/luajit -llua51
#cgo !windows LDFLAGS: -L${SRCDIR}/luajit -lluajit
#cgo CFLAGS: -I${SRCDIR}/include
#cgo windows LDFLAGS: -L${SRCDIR}/lib -llua51
#cgo !windows LDFLAGS: -L${SRCDIR}/lib -lluajit
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <stdlib.h>
void init_dll_paths(void);
static int do_string(lua_State *L, const char *s) {
int status = luaL_loadstring(L, s);
if (status) return status;
return lua_pcall(L, 0, LUA_MULTRET, 0);
}
static int do_file(lua_State *L, const char *filename) {
int status = luaL_loadfile(L, filename);
if (status) return status;