From da09c6131bcdace7e8e62c3dabc62890e9564c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 13 Oct 2016 18:54:00 +0200 Subject: 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__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. --- modules/opus/SCsub | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'modules/opus') 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") -- cgit v1.2.3