summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfons <joan.fonssanchez@gmail.com>2021-09-28 11:59:56 +0200
committerjfons <joan.fonssanchez@gmail.com>2021-09-28 14:35:21 +0200
commitb197fc20796494fca03162fd2735821a3bd5bc86 (patch)
treefdfc657d9af6770027128063847df15b81b74df6
parent10801b90f99eb67b2999e3dc8f42cc82c7799f3e (diff)
Force optimized builds for thirdparty Embree files
-rw-r--r--SConstruct1
-rw-r--r--methods.py11
-rw-r--r--modules/raycast/SCsub1
3 files changed, 13 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index b6c98eea77..b539dc59b7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -91,6 +91,7 @@ env_base.__class__.add_program = methods.add_program
env_base.__class__.CommandNoCache = methods.CommandNoCache
env_base.__class__.Run = methods.Run
env_base.__class__.disable_warnings = methods.disable_warnings
+env_base.__class__.force_optimization_on_debug = methods.force_optimization_on_debug
env_base.__class__.module_check_dependencies = methods.module_check_dependencies
env_base["x86_libtheora_opt_gcc"] = False
diff --git a/methods.py b/methods.py
index 50b413a0e6..0e71adb40d 100644
--- a/methods.py
+++ b/methods.py
@@ -56,6 +56,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 1fdc8fe1b3..4820cf7608 100644
--- a/modules/raycast/SCsub
+++ b/modules/raycast/SCsub
@@ -79,6 +79,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)