You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
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.
This commit is contained in:
@@ -127,7 +127,7 @@ opts.Add('theora','Theora Video (yes/no)','yes')
|
|||||||
opts.Add('theoralib','Theora Video (yes/no)','no')
|
opts.Add('theoralib','Theora Video (yes/no)','no')
|
||||||
opts.Add('freetype','Freetype support in editor','builtin')
|
opts.Add('freetype','Freetype support in editor','builtin')
|
||||||
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
||||||
opts.Add('png','PNG Image loader support (yes/no)','yes')
|
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
|
||||||
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
|
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
|
||||||
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
|
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
|
||||||
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
|
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
|
||||||
@@ -350,8 +350,6 @@ if selected_platform in platform_list:
|
|||||||
if (env['theoralib']=='yes'):
|
if (env['theoralib']=='yes'):
|
||||||
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
|
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
|
||||||
|
|
||||||
if (env['png']=='yes'):
|
|
||||||
env.Append(CPPFLAGS=['-DPNG_ENABLED']);
|
|
||||||
if (env['dds']=='yes'):
|
if (env['dds']=='yes'):
|
||||||
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
|
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
|
||||||
if (env['pvr']=='yes'):
|
if (env['pvr']=='yes'):
|
||||||
|
|||||||
3
drivers/SCsub
vendored
3
drivers/SCsub
vendored
@@ -26,8 +26,7 @@ if (env['openssl']!='no'):
|
|||||||
SConscript('openssl/SCsub')
|
SConscript('openssl/SCsub')
|
||||||
|
|
||||||
|
|
||||||
if (env["png"]=="yes"):
|
SConscript("png/SCsub");
|
||||||
SConscript("png/SCsub");
|
|
||||||
if (env["jpg"]=="yes"):
|
if (env["jpg"]=="yes"):
|
||||||
#SConscript("jpg/SCsub");
|
#SConscript("jpg/SCsub");
|
||||||
SConscript("jpegd/SCsub");
|
SConscript("jpegd/SCsub");
|
||||||
|
|||||||
@@ -1,42 +1,49 @@
|
|||||||
Import('env')
|
Import('env')
|
||||||
Import('env_drivers')
|
Import('env_drivers')
|
||||||
|
|
||||||
|
# Thirdparty source files
|
||||||
|
|
||||||
png_sources = [
|
if (env["libpng"] == "builtin"):
|
||||||
"png/png.c",
|
thirdparty_dir = "#thirdparty/libpng/"
|
||||||
"png/pngerror.c",
|
thirdparty_png_sources = [
|
||||||
"png/pngget.c",
|
thirdparty_dir + "png.c",
|
||||||
"png/pngmem.c",
|
thirdparty_dir + "pngerror.c",
|
||||||
"png/pngpread.c",
|
thirdparty_dir + "pngget.c",
|
||||||
"png/pngread.c",
|
thirdparty_dir + "pngmem.c",
|
||||||
"png/pngrio.c",
|
thirdparty_dir + "pngpread.c",
|
||||||
"png/pngrtran.c",
|
thirdparty_dir + "pngread.c",
|
||||||
"png/pngrutil.c",
|
thirdparty_dir + "pngrio.c",
|
||||||
"png/pngset.c",
|
thirdparty_dir + "pngrtran.c",
|
||||||
"png/pngtrans.c",
|
thirdparty_dir + "pngrutil.c",
|
||||||
"png/pngwio.c",
|
thirdparty_dir + "pngset.c",
|
||||||
"png/pngwrite.c",
|
thirdparty_dir + "pngtrans.c",
|
||||||
"png/pngwtran.c",
|
thirdparty_dir + "pngwio.c",
|
||||||
"png/pngwutil.c",
|
thirdparty_dir + "pngwrite.c",
|
||||||
"png/resource_saver_png.cpp",
|
thirdparty_dir + "pngwtran.c",
|
||||||
"png/image_loader_png.cpp"
|
thirdparty_dir + "pngwutil.c",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Currently .ASM filter_neon.S does not compile on NT.
|
# Currently .ASM filter_neon.S does not compile on NT.
|
||||||
import os
|
import os
|
||||||
if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
|
if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
|
||||||
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
|
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
|
||||||
env_neon = env_drivers.Clone();
|
env_neon = env_drivers.Clone();
|
||||||
if "S_compiler" in env:
|
if "S_compiler" in env:
|
||||||
env_neon['CC'] = env['S_compiler']
|
env_neon['CC'] = env['S_compiler']
|
||||||
#env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"])
|
#env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"])
|
||||||
png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c"))
|
thirdparty_png_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
|
||||||
png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S"))
|
thirdparty_png_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
|
||||||
else:
|
else:
|
||||||
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
|
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
|
||||||
|
|
||||||
env.drivers_sources+=png_sources
|
#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])
|
||||||
|
|
||||||
#env.add_source_files(env.drivers_sources, png_sources)
|
|
||||||
|
|
||||||
|
# Godot's own source files
|
||||||
|
|
||||||
|
env_drivers.add_source_files(env.drivers_sources, "*.cpp")
|
||||||
|
|
||||||
|
Export('env_drivers')
|
||||||
Export('env')
|
Export('env')
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "print_string.h"
|
#include "print_string.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,8 @@
|
|||||||
#define IMAGE_LOADER_PNG_H
|
#define IMAGE_LOADER_PNG_H
|
||||||
|
|
||||||
#include "io/image_loader.h"
|
#include "io/image_loader.h"
|
||||||
#include "drivers/png/png.h"
|
|
||||||
|
#include <png.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@author Juan Linietsky <reduzio@gmail.com>
|
@author Juan Linietsky <reduzio@gmail.com>
|
||||||
|
|||||||
@@ -27,11 +27,13 @@
|
|||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
#include "resource_saver_png.h"
|
#include "resource_saver_png.h"
|
||||||
#include "scene/resources/texture.h"
|
|
||||||
#include "drivers/png/png.h"
|
|
||||||
#include "os/file_access.h"
|
|
||||||
#include "globals.h"
|
|
||||||
#include "core/image.h"
|
#include "core/image.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "os/file_access.h"
|
||||||
|
#include "scene/resources/texture.h"
|
||||||
|
|
||||||
|
#include <png.h>
|
||||||
|
|
||||||
static void _write_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) {
|
static void _write_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) {
|
||||||
|
|
||||||
|
|||||||
16
drivers/register_driver_types.cpp
vendored
16
drivers/register_driver_types.cpp
vendored
@@ -29,8 +29,8 @@
|
|||||||
#include "register_driver_types.h"
|
#include "register_driver_types.h"
|
||||||
|
|
||||||
#include "png/image_loader_png.h"
|
#include "png/image_loader_png.h"
|
||||||
#include "webp/image_loader_webp.h"
|
|
||||||
#include "png/resource_saver_png.h"
|
#include "png/resource_saver_png.h"
|
||||||
|
#include "webp/image_loader_webp.h"
|
||||||
#include "jpegd/image_loader_jpegd.h"
|
#include "jpegd/image_loader_jpegd.h"
|
||||||
#include "dds/texture_loader_dds.h"
|
#include "dds/texture_loader_dds.h"
|
||||||
#include "etc1/texture_loader_pkm.h"
|
#include "etc1/texture_loader_pkm.h"
|
||||||
@@ -75,14 +75,11 @@
|
|||||||
#include "mpc/audio_stream_mpc.h"
|
#include "mpc/audio_stream_mpc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_ENABLED
|
|
||||||
static ImageLoaderPNG *image_loader_png=NULL;
|
static ImageLoaderPNG *image_loader_png=NULL;
|
||||||
static ResourceSaverPNG *resource_saver_png=NULL;
|
static ResourceSaverPNG *resource_saver_png=NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBP_ENABLED
|
#ifdef WEBP_ENABLED
|
||||||
static ImageLoaderWEBP *image_loader_webp=NULL;
|
static ImageLoaderWEBP *image_loader_webp=NULL;
|
||||||
//static ResourceSaverPNG *resource_saver_png=NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JPG_ENABLED
|
#ifdef JPG_ENABLED
|
||||||
@@ -132,22 +129,15 @@ static ResourceFormatPBM * pbm_loader=NULL;
|
|||||||
|
|
||||||
void register_core_driver_types() {
|
void register_core_driver_types() {
|
||||||
|
|
||||||
#ifdef PNG_ENABLED
|
|
||||||
image_loader_png = memnew( ImageLoaderPNG );
|
image_loader_png = memnew( ImageLoaderPNG );
|
||||||
ImageLoader::add_image_format_loader( image_loader_png );
|
ImageLoader::add_image_format_loader( image_loader_png );
|
||||||
|
|
||||||
resource_saver_png = memnew( ResourceSaverPNG );
|
resource_saver_png = memnew( ResourceSaverPNG );
|
||||||
ResourceSaver::add_resource_format_saver(resource_saver_png);
|
ResourceSaver::add_resource_format_saver(resource_saver_png);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBP_ENABLED
|
#ifdef WEBP_ENABLED
|
||||||
image_loader_webp = memnew( ImageLoaderWEBP );
|
image_loader_webp = memnew( ImageLoaderWEBP );
|
||||||
ImageLoader::add_image_format_loader( image_loader_webp );
|
ImageLoader::add_image_format_loader( image_loader_webp );
|
||||||
|
|
||||||
// resource_saver_png = memnew( ResourceSaverPNG );
|
|
||||||
// ResourceSaver::add_resource_format_saver(resource_saver_png);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JPG_ENABLED
|
#ifdef JPG_ENABLED
|
||||||
@@ -165,18 +155,14 @@ void register_core_driver_types() {
|
|||||||
|
|
||||||
void unregister_core_driver_types() {
|
void unregister_core_driver_types() {
|
||||||
|
|
||||||
#ifdef PNG_ENABLED
|
|
||||||
if (image_loader_png)
|
if (image_loader_png)
|
||||||
memdelete( image_loader_png );
|
memdelete( image_loader_png );
|
||||||
if (resource_saver_png)
|
if (resource_saver_png)
|
||||||
memdelete( resource_saver_png );
|
memdelete( resource_saver_png );
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WEBP_ENABLED
|
#ifdef WEBP_ENABLED
|
||||||
if (image_loader_webp)
|
if (image_loader_webp)
|
||||||
memdelete( image_loader_webp );
|
memdelete( image_loader_webp );
|
||||||
// if (resource_saver_png)
|
|
||||||
// memdelete( resource_saver_png );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JPG_ENABLED
|
#ifdef JPG_ENABLED
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ def get_flags():
|
|||||||
('builtin_zlib', 'no'),
|
('builtin_zlib', 'no'),
|
||||||
('glew', 'yes'),
|
('glew', 'yes'),
|
||||||
("openssl", "yes"),
|
("openssl", "yes"),
|
||||||
('freetype','yes'), #use system freetype
|
('freetype','yes'), # use system freetype
|
||||||
|
('libpng', 'system'),
|
||||||
#("theora","no"),
|
#("theora","no"),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -143,6 +143,8 @@ def configure(env):
|
|||||||
if (env["openssl"]=="yes"):
|
if (env["openssl"]=="yes"):
|
||||||
env.ParseConfig('pkg-config openssl --cflags --libs')
|
env.ParseConfig('pkg-config openssl --cflags --libs')
|
||||||
|
|
||||||
|
if (env["libpng"] == "system"):
|
||||||
|
env.ParseConfig('pkg-config libpng --cflags --libs')
|
||||||
|
|
||||||
if (env["freetype"]=="yes"):
|
if (env["freetype"]=="yes"):
|
||||||
env.ParseConfig('pkg-config freetype2 --cflags --libs')
|
env.ParseConfig('pkg-config freetype2 --cflags --libs')
|
||||||
|
|||||||
16
thirdparty/README.md
vendored
Normal file
16
thirdparty/README.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Third party libraries
|
||||||
|
|
||||||
|
|
||||||
|
## libpng
|
||||||
|
|
||||||
|
- Upstream: http://libpng.org/pub/png/libpng.html
|
||||||
|
- Version: 1.6.23
|
||||||
|
- License: libpng/zlib
|
||||||
|
|
||||||
|
Files extracted from upstream source:
|
||||||
|
|
||||||
|
- all .c and .h files of the main directory, except from:
|
||||||
|
* example.c
|
||||||
|
* pngtest.c
|
||||||
|
- the arm/ folder
|
||||||
|
- scripts/pnglibconf.h.prebuilt as pnglibconf.h
|
||||||
130
thirdparty/libpng/LICENSE
vendored
Normal file
130
thirdparty/libpng/LICENSE
vendored
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
|
||||||
|
This copy of the libpng notices is provided for your convenience. In case of
|
||||||
|
any discrepancy between this copy and the notices in the file png.h that is
|
||||||
|
included in the libpng distribution, the latter shall prevail.
|
||||||
|
|
||||||
|
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||||
|
|
||||||
|
If you modify libpng you may insert additional notices immediately following
|
||||||
|
this sentence.
|
||||||
|
|
||||||
|
This code is released under the libpng license.
|
||||||
|
|
||||||
|
libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are
|
||||||
|
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
|
||||||
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
|
added to the list of Contributing Authors:
|
||||||
|
|
||||||
|
Simon-Pierre Cadieux
|
||||||
|
Eric S. Raymond
|
||||||
|
Mans Rullgard
|
||||||
|
Cosmin Truta
|
||||||
|
Gilles Vollant
|
||||||
|
James Yu
|
||||||
|
|
||||||
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
|
There is no warranty against interference with your enjoyment of the
|
||||||
|
library or against infringement. There is no warranty that our
|
||||||
|
efforts or the library will fulfill any of your particular purposes
|
||||||
|
or needs. This library is provided with all faults, and the entire
|
||||||
|
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
|
the user.
|
||||||
|
|
||||||
|
Some files in the "contrib" directory and some configure-generated
|
||||||
|
files that are distributed with libpng have other copyright owners and
|
||||||
|
are released under other open source licenses.
|
||||||
|
|
||||||
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
|
libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
|
license as libpng-0.96, with the following individuals added to the list
|
||||||
|
of Contributing Authors:
|
||||||
|
|
||||||
|
Tom Lane
|
||||||
|
Glenn Randers-Pehrson
|
||||||
|
Willem van Schaik
|
||||||
|
|
||||||
|
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||||
|
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||||
|
and are distributed according to the same disclaimer and license as
|
||||||
|
libpng-0.88, with the following individuals added to the list of
|
||||||
|
Contributing Authors:
|
||||||
|
|
||||||
|
John Bowler
|
||||||
|
Kevin Bracey
|
||||||
|
Sam Bushell
|
||||||
|
Magnus Holmgren
|
||||||
|
Greg Roelofs
|
||||||
|
Tom Tanner
|
||||||
|
|
||||||
|
Some files in the "scripts" directory have other copyright owners
|
||||||
|
but are released under this license.
|
||||||
|
|
||||||
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
|
For the purposes of this copyright and license, "Contributing Authors"
|
||||||
|
is defined as the following set of individuals:
|
||||||
|
|
||||||
|
Andreas Dilger
|
||||||
|
Dave Martindale
|
||||||
|
Guy Eric Schalnat
|
||||||
|
Paul Schmidt
|
||||||
|
Tim Wegner
|
||||||
|
|
||||||
|
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||||
|
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||||
|
including, without limitation, the warranties of merchantability and of
|
||||||
|
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||||
|
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||||
|
or consequential damages, which may result from the use of the PNG
|
||||||
|
Reference Library, even if advised of the possibility of such damage.
|
||||||
|
|
||||||
|
Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
|
to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this source code must not be misrepresented.
|
||||||
|
|
||||||
|
2. Altered versions must be plainly marked as such and must not
|
||||||
|
be misrepresented as being the original source.
|
||||||
|
|
||||||
|
3. This Copyright notice may not be removed or altered from any
|
||||||
|
source or altered source distribution.
|
||||||
|
|
||||||
|
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
|
fee, and encourage the use of this source code as a component to
|
||||||
|
supporting the PNG file format in commercial products. If you use this
|
||||||
|
source code in a product, acknowledgment is not required but would be
|
||||||
|
appreciated.
|
||||||
|
|
||||||
|
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
|
||||||
|
TRADEMARK:
|
||||||
|
|
||||||
|
The name "libpng" has not been registered by the Copyright owner
|
||||||
|
as a trademark in any jurisdiction. However, because libpng has
|
||||||
|
been distributed and maintained world-wide, continually since 1995,
|
||||||
|
the Copyright owner claims "common-law trademark protection" in any
|
||||||
|
jurisdiction where common-law trademark is recognized.
|
||||||
|
|
||||||
|
OSI CERTIFICATION:
|
||||||
|
|
||||||
|
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||||
|
a certification mark of the Open Source Initiative. OSI has not addressed
|
||||||
|
the additional disclaimers inserted at version 1.0.7.
|
||||||
|
|
||||||
|
EXPORT CONTROL:
|
||||||
|
|
||||||
|
The Copyright owner believes that the Export Control Classification
|
||||||
|
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
controls or International Traffic in Arms Regulations (ITAR) because
|
||||||
|
it is open source, publicly available software, that does not contain
|
||||||
|
any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||||
|
734.7(b).
|
||||||
|
|
||||||
|
Glenn Randers-Pehrson
|
||||||
|
glennrp at users.sourceforge.net
|
||||||
|
June 9, 2016
|
||||||
Reference in New Issue
Block a user