Meson: simplify dynamic module handling (#2956)

This commit is contained in:
Kleis Auke Wolthuizen 2022-07-28 16:10:13 +02:00 committed by GitHub
parent 45bcd74a7a
commit a24b556b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 31 deletions

View File

@ -82,7 +82,7 @@ magick_module_headers = files(
'magick.h',
)
if not modules_enabled or get_option('magick-module').disabled()
if not magick_module
foreign_sources += magick_module_sources
foreign_headers += magick_module_headers
endif
@ -92,7 +92,7 @@ jpeg_xl_module_sources = files(
'jxlsave.c',
)
if not modules_enabled or get_option('jpeg-xl-module').disabled()
if not libjxl_module
foreign_sources += jpeg_xl_module_sources
endif
@ -101,7 +101,7 @@ heif_module_sources = files(
'heifsave.c',
)
if not modules_enabled or get_option('heif-module').disabled()
if not libheif_module
foreign_sources += heif_module_sources
endif
@ -109,7 +109,7 @@ poppler_module_sources = files(
'popplerload.c',
)
if not modules_enabled or get_option('poppler-module').disabled()
if not libpoppler_module
foreign_sources += poppler_module_sources
endif
@ -117,7 +117,7 @@ openslide_module_sources = files(
'openslideload.c',
)
if not modules_enabled or get_option('openslide-module').disabled()
if not openslide_module
foreign_sources += openslide_module_sources
endif

View File

@ -99,33 +99,33 @@ vips_verbose_config += 'text rendering with pangocairo: @0@'.format(pangocairo_d
vips_verbose_config += 'font file support with fontconfig: @0@'.format(fontconfig_found)
vips_verbose_config += 'EXIF metadata support with libexif: @0@'.format(libexif_dep.found())
vips_verbose_config += 'JPEG load/save with libjpeg: @0@'.format(libjpeg_dep.found())
vips_verbose_config += 'JXL load/save with libjxl: @0@ (dynamic module: @1@)'.format(libjxl_dep.found(), modules_enabled and not get_option('jpeg-xl-module').disabled())
vips_verbose_config += 'JXL load/save with libjxl: @0@ (dynamic module: @1@)'.format(libjxl_found, libjxl_module)
vips_verbose_config += 'JPEG2000 load/save with OpenJPEG: @0@'.format(libopenjp2_dep.found())
vips_verbose_config += 'PNG load/save with libspng: @0@'.format(spng_found)
vips_verbose_config += 'PNG load/save with libpng: @0@'.format(png_dep.found())
vips_verbose_config += 'selected quantisation package: @0@'.format(quantisation_package.found() ? quantisation_package.name() : 'none')
vips_verbose_config += 'TIFF load/save with libtiff: @0@'.format(libtiff_dep.found())
vips_verbose_config += 'image pyramid save with libgsf: @0@'.format(gsf_dep.found())
vips_verbose_config += 'HEIC/AVIF load/save with libheif: @0@ (dynamic module: @1@)'.format(libheif_dep.found(), modules_enabled and not get_option('heif-module').disabled())
vips_verbose_config += 'HEIC/AVIF load/save with libheif: @0@ (dynamic module: @1@)'.format(libheif_dep.found(), libheif_module)
vips_verbose_config += 'WebP load/save with libwebp: @0@'.format(libwebp_dep.found())
vips_verbose_config += 'PDF load with PDFium: @0@'.format(pdfium_dep.found())
vips_verbose_config += 'PDF load with poppler-glib: @0@ (dynamic module: @1@)'.format(libpoppler_dep.found(), modules_enabled and not get_option('poppler-module').disabled())
vips_verbose_config += 'PDF load with poppler-glib: @0@ (dynamic module: @1@)'.format(libpoppler_found, libpoppler_module)
vips_verbose_config += 'SVG load with librsvg: @0@'.format(librsvg_found)
vips_verbose_config += 'EXR load with OpenEXR: @0@'.format(openexr_dep.found())
vips_verbose_config += 'OpenSlide load: @0@ (dynamic module: @1@)'.format(openslide_dep.found(), modules_enabled and not get_option('openslide-module').disabled())
vips_verbose_config += 'OpenSlide load: @0@ (dynamic module: @1@)'.format(openslide_dep.found(), openslide_module)
vips_verbose_config += 'Matlab load with libmatio: @0@'.format(matio_dep.found())
vips_verbose_config += 'NIfTI load/save with niftiio: @0@'.format(libnifti_dep.found())
vips_verbose_config += 'FITS load/save with cfitsio: @0@'.format(cfitsio_dep.found())
vips_verbose_config += 'GIF save with cgif: @0@'.format(cgif_dep.found())
vips_verbose_config += 'selected Magick package: @0@ (dynamic module: @1@)'.format(magick_dep.found(), modules_enabled and not get_option('magick-module').disabled())
vips_verbose_config += 'selected Magick package: @0@ (dynamic module: @1@)'.format(magick_found ? magick_dep.name() : 'none', magick_module)
if magick_dep.found()
magick_version_str = 'magick' + magick_dep.version().split('.')[0]
else
magick_version_str = 'none'
endif
vips_verbose_config += 'Magick API version: @0@'.format(magick_version_str)
vips_verbose_config += 'Magick load: @0@'.format(magick_dep.found() and 'load' in get_option('magick-features'))
vips_verbose_config += 'Magick save: @0@'.format(magick_dep.found() and 'save' in get_option('magick-features'))
vips_verbose_config += 'Magick load: @0@'.format(magick_found and 'load' in get_option('magick-features'))
vips_verbose_config += 'Magick save: @0@'.format(magick_found and 'save' in get_option('magick-features'))
version_data = configuration_data()
version_data.set('VIPS_VERSION', meson.project_version())

View File

@ -79,7 +79,7 @@ if ['darwin', 'ios'].contains(host_os)
module_suffix = 'so'
endif
if magick_dep.found() and not get_option('magick-module').disabled()
if magick_module
shared_module('vips-magick',
'module/magick.c',
magick_module_sources,
@ -92,7 +92,7 @@ if magick_dep.found() and not get_option('magick-module').disabled()
)
endif
if libjxl_dep.found() and not get_option('jpeg-xl-module').disabled()
if libjxl_module
shared_module('vips-jxl',
'module/jxl.c',
jpeg_xl_module_sources,
@ -104,7 +104,7 @@ if libjxl_dep.found() and not get_option('jpeg-xl-module').disabled()
)
endif
if libheif_dep.found() and not get_option('heif-module').disabled()
if libheif_module
shared_module('vips-heif',
'module/heif.c',
heif_module_sources,
@ -116,7 +116,7 @@ if libheif_dep.found() and not get_option('heif-module').disabled()
)
endif
if libpoppler_dep.found() and not get_option('poppler-module').disabled()
if libpoppler_module
shared_module('vips-poppler',
'module/poppler.c',
poppler_module_sources,
@ -128,7 +128,7 @@ if libpoppler_dep.found() and not get_option('poppler-module').disabled()
)
endif
if openslide_dep.found() and not get_option('openslide-module').disabled()
if openslide_module
shared_module('vips-openslide',
'module/openslide.c',
openslide_module_sources,

View File

@ -168,8 +168,11 @@ if not magick_dep.found()
# very old versions called it "ImageMagick"
magick_dep = dependency('ImageMagick', required: get_option('magick'))
endif
if not get_option('magick').disabled() and magick_dep.found()
if modules_enabled and not get_option('magick-module').disabled()
magick_found = not get_option('magick').disabled() and magick_dep.found()
magick_module = false
if magick_found
magick_module = magick_found and modules_enabled and not get_option('magick-module').disabled()
if magick_module
cfg_var.set('MAGICK_MODULE', '1')
else
libvips_deps += magick_dep
@ -369,8 +372,10 @@ if librsvg_found
endif
openslide_dep = dependency('openslide', version: '>=3.3.0', required: get_option('openslide'))
openslide_module = false
if openslide_dep.found()
if modules_enabled and not get_option('openslide-module').disabled()
openslide_module = modules_enabled and not get_option('openslide-module').disabled()
if openslide_module
cfg_var.set('OPENSLIDE_MODULE', '1')
else
libvips_deps += openslide_dep
@ -433,8 +438,10 @@ endif
libheif_dep = dependency('libheif', version: '>=0.4.11', required: get_option('heif'))
libheif_module = false
if libheif_dep.found()
if modules_enabled and not get_option('heif-module').disabled()
libheif_module = modules_enabled and not get_option('heif-module').disabled()
if libheif_module
cfg_var.set('HEIF_MODULE', '1')
else
libvips_deps += libheif_dep
@ -463,8 +470,11 @@ endif
libjxl_dep = dependency('libjxl', version: '>=0.5', required: get_option('jpeg-xl'))
libjxl_threads_dep = dependency('libjxl_threads', version: '>=0.5', required: get_option('jpeg-xl'))
if libjxl_dep.found() and libjxl_threads_dep.found()
if modules_enabled and not get_option('jpeg-xl-module').disabled()
libjxl_found = libjxl_dep.found() and libjxl_threads_dep.found()
libjxl_module = false
if libjxl_found
libjxl_module = modules_enabled and not get_option('jpeg-xl-module').disabled()
if libjxl_module
cfg_var.set('LIBJXL_MODULE', '1')
else
libvips_deps += libjxl_dep
@ -477,13 +487,17 @@ if libjxl_dep.found() and libjxl_threads_dep.found()
endif
libpoppler_dep = dependency('poppler-glib', version: '>=0.16.0', required: get_option('poppler'))
libpoppler_found = false
libpoppler_module = false
if not cairo_dep.found()
cairo_dep = dependency('cairo', version: '>=1.2', required: get_option('poppler'))
endif
if libpoppler_dep.found() and cairo_dep.found() and pdfium_dep.found()
message('PDFium has been found, ignoring Poppler support')
elif libpoppler_dep.found() and cairo_dep.found()
if modules_enabled and not get_option('poppler-module').disabled()
libpoppler_found = true
libpoppler_module = modules_enabled and not get_option('poppler-module').disabled()
if libpoppler_module
cfg_var.set('POPPLER_MODULE', '1')
else
libvips_deps += libpoppler_dep
@ -645,27 +659,27 @@ build_summary = {
},
'External image format libraries':
{'JPEG load/save with libjpeg': libjpeg_dep.found(),
'JXL load/save with libjxl': [libjxl_dep.found(), (modules_enabled and not get_option('jpeg-xl-module').disabled()) ? ' (dynamic module)' : ''],
'JXL load/save with libjxl': [libjxl_found, libjxl_module ? ' (dynamic module)' : ''],
'JPEG2000 load/save with OpenJPEG': libopenjp2_dep.found(),
'PNG load/save with libspng': spng_found,
'PNG load/save with libpng': png_dep.found(),
'selected quantisation package': quantisation_package.found() ? quantisation_package.name() : 'none',
'TIFF load/save with libtiff': libtiff_dep.found(),
'image pyramid save with libgsf': gsf_dep.found(),
'HEIC/AVIF load/save with libheif': [libheif_dep.found(), (modules_enabled and not get_option('heif-module').disabled()) ? ' (dynamic module)' : ''],
'HEIC/AVIF load/save with libheif': [libheif_dep.found(), libheif_module ? ' (dynamic module)' : ''],
'WebP load/save with libwebp': libwebp_dep.found(),
'PDF load with PDFium': pdfium_dep.found(),
'PDF load with poppler-glib': [libpoppler_dep.found(), (modules_enabled and not get_option('poppler-module').disabled()) ? ' (dynamic module)' : ''],
'PDF load with poppler-glib': [libpoppler_found, libpoppler_module ? ' (dynamic module)' : ''],
'SVG load with librsvg': librsvg_found,
'EXR load with OpenEXR': openexr_dep.found(),
'OpenSlide load': [openslide_dep.found(), (modules_enabled and not get_option('openslide-module').disabled()) ? ' (dynamic module)' : ''],
'OpenSlide load': [openslide_dep.found(), openslide_module ? ' (dynamic module)' : ''],
'Matlab load with libmatio': matio_dep.found(),
'NIfTI load/save with niftiio': libnifti_dep.found(),
'FITS load/save with cfitsio': cfitsio_dep.found(),
'GIF save with cgif': cgif_dep.found(),
'selected Magick package': [get_option('magick-package'), (modules_enabled and not get_option('magick-module').disabled()) ? ' (dynamic module)' : ''],
'Magick load': magick_dep.found() and 'load' in get_option('magick-features'),
'Magick save': magick_dep.found() and 'save' in get_option('magick-features'),
'selected Magick package': [magick_found ? magick_dep.name() : 'none', magick_module ? ' (dynamic module)' : ''],
'Magick load': magick_found and 'load' in get_option('magick-features'),
'Magick save': magick_found and 'save' in get_option('magick-features'),
},
}