Refactor code for invoke_lua_source and world.init. Also, add compile_commands.json to luprex
This commit is contained in:
23
luprex/add-compile-commands.py
Normal file
23
luprex/add-compile-commands.py
Normal 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')
|
||||
Reference in New Issue
Block a user