From 99aa9a99f909e17f41e64e18b5255dd65bcd167d Mon Sep 17 00:00:00 2001 From: jfons Date: Tue, 28 Sep 2021 11:59:56 +0200 Subject: [PATCH] Force optimized builds for thirdparty Embree files (cherry picked from commit b197fc20796494fca03162fd2735821a3bd5bc86) --- SConstruct | 1 + methods.py | 11 +++++++++++ modules/raycast/SCsub | 1 + 3 files changed, 13 insertions(+) diff --git a/SConstruct b/SConstruct index d28b90be8f4..2e23711c124 100644 --- a/SConstruct +++ b/SConstruct @@ -94,6 +94,7 @@ env_base.__class__.add_library = methods.add_library env_base.__class__.add_program = methods.add_program env_base.__class__.CommandNoCache = methods.CommandNoCache env_base.__class__.disable_warnings = methods.disable_warnings +env_base.__class__.force_optimization_on_debug = methods.force_optimization_on_debug env_base["x86_libtheora_opt_gcc"] = False env_base["x86_libtheora_opt_vc"] = False diff --git a/methods.py b/methods.py index 38454d61d69..33d4754ec99 100644 --- a/methods.py +++ b/methods.py @@ -59,6 +59,17 @@ def disable_warnings(self): self.Append(CXXFLAGS=["-w"]) +def force_optimization_on_debug(self): + # 'self' is the environment + if self["target"] != "debug": + return + + if self.msvc: + self.Append(CCFLAGS=["/O2"]) + else: + self.Append(CCFLAGS=["-O3"]) + + def add_module_version_string(self, s): self.module_version_string += "." + s diff --git a/modules/raycast/SCsub b/modules/raycast/SCsub index 9e7616fbd89..10b423b06a8 100644 --- a/modules/raycast/SCsub +++ b/modules/raycast/SCsub @@ -80,6 +80,7 @@ if env["builtin_embree"]: env.Append(LIBS=["psapi"]) env_thirdparty = env_raycast.Clone() + env_thirdparty.force_optimization_on_debug() env_thirdparty.disable_warnings() env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)