From 1fbc0c5631ed8e2ff430f8049bd4569ff875a92e Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Tue, 29 Apr 2025 13:27:33 -0400 Subject: [PATCH] [Buildsystem] Add `EnumVariable(ignorecase=2)` --- SConstruct | 25 +++++++++++++++++++------ platform/linuxbsd/detect.py | 2 +- platform/macos/detect.py | 2 +- platform/windows/detect.py | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/SConstruct b/SConstruct index ff723e1c4e7..7037ca4eb8b 100644 --- a/SConstruct +++ b/SConstruct @@ -159,27 +159,38 @@ opts = Variables(customs, ARGUMENTS) # Target build options opts.Add((["platform", "p"], "Target platform (%s)" % "|".join(platform_list), "")) -opts.Add(EnumVariable("target", "Compilation target", "editor", ("editor", "template_release", "template_debug"))) -opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases)) +opts.Add( + EnumVariable( + "target", "Compilation target", "editor", ["editor", "template_release", "template_debug"], ignorecase=2 + ) +) +opts.Add(EnumVariable("arch", "CPU architecture", "auto", ["auto"] + architectures, architecture_aliases, ignorecase=2)) opts.Add(BoolVariable("dev_build", "Developer build with dev-only debugging code (DEV_ENABLED)", False)) opts.Add( EnumVariable( "optimize", "Optimization level (by default inferred from 'target' and 'dev_build')", "auto", - ("auto", "none", "custom", "debug", "speed", "speed_trace", "size", "size_extra"), + ["auto", "none", "custom", "debug", "speed", "speed_trace", "size", "size_extra"], + ignorecase=2, ) ) opts.Add(BoolVariable("debug_symbols", "Build with debugging symbols", False)) opts.Add(BoolVariable("separate_debug_symbols", "Extract debugging symbols to a separate file", False)) opts.Add(BoolVariable("debug_paths_relative", "Make file paths in debug symbols relative (if supported)", False)) -opts.Add(EnumVariable("lto", "Link-time optimization (production builds)", "none", ("none", "auto", "thin", "full"))) +opts.Add( + EnumVariable( + "lto", "Link-time optimization (production builds)", "none", ["none", "auto", "thin", "full"], ignorecase=2 + ) +) opts.Add(BoolVariable("production", "Set defaults to build Godot for use in production", False)) opts.Add(BoolVariable("threads", "Enable threading support", True)) # Components opts.Add(BoolVariable("deprecated", "Enable compatibility code for deprecated and removed features", True)) -opts.Add(EnumVariable("precision", "Set the floating-point precision level", "single", ("single", "double"))) +opts.Add( + EnumVariable("precision", "Set the floating-point precision level", "single", ["single", "double"], ignorecase=2) +) opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True)) opts.Add(BoolVariable("brotli", "Enable Brotli for decompression and WOFF2 fonts support", True)) opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver on supported platforms", False)) @@ -213,7 +224,9 @@ opts.Add( ) opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True)) -opts.Add(EnumVariable("warnings", "Level of compilation warnings", "all", ("extra", "all", "moderate", "no"))) +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("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", "") diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 82ada66f31c..da0e62af44d 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -30,7 +30,7 @@ def get_opts(): from SCons.Variables import BoolVariable, EnumVariable return [ - EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")), + EnumVariable("linker", "Linker program", "default", ["default", "bfd", "gold", "lld", "mold"], ignorecase=2), BoolVariable("use_llvm", "Use the LLVM compiler", False), BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True), BoolVariable("use_coverage", "Test Godot coverage", False), diff --git a/platform/macos/detect.py b/platform/macos/detect.py index 6d8f43e14f2..0a08471f2d7 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -31,7 +31,7 @@ def get_opts(): ("osxcross_sdk", "OSXCross SDK version", "darwin16"), ("MACOS_SDK_PATH", "Path to the macOS SDK", ""), ("vulkan_sdk_path", "Path to the Vulkan SDK", ""), - EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ("no", "5.0", "devel")), + EnumVariable("macports_clang", "Build using Clang from MacPorts", "no", ["no", "5.0", "devel"], ignorecase=2), BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False), BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False), BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False), diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 44a7cf97ae8..de97685b858 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -190,7 +190,7 @@ def get_opts(): "Targeted Windows version, >= 0x0601 (Windows 7)", "0x0601", ), - EnumVariable("windows_subsystem", "Windows subsystem", "gui", ("gui", "console")), + EnumVariable("windows_subsystem", "Windows subsystem", "gui", ["gui", "console"], ignorecase=2), ("msvc_version", "MSVC version to use. Handled automatically by SCons if omitted.", ""), BoolVariable("use_mingw", "Use the Mingw compiler, even if MSVC is installed.", False), BoolVariable("use_llvm", "Use the LLVM compiler", False),