summaryrefslogtreecommitdiff
path: root/modules/opus
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-10-13 18:54:00 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-10-15 11:50:41 +0200
commitda09c6131bcdace7e8e62c3dabc62890e9564c97 (patch)
treee279b0e14a93ff546ab5eb427eeb1c65c9befe6a /modules/opus
parent422196759f93df249db38619f136cabd5dcf42cd (diff)
modules: Clone env in each module
This allows to pass include paths and flags only to a given thirdparty library, thus preventing conflicts between their files (e.g. between opus and openssl which both provide modes.h. This also has the nice effect of making the compilation command smaller for each module as it no longer related to all other modules, only the final linking brings them together. This however requires adding manually the ogg include path in opus and vorbis when building against the builtin ogg, since it is no longer in the global env. Also simplified template 'thirdparty_<module>_sources' to 'thirdparty_sources'. "Core" modules like cscript, gdscript, gridmap, ik and virtual_script still use the main env_modules, but it could be changed if need be.
Diffstat (limited to 'modules/opus')
-rw-r--r--modules/opus/SCsub24
1 files changed, 13 insertions, 11 deletions
diff --git a/modules/opus/SCsub b/modules/opus/SCsub
index a18e008fe0..5c587a0783 100644
--- a/modules/opus/SCsub
+++ b/modules/opus/SCsub
@@ -1,11 +1,13 @@
Import('env')
Import('env_modules')
+env_opus = env_modules.Clone()
+
# Thirdparty source files
if (env["opus"] != "system"): # builtin
thirdparty_dir = "#thirdparty/opus/"
- thirdparty_opus_sources = [
+ thirdparty_sources = [
"silk/tables_other.c",
"silk/sum_sqr_shift.c",
"silk/PLC.c",
@@ -126,7 +128,7 @@ if (env["opus"] != "system"): # builtin
opus_sources_silk = []
if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
- env_modules.Append(CFLAGS = ["-DFIXED_POINT"])
+ env_opus.Append(CFLAGS = ["-DFIXED_POINT"])
opus_sources_silk = [
"silk/fixed/schur64_FIX.c",
"silk/fixed/residual_energy16_FIX.c",
@@ -189,11 +191,10 @@ if (env["opus"] != "system"): # builtin
"silk/float/prefilter_FLP.c"
]
- thirdparty_opus_sources = [thirdparty_dir + file for file in thirdparty_opus_sources + opus_sources_silk]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources + opus_sources_silk]
- env_modules.add_source_files(env.modules_sources, thirdparty_opus_sources)
- # FIXME: Clone the environment to make a env_opus and not pollute the modules env
- env_modules.Append(CFLAGS=["-DHAVE_CONFIG_H"])
+ env_opus.add_source_files(env.modules_sources, thirdparty_sources)
+ env_opus.Append(CFLAGS=["-DHAVE_CONFIG_H"])
thirdparty_include_paths = [
"",
@@ -202,10 +203,11 @@ if (env["opus"] != "system"): # builtin
"silk/fixed",
"silk/float",
]
- env_modules.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
+ env_opus.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
-# Module files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
+ # also requires libogg
+ if (env["libogg"] != "system"): # builtin
+ env_opus.Append(CPPPATH = ["#thirdparty/libogg"])
-Export('env_modules')
-Export('env')
+# Module files
+env_opus.add_source_files(env.modules_sources, "*.cpp")