summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk-pixbuf/meson.build51
-rw-r--r--meson.build32
-rw-r--r--meson_options.txt8
3 files changed, 79 insertions, 12 deletions
diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
index 866365c3c..b8889c094 100644
--- a/gdk-pixbuf/meson.build
+++ b/gdk-pixbuf/meson.build
@@ -4,11 +4,14 @@ subdir('pixops')
# - name
# - sources
# - conditional, otherwise always built
+
+# We need to disable the in-house loaders for BMP, GIF and ICO
+# when enable_native_windows_loaders is true
loaders = [
[ 'png', [ 'io-png.c' ], enabled_loaders.contains('png') ],
- [ 'bmp', [ 'io-bmp.c' ] ],
- [ 'gif', [ 'io-gif.c', 'io-gif-animation.c' ] ],
- [ 'ico', [ 'io-ico.c' ] ],
+ [ 'bmp', [ 'io-bmp.c' ], not enable_native_windows_loaders ],
+ [ 'gif', [ 'io-gif.c', 'io-gif-animation.c' ], not enable_native_windows_loaders ],
+ [ 'ico', [ 'io-ico.c' ], not enable_native_windows_loaders ],
[ 'ani', [ 'io-ani.c', 'io-ani-animation.c' ] ],
[ 'jpeg', [ 'io-jpeg.c' ], enabled_loaders.contains('jpeg') ],
[ 'pnm', [ 'io-pnm.c' ] ],
@@ -125,6 +128,30 @@ foreach l: loaders
endif
endforeach
+# List of formats supported by the native Windows components-based loader(s)
+windows_native_loader_formats = [ 'bmp', 'emf', 'gif', 'ico', 'jpeg', 'tiff', 'wmf' ]
+windows_base_loader_sources = [ 'io-gdip-utils.c', 'io-gdip-animation.c' ]
+
+# Build the loaders using native Windows components as static modules, if requested
+if enable_native_windows_loaders
+ if builtin_loaders.contains('windows') or builtin_all_loaders
+ cflag_for_included_loader = ['-DINCLUDE_gdiplus']
+ included_loaders_cflags += cflag_for_included_loader
+ win_loader_sources = windows_base_loader_sources
+ foreach loader: windows_native_loader_formats
+ win_loader_sources += 'io-gdip-@0@.c'.format(loader)
+ endforeach
+
+ mod = static_library('staticpixbufloader-gdiplus',
+ win_loader_sources,
+ dependencies: loaders_deps + gdk_pixbuf_deps,
+ include_directories: [ root_inc, gdk_pixbuf_inc ],
+ c_args: common_cflags + gdk_pixbuf_cflags + cflag_for_included_loader)
+
+ included_loaders_deps += declare_dependency(link_with: mod)
+ endif
+endif
+
# The main gdk-pixbuf shared library
gdkpixbuf = library('gdk_pixbuf-2.0',
gdkpixbuf_sources + gdkpixbuf_enums + gdkpixbuf_marshals,
@@ -165,6 +192,24 @@ foreach l: loaders
endif
endforeach
+# Build the loaders using native Windows components as dynamic modules, if requested
+if enable_native_windows_loaders
+ if not (builtin_loaders.contains('windows') or builtin_all_loaders)
+ foreach loader: windows_native_loader_formats
+ loader_sources = windows_base_loader_sources + [ 'io-gdip-@0@.c'.format(loader) ]
+
+ mod = shared_module('pixbufloader-gdip-@0@'.format(loader),
+ loader_sources,
+ dependencies: loaders_deps + gdk_pixbuf_deps + [ gdkpixbuf_dep ],
+ include_directories: [ root_inc, gdk_pixbuf_inc ],
+ c_args: common_cflags + gdk_pixbuf_cflags + cflags,
+ install: true,
+ install_dir: gdk_pixbuf_loaderdir)
+ dynamic_loaders += mod.full_path()
+ endforeach
+ endif
+endif
+
gdkpixbuf_bin = [
[ 'gdk-pixbuf-csource' ],
[ 'gdk-pixbuf-pixdata' ],
diff --git a/meson.build b/meson.build
index c8f1638b2..4d5cf4aaf 100644
--- a/meson.build
+++ b/meson.build
@@ -227,15 +227,24 @@ if get_option('enable_png')
endforeach
endif
-if get_option('enable_tiff')
- tiff_dep = dependency('libtiff-4', required: false)
- if tiff_dep.found()
- enabled_loaders += 'tiff'
- loaders_deps += tiff_dep
- endif
+# On Windows, check whether we are building the native Windows loaders
+# (it is an "all-or-nothing" option for BMP, EMF, GIF, ICO, JPEG, TIFF and WMF)
+# Note that we currently do not use the native Windows loaders to handle PNG and
+# JPEG2000 images
+if host_system == 'windows'
+ enable_native_windows_loaders = get_option('enable_native_windows_loaders')
+else
+ enable_native_windows_loaders = false
+endif
+
+if enable_native_windows_loaders
+ loaders_deps += cc.find_library('gdiplus')
+ loaders_deps += cc.find_library('ole32')
+ enabled_loaders += 'gdiplus'
endif
-if get_option('enable_jpeg')
+# Don't check and build the jpeg loader if enable_native_windows_loaders is true
+if get_option('enable_jpeg') and not enable_native_windows_loaders
if cc.has_header('jpeglib.h')
jpeg_dep = cc.find_library('jpeg', required: false)
if cc.get_id() == 'msvc' and not jpeg_dep.found()
@@ -253,6 +262,15 @@ if get_option('enable_jpeg')
endif
endif
+# Don't check and build the tiff loader if enable_native_windows_loaders is true
+if get_option('enable_tiff') and not enable_native_windows_loaders
+ tiff_dep = dependency('libtiff-4', required: false)
+ if tiff_dep.found()
+ enabled_loaders += 'tiff'
+ loaders_deps += tiff_dep
+ endif
+endif
+
jasper_extra_cflags = []
if get_option('enable_jasper')
diff --git a/meson_options.txt b/meson_options.txt
index ba6524698..8faab661f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,11 +3,11 @@ option('enable_png',
type: 'boolean',
value: true)
option('enable_tiff',
- description: 'Enable TIFF loader (requires libtiff)',
+ description: 'Enable TIFF loader (requires libtiff), disabled on Windows if "enable_native_windows_loaders" is used',
type: 'boolean',
value: true)
option('enable_jpeg',
- description: 'Enable JPEG loader (requires libjpeg)',
+ description: 'Enable JPEG loader (requires libjpeg), disabled on Windows if "enable_native_windows_loaders" is used',
type: 'boolean',
value: true)
option('enable_jasper',
@@ -34,3 +34,7 @@ option('enable_relocatable',
description: 'Whether to enable application bundle relocation support',
type: 'boolean',
value: false)
+option('enable_native_windows_loaders',
+ description: 'Use Windows system components to handle BMP, EMF, GIF, ICO, JPEG, TIFF and WMF images, overriding enable_jpeg and enable_tiff. To build this into gdk-pixbuf, pass in windows" with the other loaders to build in or use "all" with the builtin_loaders option',
+ type: 'boolean',
+ value: false)