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.
This commit is contained in:
parent
422196759f
commit
da09c6131b
17 changed files with 94 additions and 93 deletions
|
@ -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])
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"*.cpp")
|
||||
env.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
env_modules.add_source_files(env.modules_sources, thirdparty_enet_sources)
|
||||
env_modules.Append(CPPPATH = [thirdparty_dir])
|
||||
env_enet.add_source_files(env.modules_sources, thirdparty_sources)
|
||||
env_enet.Append(CPPPATH = [thirdparty_dir])
|
||||
|
||||
env_modules.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env_modules')
|
||||
Export('env')
|
||||
env_enet.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"*.cpp")
|
||||
env.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"*.cpp")
|
||||
env.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"*.cpp")
|
||||
env.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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])
|
||||
|
||||
# also requires libogg
|
||||
if (env["libogg"] != "system"): # builtin
|
||||
env_opus.Append(CPPPATH = ["#thirdparty/libogg"])
|
||||
|
||||
# Module files
|
||||
env_modules.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env_modules')
|
||||
Export('env')
|
||||
env_opus.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Import('env')
|
||||
|
||||
env.add_source_files(env.modules_sources,"*.cpp")
|
||||
env.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env')
|
||||
|
|
|
@ -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])
|
||||
|
||||
# also requires libogg
|
||||
if (env["libogg"] != "system"): # builtin
|
||||
env_vorbis.Append(CPPPATH = ["#thirdparty/libogg"])
|
||||
|
||||
# Godot source files
|
||||
env_modules.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
||||
Export('env_modules')
|
||||
Export('env')
|
||||
env_vorbis.add_source_files(env.modules_sources, "*.cpp")
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue