From: Travis Wrightsman Date: Thu, 23 Oct 2025 16:08:37 +0200 Subject: Allow setting explicit output path Forwarded: https://github.com/godotengine/godot/pull/101403 --- SConstruct | 1 + platform/linuxbsd/SCsub | 7 ++++--- platform/macos/SCsub | 7 ++++--- platform/web/SCsub | 2 +- platform/windows/SCsub | 7 ++++--- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/SConstruct b/SConstruct index 58c895b..5c272bc 100644 --- a/SConstruct +++ b/SConstruct @@ -247,6 +247,7 @@ opts.Add( EnumVariable("warnings", "Level of compilation warnings", "all", ["extra", "all", "moderate", "no"], ignorecase=2) ) opts.Add(BoolVariable("werror", "Treat compiler warnings as errors", False)) +opts.Add("output_path", "Explicit path to output Godot binary relative to source root", "") opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files", "") opts.Add("object_prefix", "Custom prefix added to the base filename of all generated object files", "") opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False)) diff --git a/platform/linuxbsd/SCsub b/platform/linuxbsd/SCsub index 87586c5..e352740 100644 --- a/platform/linuxbsd/SCsub +++ b/platform/linuxbsd/SCsub @@ -40,12 +40,13 @@ if env["dbus"]: if env["use_sowrap"]: common_linuxbsd.append("dbus-so_wrap.c") +godot_bin_path = f"#{env['output_path']}" if env["output_path"] else "#bin/godot" if env["library_type"] == "static_library": - prog = env.add_library("#bin/godot", common_linuxbsd) + prog = env.add_library(godot_bin_path, common_linuxbsd) elif env["library_type"] == "shared_library": - prog = env.add_shared_library("#bin/godot", common_linuxbsd) + prog = env.add_shared_library(godot_bin_path, common_linuxbsd) else: - prog = env.add_program("#bin/godot", common_linuxbsd) + prog = env.add_program(godot_bin_path, common_linuxbsd) if env["debug_symbols"] and env["separate_debug_symbols"]: env.AddPostAction(prog, env.Run(platform_linuxbsd_builders.make_debug_linuxbsd)) diff --git a/platform/macos/SCsub b/platform/macos/SCsub index 883bd53..a80b898 100644 --- a/platform/macos/SCsub +++ b/platform/macos/SCsub @@ -44,12 +44,13 @@ if env["library_type"] == "executable": else: files += ["libgodot_macos.mm"] +godot_bin_path = f"#{env['output_path']}" if env["output_path"] else "#bin/godot" if env["library_type"] == "static_library": - prog = env.add_library("#bin/godot", files) + prog = env.add_library(godot_bin_path, files) elif env["library_type"] == "shared_library": - prog = env.add_shared_library("#bin/godot", files) + prog = env.add_shared_library(godot_bin_path, files) else: - prog = env.add_program("#bin/godot", files) + prog = env.add_program(godot_bin_path, files) if env["debug_symbols"] and env["separate_debug_symbols"]: env.AddPostAction(prog, env.Run(platform_macos_builders.make_debug_macos)) diff --git a/platform/web/SCsub b/platform/web/SCsub index ea974ac..4881d22 100644 --- a/platform/web/SCsub +++ b/platform/web/SCsub @@ -101,7 +101,7 @@ if env["dlink_enabled"]: sys = sys_env.add_program(build_targets, ["web_runtime.cpp"]) # The side library, containing all Godot code. - wasm = env.add_program("#bin/godot.side${PROGSUFFIX}.wasm", web_files) + wasm = env.add_program(f"#{env['output_path']}" if env["output_path"] else "#bin/godot.side${PROGSUFFIX}.wasm", web_files) build = sys + [wasm[0]] else: # We use IDBFS. Since Emscripten 1.39.1 it needs to be linked explicitly. diff --git a/platform/windows/SCsub b/platform/windows/SCsub index aefb048..fb34e5f 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -84,12 +84,13 @@ sources += res_obj if env["accesskit"] and not env.msvc: sources += env.DEFLIB("uiautomationcore") +godot_bin_path = f"#{env['output_path']}" if env["output_path"] else "#bin/godot" if env["library_type"] == "static_library": - prog = env.add_library("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"]) + prog = env.add_library(godot_bin_path, sources, PROGSUFFIX=env["PROGSUFFIX"]) elif env["library_type"] == "shared_library": - prog = env.add_shared_library("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"]) + prog = env.add_shared_library(godot_bin_path, sources, PROGSUFFIX=env["PROGSUFFIX"]) else: - prog = env.add_program("#bin/godot", sources, PROGSUFFIX=env["PROGSUFFIX"]) + prog = env.add_program(godot_bin_path, sources, PROGSUFFIX=env["PROGSUFFIX"]) arrange_program_clean(prog) env.Depends(prog, "godot.manifest")