From 270b8e74d19981f24c83aa22c13ec752f79f62b1 Mon Sep 17 00:00:00 2001 From: martinfouilleul Date: Mon, 3 Jun 2024 12:02:45 +0200 Subject: [PATCH] Use release flags when building runtime on Windows --- scripts/dev.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/dev.py b/scripts/dev.py index 006698e5..79d4cb14 100644 --- a/scripts/dev.py +++ b/scripts/dev.py @@ -528,12 +528,14 @@ def build_wasm3(release): def build_wasm3_lib_win(release): + debug_flags = ["/O2", "/Zi"] if release else ["/Zi"] + for f in glob.iglob("./src/ext/wasm3/source/*.c"): name = os.path.splitext(os.path.basename(f))[0] subprocess.run([ "cl", "/nologo", - "/Zi", "/Zc:preprocessor", "/c", - "/O2", + *debug_flags, + "/Zc:preprocessor", "/c", f"/Fo:build/obj/{name}.obj", "/I", "./src/ext/wasm3/source", f, @@ -586,7 +588,7 @@ def build_runtime(args): def build_runtime_internal(release, wasm_backend): build_platform_layer_internal(release) - if wasm_backend == "bytebox": + if wasm_backend == "bytebox": build_bytebox(release) else: build_wasm3(release) @@ -618,6 +620,8 @@ def build_runtime_win(release, wasm_backend): defines = [] link_commands = ["build/bin/orca.dll.lib"] + debug_flags = ["/O2", "/Zi"] if release else ["/Zi", "/DOC_DEBUG", "/DOC_LOG_COMPILE_DEBUG"] + if wasm_backend == "bytebox": includes += ["/I", "src/ext/bytebox/zig-out/include"] defines += ["/DOC_WASM_BACKEND_WASM3=0", "/DOC_WASM_BACKEND_BYTEBOX=1"] @@ -633,7 +637,8 @@ def build_runtime_win(release, wasm_backend): compile_args=[ "cl", - "/Zi", "/Zc:preprocessor", + *debug_flags, + "/Zc:preprocessor", "/std:c11", "/experimental:c11atomics", *defines, *includes, @@ -814,9 +819,13 @@ def build_platform_layer_lib_win(release): "/DELAYLOAD:webgpu.dll" ] + debug_flags = ["/O2", "/Zi"] if release else ["/Zi", "/DOC_DEBUG", "/DOC_LOG_COMPILE_DEBUG"] + subprocess.run([ "cl", "/nologo", - "/we4013", "/Zi", "/Zc:preprocessor", + "/we4013", + *debug_flags, + "/Zc:preprocessor", "/DOC_BUILD_DLL", "/std:c11", "/experimental:c11atomics", *includes,