virtualx-engine/drivers/png/SCsub
Rémi Verschelde bfea3f1d9a 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.

(cherry picked from commit da09c6131b)

Obviously removed the parts about enet and visual_script.
2016-10-30 14:51:32 +01:00

49 lines
1.5 KiB
Text

Import('env')
Import('env_drivers')
# Thirdparty source files
if (env["libpng"] == "builtin"):
thirdparty_dir = "#thirdparty/libpng/"
thirdparty_sources = [
thirdparty_dir + "png.c",
thirdparty_dir + "pngerror.c",
thirdparty_dir + "pngget.c",
thirdparty_dir + "pngmem.c",
thirdparty_dir + "pngpread.c",
thirdparty_dir + "pngread.c",
thirdparty_dir + "pngrio.c",
thirdparty_dir + "pngrtran.c",
thirdparty_dir + "pngrutil.c",
thirdparty_dir + "pngset.c",
thirdparty_dir + "pngtrans.c",
thirdparty_dir + "pngwio.c",
thirdparty_dir + "pngwrite.c",
thirdparty_dir + "pngwtran.c",
thirdparty_dir + "pngwutil.c",
]
# Currently .ASM filter_neon.S does not compile on NT.
import os
if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
env_neon = env_drivers.Clone();
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
#env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"])
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_sources)
env.drivers_sources += thirdparty_sources # Concatenation necessary for neon objects it seems?
env_drivers.Append(CPPPATH = [thirdparty_dir])
# Godot's own source files
env_drivers.add_source_files(env.drivers_sources, "*.cpp")
Export('env_drivers')
Export('env')