summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2019-07-24 16:27:29 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2019-11-19 05:49:35 +0800
commit06a3f6e60b7cc0c2c76053b95b98abe3189573c2 (patch)
tree755677e53efaa6bdf1f784515db8a4cefc121ac7
parent7661b1fae982da029ef56e58a1df2a4d6fd48444 (diff)
downloadpixman-06a3f6e60b7cc0c2c76053b95b98abe3189573c2.tar.gz
meson.build: Improve libpng search on MSVC
The build system for libpng for MSVC does not generate a pkg-config file for us, and CMake support in Meson does not work very well. So, look for libpng manually on MSVC builds if depedency discovery did not work out via pkg-config or the CMake config files.
-rw-r--r--meson.build19
1 files changed, 18 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 5e9f221..72d7e3d 100644
--- a/meson.build
+++ b/meson.build
@@ -387,7 +387,24 @@ dep_gtk = dependency('gtk+-2.0', version : '>= 2.16', required : get_option('gtk
dep_glib = dependency('glib-2.0', required : get_option('gtk'))
dep_pixman = dependency('pixman-1', required : get_option('gtk'),
version : '>= ' + meson.project_version())
-dep_png = dependency('libpng', required : get_option('libpng'))
+
+dep_png = null_dep
+if not get_option('libpng').disabled()
+ dep_png = dependency('libpng', required : false)
+
+ # We need to look for the right library to link to for libpng,
+ # when looking for libpng manually
+ foreach png_ver : [ '16', '15', '14', '13', '12', '10' ]
+ if not dep_png.found()
+ dep_png = cc.find_library('libpng@0@'.format(png_ver), has_headers : ['png.h'], required : false)
+ endif
+ endforeach
+
+ if get_option('libpng').enabled() and not dep_png.found()
+ error('libpng support requested but libpng library not found')
+ endif
+endif
+
if dep_png.found()
config.set('HAVE_LIBPNG', 1)
endif