Skip to content

Commit e7a1eae

Browse files
committed
Merge pull request #70770 from vnen/scons-clone-env-vars
Add option in SCons to clone env variables
2 parents f8a2a91 + ed52ac9 commit e7a1eae

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

SConstruct

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all
212212
opts.Add("object_prefix", "Custom prefix added to the base filename of all generated object files", "")
213213
opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False))
214214
opts.Add("vsproj_name", "Name of the Visual Studio solution", "godot")
215+
opts.Add("import_env_vars", "A comma-separated list of environment variables to copy from the outer environment.", "")
215216
opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False))
216217
opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False))
217218
opts.Add("build_profile", "Path to a file containing a feature build profile", "")
@@ -270,6 +271,12 @@ opts.Add("LINKFLAGS", "Custom flags for the linker")
270271
# in following code (especially platform and custom_modules).
271272
opts.Update(env_base)
272273

274+
# Copy custom environment variables if set.
275+
if env_base["import_env_vars"]:
276+
for env_var in str(env_base["import_env_vars"]).split(","):
277+
if env_var in os.environ:
278+
env_base["ENV"][env_var] = os.environ[env_var]
279+
273280
# Platform selection: validate input, and add options.
274281

275282
selected_platform = ""

0 commit comments

Comments
 (0)