mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-21 07:11:16 +00:00
tools/makectx: Use subprocess to direct output file
This way it will appear in 'ctx.h' and not (blah). Also update the .gitignore for *.obj files, which interestingly the preprocessor spat out after testing locally.
This commit is contained in:
parent
33048db81a
commit
db1910d81e
4
.gitignore
vendored
4
.gitignore
vendored
@ -6,4 +6,8 @@ ISLE.EXE
|
|||||||
LEGO1.DLL
|
LEGO1.DLL
|
||||||
build/
|
build/
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
# Stuff generated by the preprocessor and/or tools/makectx.py
|
||||||
*.i
|
*.i
|
||||||
|
*.obj
|
||||||
|
ctx.h
|
||||||
@ -1,15 +1,29 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(allow_abbrev=False,
|
parser = argparse.ArgumentParser(
|
||||||
description='Verify Exports: Compare the exports of two DLLs.')
|
allow_abbrev=False, description="Verify Exports: Compare the exports of two DLLs."
|
||||||
parser.add_argument('cppfile', metavar='cppfile', help='Path to the C++ File to preprocess.')
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"cppfile", metavar="cppfile", help="Path to the C++ File to preprocess."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--debug",
|
||||||
|
action="store_true",
|
||||||
|
help="Print debug information by showing the output from the preprocessor. THIS WILL TAKE A LONG TIME AS YOUR TERMINAL TRIES TO LOAD OVER 100K LINES OF TEXT. Use this if your context contains an error or is empty.",
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if not os.path.isfile(args.cppfile):
|
if not os.path.isfile(args.cppfile):
|
||||||
parser.error('Specified C++ file does not exist.')
|
parser.error("Specified C++ file does not exist.")
|
||||||
|
|
||||||
os.system('cl.exe /EP /P ' + args.cppfile)
|
output = subprocess.run(
|
||||||
|
"cl.exe /EP " + args.cppfile, capture_output=not args.debug, text=True
|
||||||
|
)
|
||||||
|
|
||||||
print('Preprocessed file. It will be in the directory you executed in this command as "(filename).i".')
|
f = open("ctx.h", "w")
|
||||||
|
f.write(output.stdout)
|
||||||
|
|
||||||
|
print("Preprocessed file to ctx.h")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user