diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-04-16 23:37:48 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2021-04-16 23:37:48 +0100 |
commit | 993e75a9d3165512a3f472c3a154f975d7193f18 (patch) | |
tree | 5d24b31456c69a1728146c8ba34784023e2f5f15 /meson.build | |
parent | e7b6681e3f419d9cb3d2287f10a6c405fe4850aa (diff) | |
download | gdk-pixbuf-993e75a9d3165512a3f472c3a154f975d7193f18.tar.gz |
build: Reorganise the libjpeg checks
Follow the same pattern as the libpng checks:
1. look for libjpeg via pkg-config
2. if pkg-config fails, and we're using the MSVC toolchain, look
for header and library
3. if that fails, fall back to the libjpeg subproject
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/meson.build b/meson.build index 06c0d27dc..8328fcbc3 100644 --- a/meson.build +++ b/meson.build @@ -324,33 +324,28 @@ endif # Don't check and build the jpeg loader if native_windows_loaders is true if get_option('jpeg') and not native_windows_loaders - if cc.has_header('jpeglib.h') + jpeg_dep = dependency('libjpeg', required: false) + + if not jpeg_dep.found() and cc.has_header('jpeglib.h') jpeg_dep = cc.find_library('jpeg', required: false) if cc.get_id() == 'msvc' and not jpeg_dep.found() # The IJG JPEG library builds the .lib file as libjpeg.lib in its MSVC build system, # so look for it as well when jpeg.lib cannot be found jpeg_dep = cc.find_library('libjpeg', required: false) endif - - if jpeg_dep.found() - enabled_loaders += 'jpeg' - loaders_deps += jpeg_dep - endif endif # If we couldn't find libjpeg in our include/linker paths, # then use pkg-config, and if that fails, fall back to the # wrap - if not enabled_loaders.contains('jpeg') + if not jpeg_dep.found() jpeg_dep = dependency('libjpeg', required: false, fallback: ['libjpeg', 'jpeg_dep']) - - if jpeg_dep.found() - enabled_loaders += 'jpeg' - loaders_deps += jpeg_dep - endif endif if jpeg_dep.found() + enabled_loaders += 'jpeg' + loaders_deps += jpeg_dep + if jpeg_dep.type_name() == 'internal' has_destroy_decompress = true has_simple_progression = true |