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

Add extension flag

parent 1c36d9fa
...@@ -21,6 +21,7 @@ def main(): ...@@ -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("input", help="input file", nargs="?" if "--cpp-flags" in sys.argv else 1)
parser.add_argument("-o", "--output", help="output file") 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("--cpp-flags", help="print cpp flags", action="store_true")
parser.add_argument( parser.add_argument(
'-d', '--debug', '-d', '--debug',
...@@ -53,6 +54,8 @@ def main(): ...@@ -53,6 +54,8 @@ def main():
*["-I" + d for d in include_dirs], *["-I" + d for d in include_dirs],
"-pthread", "-luring", "-lfmt", "-lssl", "-lcrypto", "-lpython3.10", "-std=c++20" "-pthread", "-luring", "-lfmt", "-lssl", "-lcrypto", "-lpython3.10", "-std=c++20"
] ]
if args.extension:
cpp_flags.extend(("-DTYPON_EXTENSION", "-fPIC", "-shared"))
print(" ".join(cpp_flags)) print(" ".join(cpp_flags))
exit(0) exit(0)
......
...@@ -74,6 +74,7 @@ def run_test(path, quiet=True): ...@@ -74,6 +74,7 @@ def run_test(path, quiet=True):
code = f.read() code = f.read()
execute = "# norun" not in code execute = "# norun" not in code
compile = "# nocompile" not in code compile = "# nocompile" not in code
extension = "# extension" in code
try: try:
res = format_code(transpile(code, path.name, path)) res = format_code(transpile(code, path.name, path))
except: 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