diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-13 18:54:00 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-15 11:50:41 +0200 |
commit | da09c6131bcdace7e8e62c3dabc62890e9564c97 (patch) | |
tree | e279b0e14a93ff546ab5eb427eeb1c65c9befe6a /modules/openssl | |
parent | 422196759f93df249db38619f136cabd5dcf42cd (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/openssl')
-rw-r--r-- | modules/openssl/SCsub | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub index 4608055036..79facba99a 100644 --- a/modules/openssl/SCsub +++ b/modules/openssl/SCsub @@ -1,12 +1,13 @@ Import('env') Import('env_modules') +env_openssl = env_modules.Clone() # Thirdparty source files if (env["openssl"] != "system"): # builtin thirdparty_dir = "#thirdparty/openssl/" - thirdparty_openssl_sources = [ + thirdparty_sources = [ "ssl/t1_lib.c", "ssl/t1_ext.c", "ssl/s3_srvr.c", @@ -646,11 +647,11 @@ if (env["openssl"] != "system"): # builtin ] if "platform" in env and env["platform"] == "winrt": - thirdparty_openssl_sources += ['winrt.cpp'] + thirdparty_sources += ['winrt.cpp'] - thirdparty_openssl_sources = [thirdparty_dir + file for file in thirdparty_openssl_sources] + thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - env_modules.add_source_files(env.modules_sources, thirdparty_openssl_sources) + env_openssl.add_source_files(env.modules_sources, thirdparty_sources) # FIXME: Clone the environment to make a env_openssl and not pollute the modules env thirdparty_include_paths = [ @@ -661,25 +662,24 @@ if (env["openssl"] != "system"): # builtin "crypto/modes", "openssl", ] - env_modules.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) + env_openssl.Append(CPPPATH = [thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) - env_modules.Append(CPPFLAGS = ["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"]) + env_openssl.Append(CPPFLAGS = ["-DOPENSSL_NO_ASM", "-DOPENSSL_THREADS", "-DL_ENDIAN"]) # Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517) import os import methods if not (os.name=="nt" and methods.msvc_is_detected()): # not Windows and not MSVC - env_modules.Append(CFLAGS = ["-Wno-error=implicit-function-declaration"]) + env_openssl.Append(CFLAGS = ["-Wno-error=implicit-function-declaration"]) # Module sources -env_modules.add_source_files(env.modules_sources, "*.cpp") -env_modules.add_source_files(env.modules_sources, "*.c") +env_openssl.add_source_files(env.modules_sources, "*.cpp") +env_openssl.add_source_files(env.modules_sources, "*.c") # platform/winrt need to know openssl is available, pass to main env if "platform" in env and env["platform"] == "winrt": env.Append(CPPPATH = [thirdparty_dir]) env.Append(CPPFLAGS = ['-DOPENSSL_ENABLED']); -Export('env_modules') Export('env') |