Commit 47c8827c authored by Tom Niget's avatar Tom Niget

Add extension flag

parent 1c36d9fa
......@@ -21,6 +21,7 @@ def main():
parser.add_argument("input", help="input file", nargs="?" if "--cpp-flags" in sys.argv else 1)
parser.add_argument("-o", "--output", help="output file")
parser.add_argument("-e", "--extension", help="generate binding code to allow importing this from CPython", action="store_true")
parser.add_argument("--cpp-flags", help="print cpp flags", action="store_true")
parser.add_argument(
'-d', '--debug',
......@@ -53,6 +54,8 @@ def main():
*["-I" + d for d in include_dirs],
"-pthread", "-luring", "-lfmt", "-lssl", "-lcrypto", "-lpython3.10", "-std=c++20"
]
if args.extension:
cpp_flags.extend(("-DTYPON_EXTENSION", "-fPIC", "-shared"))
print(" ".join(cpp_flags))
exit(0)
......
......@@ -74,6 +74,7 @@ def run_test(path, quiet=True):
code = f.read()
execute = "# norun" not in code
compile = "# nocompile" not in code
extension = "# extension" in code
try:
res = format_code(transpile(code, path.name, path))
except:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment