diff options
Diffstat (limited to 'platform/windows/SCsub')
-rw-r--r-- | platform/windows/SCsub | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 0549e408a7..7aaf70e625 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -3,6 +3,7 @@ Import("env") import os +from pathlib import Path from platform_methods import run_in_subprocess import platform_windows_builders @@ -25,6 +26,19 @@ common_win_wrap = [ "console_wrapper_windows.cpp", ] + +def arrange_program_clean(prog): + """ + Given an SCons program, arrange for output files SCons doesn't know about + to be cleaned when SCons is called with --clean + """ + extensions_to_clean = [".ilk", ".exp", ".pdb", ".lib"] + for program in prog: + executable_stem = Path(program.name).stem + extra_files_to_clean = [f"#bin/{executable_stem}{extension}" for extension in extensions_to_clean] + Clean(prog, extra_files_to_clean) + + res_file = "godot_res.rc" res_target = "godot_res" + env["OBJSUFFIX"] res_obj = env.RES(res_target, res_file) @@ -32,6 +46,7 @@ res_obj = env.RES(res_target, res_file) sources = common_win + res_obj prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"]) +arrange_program_clean(prog) # Build console wrapper app. if env["windows_subsystem"] == "gui": @@ -48,6 +63,7 @@ if env["windows_subsystem"] == "gui": env_wrap.Append(LIBS=["version"]) prog_wrap = env_wrap.add_program("#bin/godot", common_win_wrap + res_wrap_obj, PROGSUFFIX=env["PROGSUFFIX_WRAP"]) + arrange_program_clean(prog_wrap) env_wrap.Depends(prog_wrap, prog) # Microsoft Visual Studio Project Generation @@ -81,7 +97,7 @@ if env["d3d12"]: arch_bin_dir = "#bin/" + env["arch"] # DXC - if env["dxc_path"] != "": + if env["dxc_path"] != "" and os.path.exists(env["dxc_path"]): dxc_dll = "dxil.dll" # Whether this one is loaded from arch-specific directory or not can be determined at runtime. # Let's copy to both and let the user decide the distribution model. @@ -93,7 +109,7 @@ if env["d3d12"]: ) # Agility SDK - if env["agility_sdk_path"] != "": + if env["agility_sdk_path"] != "" and os.path.exists(env["agility_sdk_path"]): agility_dlls = ["D3D12Core.dll", "d3d12SDKLayers.dll"] # Whether these are loaded from arch-specific directory or not has to be known at build time. target_dir = arch_bin_dir if env["agility_sdk_multiarch"] else "#bin" @@ -105,7 +121,7 @@ if env["d3d12"]: ) # PIX - if env["pix_path"] != "": + if env["use_pix"]: pix_dll = "WinPixEventRuntime.dll" env.Command( "#bin/" + pix_dll, |