From ec3c804ea6e3ae75fc0c7debfddb1fa9f04771aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 16 Jan 2023 12:15:48 +0100 Subject: [PATCH] SCons: Fix feature build profile being parsed too late Also renames the option to just `build_profile`, the previous one was too verbose and had words in the wrong order. Fixes #70643. --- SConstruct | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/SConstruct b/SConstruct index 705ef43b3d1..1acbd83e63c 100644 --- a/SConstruct +++ b/SConstruct @@ -202,7 +202,7 @@ opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False)) opts.Add(BoolVariable("disable_3d", "Disable 3D nodes for a smaller executable", False)) opts.Add(BoolVariable("disable_advanced_gui", "Disable advanced GUI nodes and behaviors", False)) -opts.Add("build_feature_profile", "Path to a file containing a feature build profile", "") +opts.Add("build_profile", "Path to a file containing a feature build profile", "") opts.Add(BoolVariable("modules_enabled_by_default", "If no, disable all modules except ones explicitly enabled", True)) opts.Add(BoolVariable("no_editor_splash", "Don't use the custom splash screen for the editor", True)) opts.Add("system_certs_path", "Use this path as SSL certificates default for editor (for package maintainers)", "") @@ -492,6 +492,25 @@ if selected_platform in platform_list: env["LINKFLAGS"] = "" env.Append(LINKFLAGS=str(LINKFLAGS).split()) + # Feature build profile + disabled_classes = [] + if env["build_profile"] != "": + print("Using feature build profile: " + env["build_profile"]) + import json + + try: + ft = json.load(open(env["build_profile"])) + if "disabled_classes" in ft: + disabled_classes = ft["disabled_classes"] + if "disabled_build_options" in ft: + dbo = ft["disabled_build_options"] + for c in dbo: + env[c] = dbo[c] + except: + print("Error opening feature build profile: " + env["build_profile"]) + Exit(255) + methods.write_disabled_classes(disabled_classes) + # Platform specific flags. # These can sometimes override default options. flag_list = platform_flags[selected_platform] @@ -818,26 +837,6 @@ if selected_platform in platform_list: env["LIBSUFFIX"] = suffix + env["LIBSUFFIX"] env["SHLIBSUFFIX"] = suffix + env["SHLIBSUFFIX"] - disabled_classes = [] - - if env["build_feature_profile"] != "": - print("Using build feature profile: " + env["build_feature_profile"]) - import json - - try: - ft = json.load(open(env["build_feature_profile"])) - if "disabled_classes" in ft: - disabled_classes = ft["disabled_classes"] - if "disabled_build_options" in ft: - dbo = ft["disabled_build_options"] - for c in dbo: - env[c] = dbo[c] - except: - print("Error opening feature build profile: " + env["build_feature_profile"]) - Exit(255) - - methods.write_disabled_classes(disabled_classes) - if env["disable_3d"]: if env.editor_build: print("Build option 'disable_3d=yes' cannot be used for editor builds, but only for export templates.")