[gdk-pixbuf] build: Fix libjasper detection and usage on Meson/MSVC
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] build: Fix libjasper detection and usage on Meson/MSVC
- Date: Thu, 7 Sep 2017 10:11:01 +0000 (UTC)
commit 859581953212b1b6950418f26e200a4bfa316432
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Aug 23 14:40:24 2017 +0800
build: Fix libjasper detection and usage on Meson/MSVC
In order for MSVC builds that utilize libjasper to work, we need to
ensure that JAS_WIN_MSVC_BUILD is defined when we check for
jasper/jasper.h, and that same macro is defined when we compile
io-jasper.c on MSVC.
We also need to look for libjasper.lib on MSVC in case that jasper.lib
cannot be found, as the Visual Studio projects for libjasper produces
libjasper.lib upon build.
https://bugzilla.gnome.org/show_bug?id=785767
gdk-pixbuf/meson.build | 8 +++++---
meson.build | 22 +++++++++++++++++++++-
2 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
index 0e8c8b4..866365c 100644
--- a/gdk-pixbuf/meson.build
+++ b/gdk-pixbuf/meson.build
@@ -17,7 +17,7 @@ loaders = [
[ 'xbm', [ 'io-xbm.c' ] ],
[ 'tga', [ 'io-tga.c', 'gdk-pixbuf-buffer-queue.c' ] ],
[ 'icns', [ 'io-icns.c' ] ],
- [ 'jasper', [ 'io-jasper.c' ], enabled_loaders.contains('jasper') ],
+ [ 'jasper', [ 'io-jasper.c' ], enabled_loaders.contains('jasper'), jasper_extra_cflags ],
[ 'qtif', [ 'io-qtif.c' ] ]
]
@@ -109,6 +109,7 @@ foreach l: loaders
name = l[0]
sources = l[1]
cond = l.get(2, true)
+ cflags = l.get(3, [])
if cond and (builtin_loaders.contains(name) or builtin_all_loaders)
cflag_for_included_loader = ['-DINCLUDE_@0@'.format(name)]
@@ -118,7 +119,7 @@ foreach l: loaders
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)
+ c_args: common_cflags + gdk_pixbuf_cflags + cflags + cflag_for_included_loader)
included_loaders_deps += declare_dependency(link_with: mod)
endif
@@ -148,13 +149,14 @@ foreach l: loaders
name = l[0]
sources = l[1]
cond = l.get(2, true)
+ cflags = l.get(3, [])
if cond and not (builtin_loaders.contains(name) or builtin_all_loaders)
mod = shared_module('pixbufloader-@0@'.format(name),
sources,
dependencies: loaders_deps + gdk_pixbuf_deps + [ gdkpixbuf_dep ],
include_directories: [ root_inc, gdk_pixbuf_inc ],
- c_args: common_cflags + gdk_pixbuf_cflags,
+ c_args: common_cflags + gdk_pixbuf_cflags + cflags,
install: true,
install_dir: gdk_pixbuf_loaderdir)
diff --git a/meson.build b/meson.build
index dd42b76..c8f1638 100644
--- a/meson.build
+++ b/meson.build
@@ -253,9 +253,29 @@ if get_option('enable_jpeg')
endif
endif
+jasper_extra_cflags = []
+
if get_option('enable_jasper')
- if cc.has_header('jasper/jasper.h')
+ has_jasper_header = false
+
+ if cc.get_id() == 'msvc'
+ # We must define JAS_WIN_MSVC_BUILD before including jasper/jasper.h on MSVC
+ jasper_msvc_macro = 'JAS_WIN_MSVC_BUILD'
+ has_jasper_header = cc.has_header('jasper/jasper.h', prefix: '#define @0@'.format(jasper_msvc_macro))
+ jasper_extra_cflags = [ '-D@0@'.format(jasper_msvc_macro) ]
+ else
+ has_jasper_header = cc.has_header('jasper/jasper.h')
+ endif
+
+ if has_jasper_header
jasper_dep = cc.find_library('jasper', required: false)
+ if not jasper_dep.found()
+ if cc.get_id() == 'msvc'
+ # on MSVC, we need to look for libjasper.lib if jasper.lib is not found,
+ # which corresponds to what libjasper's MSVC projects produce
+ jasper_dep = cc.find_library('libjasper', required: false)
+ endif
+ endif
if jasper_dep.found() and cc.has_function('jas_init', dependencies: jasper_dep)
enabled_loaders += 'jasper'
loaders_deps += jasper_dep
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]