diff --git a/test.py b/test.py index 2840739..2f9b03b 100644 --- a/test.py +++ b/test.py @@ -25,14 +25,16 @@ else: bench = False -if len(sys.argv) >= 2 and sys.argv[1] == "--cross": - arch = sys.argv[2] - def compile(source, target, blazingio): - subprocess.run([f"{gcc_arch}-linux-gnu-g++", source, "-o", target, "-iquote", ".", f"-DBLAZINGIO=\"{blazingio}\"", "-std=c++17", "-O2", "-Wall", "-Werror"], check=True) -elif len(sys.argv) >= 2 and sys.argv[1] == "--cross-windows": +def compile(source, target, blazingio): + subprocess.run(gcc + [source, "-o", target, "-iquote", ".", f"-DBLAZINGIO=\"{blazingio}\"", "-std=c++17", "-O2", "-fsanitize=address,pointer-compare,pointer-subtract,undefined", "-Wall", "-Werror"], check=True) + +if len(sys.argv) >= 2 and sys.argv[1] in ("--cross", "--cross-windows"): arch = sys.argv[2] - def compile(source, target, blazingio): - subprocess.run([f"{gcc_arch}-w64-mingw32-g++", "-static", source, "-o", target, "-iquote", ".", f"-DBLAZINGIO=\"{blazingio}\"", "-std=c++17", "-O2", "-Wall", "-Werror"], check=True) + gcc_arch = "i686" if arch == "i386" else arch + if sys.argv[1] == "--cross": + gcc = [f"{gcc_arch}-linux-gnu-g++"] + else: + gcc = [f"{gcc_arch}-w64-mingw32-g++", "-static"] elif len(sys.argv) >= 2 and sys.argv[1] == "--msvc": arch = sys.argv[2] def compile(source, target, blazingio): @@ -44,15 +46,11 @@ def compile(source, target, blazingio): os.environ["MSYSTEM"] = "UCRT64" else: arch = platform.machine() - def compile(source, target, blazingio): - subprocess.run(["g++", source, "-o", target, "-iquote", ".", f"-DBLAZINGIO=\"{blazingio}\"", "-std=c++17", "-O2", "-Wall", "-Werror"], check=True) - -if arch == "AMD64": - arch = "x86_64" -elif arch == "arm64": - arch = "aarch64" - -gcc_arch = "i686" if arch == "i386" else arch + if arch == "AMD64": + arch = "x86_64" + elif arch == "arm64": + arch = "aarch64" + gcc = ["g++"] def iterate_config(config, props = []):