summaryrefslogtreecommitdiff
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
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.
-rw-r--r--drivers/png/SCsub10
-rw-r--r--modules/cscript/SCsub2
-rw-r--r--modules/dds/SCsub5
-rw-r--r--modules/enet/SCsub15
-rw-r--r--modules/etc1/SCsub15
-rw-r--r--modules/gdscript/SCsub2
-rw-r--r--modules/gridmap/SCsub4
-rw-r--r--modules/ik/SCsub4
-rw-r--r--modules/jpg/SCsub15
-rw-r--r--modules/ogg/SCsub15
-rw-r--r--modules/openssl/SCsub20
-rw-r--r--modules/opus/SCsub24
-rw-r--r--modules/pbm/SCsub5
-rw-r--r--modules/pvr/SCsub15
-rw-r--r--modules/visual_script/SCsub2
-rw-r--r--modules/vorbis/SCsub19
-rw-r--r--modules/webp/SCsub15
17 files changed, 94 insertions, 93 deletions
diff --git a/drivers/png/SCsub b/drivers/png/SCsub
index ea2324c0cf..1ab42a6db9 100644
--- a/drivers/png/SCsub
+++ b/drivers/png/SCsub
@@ -5,7 +5,7 @@ Import('env_drivers')
if (env["libpng"] == "builtin"):
thirdparty_dir = "#thirdparty/libpng/"
- thirdparty_png_sources = [
+ thirdparty_sources = [
thirdparty_dir + "png.c",
thirdparty_dir + "pngerror.c",
thirdparty_dir + "pngget.c",
@@ -31,13 +31,13 @@ if (env["libpng"] == "builtin"):
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
#env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"])
- thirdparty_png_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
- thirdparty_png_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
+ thirdparty_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
+ thirdparty_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
else:
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
- #env_drivers.add_source_files(env.drivers_sources, thirdparty_png_sources)
- env.drivers_sources += thirdparty_png_sources # Concatenation necessary for neon objects it seems?
+ #env_drivers.add_source_files(env.drivers_sources, thirdparty_sources)
+ env.drivers_sources += thirdparty_sources # Concatenation necessary for neon objects it seems?
env_drivers.Append(CPPPATH = [thirdparty_dir])
diff --git a/modules/cscript/SCsub b/modules/cscript/SCsub
index 403fe68f66..9ff13fc43f 100644
--- a/modules/cscript/SCsub
+++ b/modules/cscript/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/dds/SCsub b/modules/dds/SCsub
index bcea3a84c0..c54a58e079 100644
--- a/modules/dds/SCsub
+++ b/modules/dds/SCsub
@@ -1,7 +1,6 @@
Import('env')
Import('env_modules')
-env_modules.add_source_files(env.modules_sources, "*.cpp")
+env_dds = env_modules.Clone()
-Export('env_modules')
-Export('env')
+env_dds.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/enet/SCsub b/modules/enet/SCsub
index 79231c63e5..66c60baabe 100644
--- a/modules/enet/SCsub
+++ b/modules/enet/SCsub
@@ -3,9 +3,11 @@ Import('env_modules')
# Thirdparty source files
+env_enet = env_modules.Clone()
+
if (env["enet"] != "system"): # builtin
thirdparty_dir = "#thirdparty/enet/"
- thirdparty_enet_sources = [
+ thirdparty_sources = [
"callbacks.c",
"compress.c",
"host.c",
@@ -16,12 +18,9 @@ if (env["enet"] != "system"): # builtin
"unix.c",
"win32.c",
]
- thirdparty_enet_sources = [thirdparty_dir + file for file in thirdparty_enet_sources]
-
- env_modules.add_source_files(env.modules_sources, thirdparty_enet_sources)
- env_modules.Append(CPPPATH = [thirdparty_dir])
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_modules.add_source_files(env.modules_sources, "*.cpp")
+ env_enet.add_source_files(env.modules_sources, thirdparty_sources)
+ env_enet.Append(CPPPATH = [thirdparty_dir])
-Export('env_modules')
-Export('env')
+env_enet.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/etc1/SCsub b/modules/etc1/SCsub
index 93c304fe7f..ad343ab579 100644
--- a/modules/etc1/SCsub
+++ b/modules/etc1/SCsub
@@ -1,19 +1,18 @@
Import('env')
Import('env_modules')
+env_etc1 = env_modules.Clone()
+
# Thirdparty source files
# Not unbundled so far since not widespread as shared library
thirdparty_dir = "#thirdparty/rg-etc1/"
-thirdparty_etc1_sources = [
+thirdparty_sources = [
"rg_etc1.cpp",
]
-thirdparty_etc1_sources = [thirdparty_dir + file for file in thirdparty_etc1_sources]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_modules.add_source_files(env.modules_sources, thirdparty_etc1_sources)
-env_modules.Append(CPPPATH = [thirdparty_dir])
+env_etc1.add_source_files(env.modules_sources, thirdparty_sources)
+env_etc1.Append(CPPPATH = [thirdparty_dir])
# Godot source files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env_modules')
-Export('env')
+env_etc1.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub
index 403fe68f66..9ff13fc43f 100644
--- a/modules/gdscript/SCsub
+++ b/modules/gdscript/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub
index 211a043468..9ff13fc43f 100644
--- a/modules/gridmap/SCsub
+++ b/modules/gridmap/SCsub
@@ -1,3 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
+
+Export('env')
diff --git a/modules/ik/SCsub b/modules/ik/SCsub
index 211a043468..9ff13fc43f 100644
--- a/modules/ik/SCsub
+++ b/modules/ik/SCsub
@@ -1,3 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
+
+Export('env')
diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub
index 409a8b52d0..258fd2f4ad 100644
--- a/modules/jpg/SCsub
+++ b/modules/jpg/SCsub
@@ -1,19 +1,18 @@
Import('env')
Import('env_modules')
+env_jpg = env_modules.Clone()
+
# Thirdparty source files
# Not unbundled for now as they are not commonly available as shared library
thirdparty_dir = "#thirdparty/jpeg-compressor/"
-thirdparty_jpg_sources = [
+thirdparty_sources = [
"jpgd.cpp",
]
-thirdparty_jpg_sources = [thirdparty_dir + file for file in thirdparty_jpg_sources]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_modules.add_source_files(env.modules_sources, thirdparty_jpg_sources)
-env_modules.Append(CPPPATH = [thirdparty_dir])
+env_jpg.add_source_files(env.modules_sources, thirdparty_sources)
+env_jpg.Append(CPPPATH = [thirdparty_dir])
# Godot's own source files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env_modules')
-Export('env')
+env_jpg.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub
index 42d593f88e..fd5ddf55c8 100644
--- a/modules/ogg/SCsub
+++ b/modules/ogg/SCsub
@@ -1,20 +1,19 @@
Import('env')
Import('env_modules')
+env_ogg = env_modules.Clone()
+
# Thirdparty source files
if (env["libogg"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libogg/"
- thirdparty_libogg_sources = [
+ thirdparty_sources = [
"bitwise.c",
"framing.c",
]
- thirdparty_libogg_sources = [thirdparty_dir + file for file in thirdparty_libogg_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_modules.add_source_files(env.modules_sources, thirdparty_libogg_sources)
- env_modules.Append(CPPPATH = [thirdparty_dir])
+ env_ogg.add_source_files(env.modules_sources, thirdparty_sources)
+ env_ogg.Append(CPPPATH = [thirdparty_dir])
# Godot source files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env_modules')
-Export('env')
+env_ogg.add_source_files(env.modules_sources, "*.cpp")
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')
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")
diff --git a/modules/pbm/SCsub b/modules/pbm/SCsub
index bcea3a84c0..e0b19fb2a3 100644
--- a/modules/pbm/SCsub
+++ b/modules/pbm/SCsub
@@ -1,7 +1,6 @@
Import('env')
Import('env_modules')
-env_modules.add_source_files(env.modules_sources, "*.cpp")
+env_pbm = env_modules.Clone()
-Export('env_modules')
-Export('env')
+env_pbm.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub
index b169695018..cd0a3129da 100644
--- a/modules/pvr/SCsub
+++ b/modules/pvr/SCsub
@@ -1,23 +1,22 @@
Import('env')
Import('env_modules')
+env_pvr = env_modules.Clone()
+
# Thirdparty source files
# Not unbundled so far since not widespread as shared library
thirdparty_dir = "#thirdparty/pvrtccompressor/"
-thirdparty_pvr_sources = [
+thirdparty_sources = [
"BitScale.cpp",
"MortonTable.cpp",
"PvrTcDecoder.cpp",
"PvrTcEncoder.cpp",
"PvrTcPacket.cpp",
]
-thirdparty_pvr_sources = [thirdparty_dir + file for file in thirdparty_pvr_sources]
+thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
-env_modules.add_source_files(env.modules_sources, thirdparty_pvr_sources)
-env_modules.Append(CPPPATH = [thirdparty_dir])
+env_pvr.add_source_files(env.modules_sources, thirdparty_sources)
+env_pvr.Append(CPPPATH = [thirdparty_dir])
# Godot source files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env_modules')
-Export('env')
+env_pvr.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub
index 403fe68f66..9ff13fc43f 100644
--- a/modules/visual_script/SCsub
+++ b/modules/visual_script/SCsub
@@ -1,5 +1,5 @@
Import('env')
-env.add_source_files(env.modules_sources,"*.cpp")
+env.add_source_files(env.modules_sources, "*.cpp")
Export('env')
diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub
index 5427348c39..f3dbc893fc 100644
--- a/modules/vorbis/SCsub
+++ b/modules/vorbis/SCsub
@@ -1,10 +1,12 @@
Import('env')
Import('env_modules')
+env_vorbis = env_modules.Clone()
+
# Thirdparty source files
if (env["libvorbis"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libvorbis/"
- thirdparty_libvorbis_sources = [
+ thirdparty_sources = [
#"analysis.c",
#"barkmel.c",
"bitrate.c",
@@ -32,13 +34,14 @@ if (env["libvorbis"] != "system"): # builtin
"window.c",
]
- thirdparty_libvorbis_sources = [thirdparty_dir + file for file in thirdparty_libvorbis_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_modules.add_source_files(env.modules_sources, thirdparty_libvorbis_sources)
- env_modules.Append(CPPPATH = [thirdparty_dir])
+ env_vorbis.add_source_files(env.modules_sources, thirdparty_sources)
+ env_vorbis.Append(CPPPATH = [thirdparty_dir])
-# Godot source files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
+ # also requires libogg
+ if (env["libogg"] != "system"): # builtin
+ env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"])
-Export('env_modules')
-Export('env')
+# Godot source files
+env_vorbis.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index f52c5b9af8..4997aa3359 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -1,10 +1,12 @@
Import('env')
Import('env_modules')
+env_webp = env_modules.Clone()
+
# Thirdparty source files
if (env["libwebp"] != "system"): # builtin
thirdparty_dir = "#thirdparty/libwebp/"
- thirdparty_libwebp_sources = [
+ thirdparty_sources = [
"enc/webpenc.c",
"enc/near_lossless.c",
"enc/frame.c",
@@ -108,13 +110,10 @@ if (env["libwebp"] != "system"): # builtin
"dsp/enc_sse2.c",
"dsp/upsampling_sse2.c",
]
- thirdparty_libwebp_sources = [thirdparty_dir + file for file in thirdparty_libwebp_sources]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
- env_modules.add_source_files(env.modules_sources, thirdparty_libwebp_sources)
- env_modules.Append(CPPPATH = [thirdparty_dir])
+ env_webp.add_source_files(env.modules_sources, thirdparty_sources)
+ env_webp.Append(CPPPATH = [thirdparty_dir])
# Godot source files
-env_modules.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env_modules')
-Export('env')
+env_webp.add_source_files(env.modules_sources, "*.cpp")