1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

SCons: Integrate WARNLEVEL & OPTIMIZELEVEL

This commit is contained in:
Thaddeus Crews
2025-04-03 12:04:04 -05:00
parent 6392241742
commit 01f0bd36a4
2 changed files with 63 additions and 72 deletions

View File

@@ -108,31 +108,19 @@ def redirect_emitter(target, source, env):
def disable_warnings(self):
# 'self' is the environment
if self.msvc and not using_clang(self):
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
WARN_FLAGS = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/W0"]
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in WARN_FLAGS]
self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in WARN_FLAGS]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in WARN_FLAGS]
self.AppendUnique(CCFLAGS=["/w"])
self["WARNLEVEL"] = "/w"
else:
self.AppendUnique(CCFLAGS=["-w"])
self["WARNLEVEL"] = "-w"
def force_optimization_on_debug(self):
# 'self' is the environment
if self["target"] == "template_release":
return
if self.msvc:
# We have to remove existing optimization level defines before appending /O2,
# otherwise we get: "warning D9025 : overriding '/0d' with '/02'"
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x.startswith("/O")]
self["CFLAGS"] = [x for x in self["CFLAGS"] if not x.startswith("/O")]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x.startswith("/O")]
self.AppendUnique(CCFLAGS=["/O2"])
elif self.msvc:
self["OPTIMIZELEVEL"] = "/O2"
else:
self.AppendUnique(CCFLAGS=["-O3"])
self["OPTIMIZELEVEL"] = "-O3"
def add_module_version_string(self, s):