From 5fef84a1358310304cb1114924525ec4df794b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 9 Oct 2016 23:36:17 +0200 Subject: png: Split library to thirdparty dir and allow unbundling Uses the new structure agreed upon in #6157, but the thirdparty/ folder does not behave following a logic similar to that of modules/ yet. The png driver can't be moved to a module as discussed in #6157, as it's required by core together with a few other ImageLoader implementations (see drivers/register_driver_types.cpp:register_core_driver_types()) Dropped the possibility to disable PNG support, it's a core component of Godot. --- drivers/png/SCsub | 79 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 36 deletions(-) (limited to 'drivers/png/SCsub') diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 96ef9fa5f8..ea2324c0cf 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -1,42 +1,49 @@ Import('env') Import('env_drivers') +# Thirdparty source files -png_sources = [ - "png/png.c", - "png/pngerror.c", - "png/pngget.c", - "png/pngmem.c", - "png/pngpread.c", - "png/pngread.c", - "png/pngrio.c", - "png/pngrtran.c", - "png/pngrutil.c", - "png/pngset.c", - "png/pngtrans.c", - "png/pngwio.c", - "png/pngwrite.c", - "png/pngwtran.c", - "png/pngwutil.c", - "png/resource_saver_png.cpp", - "png/image_loader_png.cpp" -] - -# 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"]) - png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c")) - png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S")) -else: - env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"]) - -env.drivers_sources+=png_sources - -#env.add_source_files(env.drivers_sources, png_sources) +if (env["libpng"] == "builtin"): + thirdparty_dir = "#thirdparty/libpng/" + thirdparty_png_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_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")) + 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.Append(CPPPATH = [thirdparty_dir]) + + +# Godot's own source files + +env_drivers.add_source_files(env.drivers_sources, "*.cpp") + +Export('env_drivers') Export('env') -- cgit v1.2.3