Refactor code for invoke_lua_source and world.init. Also, add compile_commands.json to luprex

This commit is contained in:
2025-06-16 19:58:26 -04:00
parent f150b14d30
commit 80ff7d7d92
14 changed files with 279 additions and 331 deletions

View File

@@ -0,0 +1,23 @@
import sys, os
LUPREXDIR=os.path.dirname(os.path.abspath(sys.argv[0]))
JSON=sys.argv[1]
COMPILE=sys.argv[2]
FLAGS=sys.argv[3]
OBJPAT=sys.argv[4]
CPAT=sys.argv[5]
OBJECTS=sys.argv[6:]
with open(JSON, "a") as cc:
for base in OBJECTS:
obj = LUPREXDIR + "/" + OBJPAT.replace("FILE", base)
file = LUPREXDIR + "/" + CPAT.replace("FILE", base)
flags = FLAGS.replace("-I./", f"-I{LUPREXDIR}/")
cc.write('{\n')
cc.write(f' "file" : "{file}",\n')
cc.write(f' "command" : "{COMPILE} {obj} {flags} {file}",\n')
cc.write(f' "directory" : "{LUPREXDIR}"\n')
cc.write('}\n')