Add meson build system (#2637)

Allows to use the Meson build system to build the project.
This commit is contained in:
Corentin Noël 2022-02-08 16:19:36 +01:00 committed by GitHub
parent 0d8056b8c5
commit 02901436d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 2060 additions and 2 deletions

View File

@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If # entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used. # left blank the current directory will be used.
OUTPUT_DIRECTORY = OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and # directories (in 2 levels) under the output directory of each output format and

View File

@ -0,0 +1,14 @@
public_cpp_headers = files(
'VError8.h',
'VImage8.h',
'VInterpolate8.h',
'VConnection8.h',
'vips8',
)
install_headers(
public_cpp_headers,
subdir: 'vips'
)
libvips_cpp_includedir = include_directories('..')

60
cplusplus/meson.build Normal file
View File

@ -0,0 +1,60 @@
subdir('include/vips')
libvips_cpp_lib = library('vips-cpp',
'VImage.cpp',
'VInterpolate.cpp',
'VConnection.cpp',
'VError.cpp',
dependencies: libvips_dep,
include_directories: libvips_cpp_includedir,
version: library_version,
install: true,
)
libvips_cpp_dep = declare_dependency(
link_with: libvips_cpp_lib,
dependencies: libvips_dep,
include_directories: libvips_cpp_includedir,
)
pkg.generate(
libvips_cpp_lib,
requires: [ libvips_lib, glib_dep, gobject_dep ],
name: 'vips-cpp',
description: 'C++ API for vips8 image processing library',
)
custom_target('vips-operators-header',
command: [ 'gen-operators.py', '-g', 'h'],
capture: true,
output: 'vips-operators.h'
)
custom_target('vips-operators-source',
command: [ 'gen-operators.py', '-g', 'cpp'],
capture: true,
output: 'vips-operators.cc'
)
if get_option('doxygen')
doxygen = find_program('doxygen')
doxygen_data = configuration_data()
doxygen_data.set('VIPS_MAJOR_VERSION', version_major)
doxygen_data.set('VIPS_MINOR_VERSION', version_minor)
doxygen_data.set('OUTPUT_DIRECTORY', 'cplusplus')
doxyfile = configure_file(
input: 'Doxyfile.in',
output: 'Doxyfile',
configuration: doxygen_data,
install: false
)
html_target = custom_target('vips-cpp-docs',
input: doxyfile,
output: 'html',
command: [doxygen, doxyfile],
install: true,
install_dir: get_option('prefix') / get_option('datadir') / 'doc' / 'libvips-doc'
)
endif

129
doc/meson.build Normal file
View File

@ -0,0 +1,129 @@
private_headers = [
'include/vips/almostdeprecated.h',
'include/vips/deprecated.h',
'include/vips/vips7compat.h',
'include/vips/dispatch.h',
'include/vips/enumtypes.h',
'include/vips/internal.h',
'include/vips/thread.h',
'include/vips/intl.h',
'include/vips/format.h',
'include/vips/mask.h',
'include/vips/private.h',
'include/vips/video.h',
# ignore all .h files in libvips/*, these are internal
'arithmetic/binary.h',
'arithmetic/hough.h',
'arithmetic/nary.h',
'arithmetic/parithmetic.h',
'arithmetic/statistic.h',
'arithmetic/unary.h',
'arithmetic/unaryconst.h',
'colour/pcolour.h',
'colour/profiles.h',
'conversion/bandary.h',
'conversion/pconversion.h',
'convolution/correlation.h',
'convolution/pconvolution.h',
'create/pcreate.h',
'create/pmask.h',
'create/point.h',
'draw/drawink.h',
'draw/pdraw.h',
'foreign/dbh.h',
'foreign/jpeg.h',
'foreign/magick.h',
'foreign/pforeign.h',
'foreign/tiff.h',
'freqfilt/pfreqfilt.h',
'histogram/hist_unary.h',
'histogram/phistogram.h',
'iofuncs/sink.h',
'iofuncs/vipsmarshal.h',
'morphology/pmorphology.h',
'mosaicing/global_balance.h',
'mosaicing/pmosaicing.h',
'resample/presample.h',
'resample/templates.h'
]
markdown_content_files = files(
'How-it-works.md',
'libvips-from-C++.md',
'Using-vipsthumbnail.md',
'How-it-opens-files.md',
'Examples.md',
'Cite.md',
'binding.md',
'Making-image-pyramids.md',
)
markdown_content_files_docbook = []
foreach markdown_content_file : markdown_content_files
# we have some files in markdown ... convert to docbook for gtk-doc
# pandoc makes section headers, we want refsect3 for gtk-doc
markdown_content_files_docbook += configure_file(
input: markdown_content_file,
command: [
find_program('pandoc'),
'@INPUT@',
'--template', files('pandoc-docbook-template.docbook'),
'--wrap=none',
'-V', 'title=@BASENAME@',
'-f', 'markdown+smart',
'-t', 'docbook',
'-o', '@OUTPUT@',
],
output: '@BASENAME@.xml',
)
endforeach
content_files = files(
'using-command-line.xml',
'using-C.xml',
'using-threads.xml',
'extending.xml',
'function-list.xml',
'file-format.xml',
)
images = files(
'images/owl.jpg',
'images/tn_owl.jpg',
'images/interconvert.png',
'images/Combine.png',
'images/Memtrace.png',
'images/Sequence.png',
'images/Sink.png',
'images/Vips-smp.png',
)
version_conf = configuration_data()
version_conf.set('VIPS_VERSION', meson.project_version ())
vips_docs = configure_file(input: 'libvips-docs.xml.in', output: 'libvips-docs.xml', configuration: version_conf)
glib_prefix = glib_dep.get_variable(pkgconfig: 'prefix')
glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html'
docpath = get_option('prefix') / get_option('datadir') / 'gtk-doc' / 'html'
gnome.gtkdoc('libvips',
mode: 'none',
main_xml: 'libvips-docs.xml.in',
src_dir: include_directories('../libvips'),
dependencies: libvips_dep,
scan_args: [
'--ignore-headers=' + ' '.join(private_headers),
'--rebuild-types',
],
mkdb_args: [ '--default-includes=vips/vips.h' ],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
],
content_files: [ content_files, markdown_content_files_docbook ],
expand_content_files: [ content_files, markdown_content_files_docbook ],
html_assets: images,
install: true
)

40
fuzz/meson.build Normal file
View File

@ -0,0 +1,40 @@
standaloneengine = static_library('standaloneengine',
'StandaloneFuzzTargetMain.c',
dependencies: libvips_deps,
)
fuzz_progs = [
'jpegsave_file_fuzzer',
'jpegsave_buffer_fuzzer',
'pngsave_buffer_fuzzer',
'webpsave_buffer_fuzzer',
'gifsave_buffer_fuzzer',
'sharpen_fuzzer',
'thumbnail_fuzzer',
'smartcrop_fuzzer',
'mosaic_fuzzer'
]
fuzz_execs = []
foreach fuzz_prog : fuzz_progs
fuzz_execs += executable(fuzz_prog,
fuzz_prog + '.cc',
dependencies: libvips_dep,
link_with: standaloneengine
)
endforeach
test_fuzz = configure_file(
input: 'test_fuzz.sh',
output: 'test_fuzz.sh',
copy: true,
)
test(
'fuzz',
test_fuzz,
workdir: meson.current_build_dir(),
depends: [
fuzz_execs,
],
)

View File

@ -0,0 +1,60 @@
arithmetic_sources = files(
'find_trim.c',
'sum.c',
'hough.c',
'hough_line.c',
'hough_circle.c',
'abs.c',
'complex.c',
'deviate.c',
'divide.c',
'measure.c',
'getpoint.c',
'multiply.c',
'remainder.c',
'sign.c',
'statistic.c',
'stats.c',
'avg.c',
'min.c',
'max.c',
'hist_find.c',
'hist_find_ndim.c',
'hist_find_indexed.c',
'project.c',
'profile.c',
'subtract.c',
'math.c',
'arithmetic.c',
'binary.c',
'unary.c',
'nary.c',
'unaryconst.c',
'relational.c',
'boolean.c',
'add.c',
'linear.c',
'invert.c',
'math2.c',
'round.c',
)
arithmetic_headers = files(
'hough.h',
'statistic.h',
'parithmetic.h',
'binary.h',
'unary.h',
'nary.h',
'unaryconst.h'
)
libvips_sources += arithmetic_sources
arithmetic_lib = static_library('arithmetic',
arithmetic_sources,
arithmetic_headers,
dependencies: libvips_deps,
)
libvips_components += arithmetic_lib

View File

@ -0,0 +1,51 @@
colour_sources = files(
'profiles.c',
'profile_load.c',
'colour.c',
'CMYK2XYZ.c',
'XYZ2CMYK.c',
'colourspace.c',
'dE76.c',
'dE00.c',
'dECMC.c',
'icc_transform.c',
'Lab2XYZ.c',
'Lab2LCh.c',
'LCh2Lab.c',
'LCh2UCS.c',
'UCS2LCh.c',
'XYZ2Lab.c',
'XYZ2Yxy.c',
'Yxy2XYZ.c',
'float2rad.c',
'rad2float.c',
'Lab2LabQ.c',
'LabQ2Lab.c',
'LabS2Lab.c',
'Lab2LabS.c',
'LabS2LabQ.c',
'LabQ2LabS.c',
'LabQ2sRGB.c',
'sRGB2scRGB.c',
'sRGB2HSV.c',
'HSV2sRGB.c',
'scRGB2XYZ.c',
'scRGB2BW.c',
'XYZ2scRGB.c',
'scRGB2sRGB.c',
)
colour_headers = files(
'profiles.h',
'pcolour.h',
)
libvips_sources += colour_sources
colour_lib = static_library('colour',
colour_sources,
colour_headers,
dependencies: libvips_deps,
)
libvips_components += colour_lib

View File

@ -0,0 +1,59 @@
conversion_sources = files(
'switch.c',
'transpose3d.c',
'composite.cpp',
'smartcrop.c',
'conversion.c',
'tilecache.c',
'gamma.c',
'sequential.c',
'flatten.c',
'premultiply.c',
'unpremultiply.c',
'byteswap.c',
'cache.c',
'copy.c',
'embed.c',
'flip.c',
'insert.c',
'join.c',
'arrayjoin.c',
'extract.c',
'replicate.c',
'cast.c',
'bandjoin.c',
'bandrank.c',
'recomb.c',
'bandmean.c',
'bandfold.c',
'bandunfold.c',
'bandbool.c',
'bandary.c',
'rot.c',
'rot45.c',
'autorot.c',
'ifthenelse.c',
'falsecolour.c',
'msb.c',
'grid.c',
'scale.c',
'wrap.c',
'subsample.c',
'zoom.c',
)
conversion_headers = files(
'pconversion.h',
'bandary.h',
)
libvips_sources += conversion_sources
conversion_lib = static_library('conversion',
conversion_sources,
conversion_headers,
dependencies: libvips_deps,
c_args: [ '-Wno-unknown-pragmas' ],
)
libvips_components += conversion_lib

View File

@ -0,0 +1,33 @@
convolution_sources = files(
'canny.c',
'sobel.c',
'convolution.c',
'correlation.c',
'conv.c',
'conva.c',
'convf.c',
'convi.c',
'convasep.c',
'convsep.c',
'compass.c',
'fastcor.c',
'spcor.c',
'sharpen.c',
'gaussblur.c',
)
convolution_headers = files(
'pconvolution.h',
'correlation.h',
)
libvips_sources += convolution_sources
convolution_lib = static_library('convolution',
convolution_sources,
convolution_headers,
dependencies: libvips_deps,
)
libvips_components += convolution_lib

View File

@ -0,0 +1,46 @@
create_sources = files(
'perlin.c',
'worley.c',
'create.c',
'gaussmat.c',
'logmat.c',
'buildlut.c',
'invertlut.c',
'tonelut.c',
'identity.c',
'point.c',
'mask.c',
'mask_ideal.c',
'mask_ideal_ring.c',
'mask_ideal_band.c',
'mask_butterworth.c',
'mask_butterworth_ring.c',
'mask_butterworth_band.c',
'mask_gaussian.c',
'mask_gaussian_ring.c',
'mask_gaussian_band.c',
'mask_fractal.c',
'fractsurf.c',
'eye.c',
'grey.c',
'xyz.c',
'black.c',
'text.c',
'gaussnoise.c',
'sines.c',
'zone.c',
)
create_headers = files(
'pcreate.h',
'point.h',
'pmask.h',
)
create_lib = static_library('create',
create_sources,
create_headers,
dependencies: libvips_deps,
)
libvips_components += create_lib

View File

@ -0,0 +1,100 @@
deprecated_sources = files(
'video_dispatch.c',
'im_video_test.c',
'cimg_dispatch.c',
'inplace_dispatch.c',
'tone.c',
'freq_dispatch.c',
'im_linreg.c',
'im_point_bilinear.c',
'resample_dispatch.c',
'im_openslide2vips.c',
'im_nifti2vips.c',
'im_lab_morph.c',
'deprecated_dispatch.c',
'mosaicing_dispatch.c',
'im_maxpos_subpel.c',
'im_align_bands.c',
'morph_dispatch.c',
'colour_dispatch.c',
'convol_dispatch.c',
'im_zerox.c',
'arith_dispatch.c',
'hist_dispatch.c',
'other_dispatch.c',
'im_maxpos_avg.c',
'lazy.c',
'im_dif_std.c',
'im_simcontr.c',
'im_spatres.c',
'im_stretch3.c',
'im_clamp.c',
'cooc_funcs.c',
'glds_funcs.c',
'im_fav4.c',
'im_benchmark.c',
'im_gadd.c',
'im_gaddim.c',
'im_gradcor.c',
'im_cmulnorm.c',
'im_printlines.c',
'im_convsub.c',
'im_line.c',
'im_measure.c',
'im_resize_linear.c',
'im_debugim.c',
'im_gfadd.c',
'im_setbox.c',
'rename.c',
'vips7compat.c',
'dispatch_types.c',
'package.c',
'im_bernd.c',
'im_thresh.c',
'im_slice.c',
'im_print.c',
'im_litecor.c',
'im_mask2vips.c',
'im_vips2mask.c',
'rotmask.c',
'rw_mask.c',
'im_matcat.c',
'im_matinv.c',
'im_matmul.c',
'im_mattrn.c',
'matalloc.c',
'mask_dispatch.c',
'fits.c',
'format.c',
'format_dispatch.c',
'im_analyze2vips.c',
'im_csv2vips.c',
'im_exr2vips.c',
'im_jpeg2vips.c',
'im_magick2vips.c',
'im_png2vips.c',
'im_webp2vips.c',
'im_ppm2vips.c',
'im_tiff2vips.c',
'im_vips2csv.c',
'im_vips2jpeg.c',
'im_vips2png.c',
'im_vips2webp.c',
'im_vips2ppm.c',
'im_vips2tiff.c',
'conver_dispatch.c',
'im_vips2dz.c',
'im_freq_mask.c',
'matlab.c',
'radiance.c',
'raw.c'
)
libvips_sources += deprecated_sources
deprecated_lib = static_library('deprecated',
deprecated_sources,
dependencies: libvips_deps,
)
libvips_components += deprecated_lib

26
libvips/draw/meson.build Normal file
View File

@ -0,0 +1,26 @@
draw_sources = files(
'draw.c',
'drawink.c',
'draw_circle.c',
'draw_flood.c',
'draw_mask.c',
'draw_image.c',
'draw_rect.c',
'draw_line.c',
'draw_smudge.c',
)
draw_headers = files(
'pdraw.h',
'drawink.h',
)
libvips_sources += draw_sources
draw_lib = static_library('draw',
draw_sources,
draw_headers,
dependencies: libvips_deps,
)
libvips_components += draw_lib

View File

@ -0,0 +1,8 @@
nsgif_lib = static_library('nsgif',
'libnsgif.h',
'libnsgif.c',
'lzw.c',
'lzw.h',
)
libvips_components += nsgif_lib

132
libvips/foreign/meson.build Normal file
View File

@ -0,0 +1,132 @@
if get_option('nsgif')
subdir('libnsgif')
endif
foreign_sources = files(
'analyze2vips.c',
'analyzeload.c',
'cairo.c',
'cgifsave.c',
'csvload.c',
'csvsave.c',
'dzsave.c',
'exif.c',
'fits.c',
'fitsload.c',
'fitssave.c',
'foreign.c',
'jp2kload.c',
'jp2ksave.c',
'jpeg2vips.c',
'jpegload.c',
'jpegsave.c',
'magickload.c',
'magicksave.c',
'matlab.c',
'matload.c',
'matrixload.c',
'matrixsave.c',
'niftiload.c',
'niftisave.c',
'nsgifload.c',
'openexr2vips.c',
'openexrload.c',
'pdfiumload.c',
'pngload.c',
'pngsave.c',
'ppmload.c',
'ppmsave.c',
'quantise.c',
'radiance.c',
'radload.c',
'radsave.c',
'rawload.c',
'rawsave.c',
'spngload.c',
'svgload.c',
'tiff2vips.c',
'tiff.c',
'tiffload.c',
'tiffsave.c',
'vips2jpeg.c',
'vips2tiff.c',
'vips2webp.c',
'vipsload.c',
'vipspng.c',
'vipssave.c',
'webp2vips.c',
'webpload.c',
'webpsave.c',
)
foreign_headers = files(
'dbh.h',
'jpeg.h',
'pforeign.h',
'quantise.h',
'tiff.h',
)
# We still need to include the GObject part of a loader/saver
# if it is not built as a dynamically loadable module.
magick_module_sources = files(
'magick.c',
'magick2vips.c',
'magick6load.c',
'magick7load.c',
'vips2magick.c',
)
magick_module_headers = files(
'magick.h',
)
if magick_dep.found() and (not get_option('magick-module') or not modules_enabled)
foreign_sources += magick_module_sources
foreign_headers += magick_module_headers
endif
jpeg_xl_module_sources = files(
'jxlload.c',
'jxlsave.c',
)
if libjxl_dep.found() and (not get_option('jpeg-xl-module') or not modules_enabled)
foreign_sources += jpeg_xl_module_sources
endif
heif_module_sources = files(
'heifload.c',
'heifsave.c',
)
if libheif_dep.found() and (not get_option('heif-module') or not modules_enabled)
foreign_sources += heif_module_sources
endif
poppler_module_sources = files(
'popplerload.c',
)
if libpoppler_dep.found() and (not get_option('poppler-module') or not modules_enabled)
foreign_sources += poppler_module_sources
endif
openslide_module_sources = files(
'openslideload.c',
)
if openslide_dep.found() and (not get_option('openslide-module') or not modules_enabled)
foreign_sources += openslide_module_sources
endif
libvips_sources += foreign_sources
foreign_lib = static_library('foreign',
foreign_sources,
foreign_headers,
dependencies: libvips_deps,
)
libvips_components += foreign_lib

View File

@ -0,0 +1,22 @@
freqfilt_sources = files(
'freqfilt.c',
'fwfft.c',
'invfft.c',
'freqmult.c',
'spectrum.c',
'phasecor.c',
)
freqfilt_headers = files(
'pfreqfilt.h',
)
libvips_sources += freqfilt_sources
freqfilt_lib = static_library('freqfilt',
freqfilt_sources,
freqfilt_headers,
dependencies: libvips_deps,
)
libvips_components += freqfilt_lib

View File

@ -0,0 +1,31 @@
histogram_sources = files(
'histogram.c',
'maplut.c',
'case.c',
'hist_unary.c',
'hist_cum.c',
'hist_norm.c',
'hist_equal.c',
'hist_plot.c',
'hist_match.c',
'hist_local.c',
'percent.c',
'hist_ismonotonic.c',
'hist_entropy.c',
'stdif.c',
)
histogram_headers = files(
'phistogram.h',
'hist_unary.h',
)
libvips_sources += histogram_sources
histogram_lib = static_library('histogram',
histogram_sources,
histogram_headers,
dependencies: libvips_deps,
)
libvips_components += histogram_lib

View File

@ -0,0 +1,34 @@
/*** BEGIN file-header ***/
/* auto-generated enums for vips introspection */
#include <vips/vips.h>
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type( void )
{
static GType etype = 0;
if( etype == 0 ) {
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{@VALUENAME@, "@VALUENAME@", "@valuenick@"},
/*** END value-production ***/
/*** BEGIN value-tail ***/
{0, NULL, NULL}
};
etype = g_@type@_register_static( "@EnumName@", values );
}
return( etype );
}
/*** END value-tail ***/

View File

@ -0,0 +1,22 @@
/*** BEGIN file-header ***/
#ifndef VIPS_ENUM_TYPES_H
#define VIPS_ENUM_TYPES_H
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN file-production ***/
/* enumerations from "@filename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define VIPS_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif /*VIPS_ENUM_TYPES_H*/
/*** END file-tail ***/

View File

@ -0,0 +1,189 @@
public_other_headers = files(
'almostdeprecated.h',
'buf.h',
'connection.h',
'dbuf.h',
'debug.h',
'deprecated.h',
'dispatch.h',
'format.h',
'gate.h',
'generate.h',
'intl.h',
'mask.h',
'private.h',
'sbuf.h',
'semaphore.h',
'thread.h',
'threadpool.h',
'transform.h',
'util.h',
'vector.h',
'video.h',
'vips7compat.h',
)
public_headers = files(
'arithmetic.h',
'basic.h',
'colour.h',
'conversion.h',
'convolution.h',
'create.h',
'draw.h',
'error.h',
'foreign.h',
'freqfilt.h',
'header.h',
'histogram.h',
'image.h',
'interpolate.h',
'memory.h',
'morphology.h',
'mosaicing.h',
'object.h',
'operation.h',
'rect.h',
'region.h',
'resample.h',
'type.h',
'vips.h',
)
enumtypes = gnome.mkenums(
'enumtypes',
sources: files(
'resample.h',
'memory.h',
'create.h',
'foreign.h',
'arithmetic.h',
'conversion.h',
'util.h',
'image.h',
'colour.h',
'operation.h',
'convolution.h',
'morphology.h',
'draw.h',
'basic.h',
'object.h',
'region.h'
),
h_template: 'enumtypes.h.in',
c_template: 'enumtypes.c.in',
install_header: true,
install_dir: get_option('prefix') / get_option('includedir') / 'vips'
)
vips_verbose_config = []
vips_verbose_config += 'enable debug: @0@'.format(get_option('debug'))
vips_verbose_config += 'enable deprecated library components: @0@'.format(get_option('deprecated'))
vips_verbose_config += 'enable modules: @0@'.format(modules_enabled)
vips_verbose_config += 'use fftw3 for FFT: @0@'.format(fftw_dep.found())
vips_verbose_config += 'accelerate loops with orc: @0@'.format(orc_dep.found())
vips_verbose_config += 'ICC profile support with lcms: @0@'.format(lcms_dep.found())
vips_verbose_config += 'zlib: @0@'.format(zlib_dep.found())
vips_verbose_config += 'text rendering with pangocairo: @0@'.format(pangocairo_dep.found())
vips_verbose_config += 'font file support with fontconfig: @0@'.format(fontconfig_dep.found())
vips_verbose_config += 'RAD load/save: @0@'.format(get_option('radiance'))
vips_verbose_config += 'Analyze7 load/save: @0@'.format(get_option('analyze'))
vips_verbose_config += 'PPM load/save: @0@'.format(get_option('ppm'))
vips_verbose_config += 'GIF load: @0@'.format(get_option('nsgif'))
vips_verbose_config += 'GIF save with cgif: @0@'.format(cgif_dep.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(), get_option('jpeg-xl-module'))
vips_verbose_config +='JPEG2000 load/save with libopenjp2: @0@'.format(libopenjp2_dep.found())
vips_verbose_config += 'PNG load with libspng: @0@'.format(spng_dep.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: @0@'.format(gsf_dep.found())
vips_verbose_config += 'HEIC/AVIF load/save with libheif: @0@ (dynamic module: @1@)'.format(libheif_dep.found(), get_option('heif-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(), get_option('poppler-module'))
vips_verbose_config += 'SVG load with librsvg-2.0: @0@'.format(librsvg_dep.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(), get_option('openslide-module'))
vips_verbose_config += 'Matlab load with matio: @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 += 'Magick package: @0@ (dynamic module: @1@)'.format(magick_dep.found(), get_option('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 += 'load with libMagickCore: @0@'.format(magick_dep.found() and 'load' in get_option('magick-features'))
vips_verbose_config += 'save with libMagickCore: @0@'.format(magick_dep.found() and 'save' in get_option('magick-features'))
version_data = configuration_data()
version_data.set('VIPS_VERSION', meson.project_version())
version_data.set('VIPS_VERSION_STRING', meson.project_version())
version_data.set('VIPS_MAJOR_VERSION', version_major)
version_data.set('VIPS_MINOR_VERSION', version_minor)
version_data.set('VIPS_MICRO_VERSION', version_patch)
version_data.set('LIBRARY_CURRENT', library_current)
version_data.set('LIBRARY_REVISION', library_revision)
version_data.set('LIBRARY_AGE', library_age)
version_data.set('VIPS_CONFIG', ', '.join(vips_verbose_config))
#FIXME: Do not require this
if target_machine.system() == 'windows' or target_machine.system() == 'cygwin'
version_data.set('VIPS_EXEEXT', '.exe')
else
version_data.set('VIPS_EXEEXT', '')
endif
version_data.set10('VIPS_ENABLE_DEPRECATED', get_option('deprecated'))
version_header = configure_file(
input: 'version.h.in',
output: 'version.h',
configuration: version_data,
install: true,
install_dir: get_option('prefix') / get_option('includedir') / 'vips'
)
#FIXME: Do not require this
soname_data = configuration_data()
if target_machine.system() == 'windows'
soname_data.set_quoted('VIPS_SONAME', 'vips-@0@.dll'.format(library_current - library_age))
elif target_machine.system() == 'cygwin'
soname_data.set_quoted('VIPS_SONAME', 'cygvips-@0@.dll'.format(library_current - library_age))
elif target_machine.system() == 'darwin'
soname_data.set_quoted('VIPS_SONAME', 'libvips.dylib')
else
soname_data.set_quoted('VIPS_SONAME', 'libvips.so')
endif
soname_header = configure_file(
output: 'soname.h',
configuration: soname_data,
install: true,
install_dir: get_option('prefix') / get_option('includedir') / 'vips'
)
libvips_sources += public_headers
libvips_sources += enumtypes
libvips_sources += version_header
libvips_sources += soname_header
install_headers(
public_other_headers,
public_headers,
subdir: 'vips'
)
libvips_includedir = include_directories('..')
libvips_headers_dep = declare_dependency(
sources: [
public_headers,
enumtypes[1],
version_header,
soname_header
],
include_directories: libvips_includedir
)
libvips_deps += libvips_headers_dep

View File

@ -0,0 +1,60 @@
iofuncs_sources = files(
'ginputsource.c',
'sourceginput.c',
'connection.c',
'source.c',
'sourcecustom.c',
'target.c',
'targetcustom.c',
'sbuf.c',
'dbuf.c',
'reorder.c',
'type.c',
'gate.c',
'object.c',
'error.c',
'image.c',
'vips.c',
'generate.c',
'mapfile.c',
'cache.c',
'sink.c',
'sinkmemory.c',
'sinkdisc.c',
'sinkscreen.c',
'memory.c',
'header.c',
'operation.c',
'region.c',
'rect.c',
'semaphore.c',
'threadpool.c',
'util.c',
'init.c',
'buf.c',
'window.c',
'vector.c',
'system.c',
'buffer.c',
)
iofuncs_headers = files(
'sink.h',
)
vipsmarshal = gnome.genmarshal(
'vipsmarshal',
prefix: 'vips',
sources: 'vipsmarshal.list',
)
libvips_sources += iofuncs_sources
iofuncs_lib = static_library('iofuncs',
iofuncs_sources,
iofuncs_headers,
vipsmarshal,
dependencies: libvips_deps,
)
libvips_components += iofuncs_lib

141
libvips/meson.build Normal file
View File

@ -0,0 +1,141 @@
libvips_sources = []
libvips_components = []
subdir('include/vips')
subdir('foreign')
if get_option('deprecated')
subdir('deprecated')
endif
subdir('arithmetic')
subdir('resample')
subdir('colour')
subdir('conversion')
subdir('convolution')
subdir('freqfilt')
subdir('histogram')
subdir('draw')
subdir('iofuncs')
subdir('morphology')
subdir('mosaicing')
subdir('create')
libvips_lib = library('vips',
enumtypes,
link_whole: libvips_components,
dependencies: libvips_deps,
version: library_version,
install: true,
)
libvips_dep = declare_dependency(
link_with: libvips_lib,
dependencies: libvips_deps,
sources: [ enumtypes, soname_header ]
)
pkg.generate(
libvips_lib,
requires: [ glib_dep, gio_dep, gobject_dep ],
name: 'vips',
description: 'Image processing library',
)
if get_option('introspection')
vips_gir = gnome.generate_gir(
libvips_lib,
namespace: 'Vips',
nsversion: '8.0',
identifier_prefix: 'Vips',
symbol_prefix: 'vips',
header: 'vips/vips.h',
sources: libvips_sources,
dependencies: libvips_deps,
# TODO: Fix all the warnings and remove this extra_arg
extra_args: '--quiet',
includes: 'GObject-2.0',
install: true
)
if get_option('vapi')
gnome.generate_vapi(
'vips',
sources: vips_gir[0],
packages: [ 'glib-2.0', 'gio-2.0', 'gobject-2.0' ],
install: true
)
endif
endif
#
# The following configuration is only valid when the modules are enabled
#
if not modules_enabled
subdir_done()
endif
# Keep the autotools convention for shared module suffix because GModule
# depends on it: https://gitlab.gnome.org/GNOME/glib/issues/1413
module_suffix = []
if ['darwin', 'ios'].contains(host_machine.system())
module_suffix = 'so'
endif
if magick_dep.found() and get_option('magick-module')
shared_module('vips-magick',
'module/magick.c',
magick_module_sources,
magick_module_headers,
name_prefix: '',
name_suffix: module_suffix,
dependencies: [libvips_dep, magick_dep],
install: true,
install_dir: module_dir
)
endif
if libjxl_dep.found() and get_option('jpeg-xl-module')
shared_module('vips-jxl',
'module/jxl.c',
jpeg_xl_module_sources,
name_prefix: '',
name_suffix: module_suffix,
dependencies: [libvips_dep, libjxl_dep, libjxl_threads_dep],
install: true,
install_dir: module_dir
)
endif
if libheif_dep.found() and get_option('heif-module')
shared_module('vips-heif',
'module/heif.c',
heif_module_sources,
name_prefix: '',
name_suffix: module_suffix,
dependencies: [libvips_dep, libheif_dep],
install: true,
install_dir: module_dir
)
endif
if libpoppler_dep.found() and get_option('poppler-module')
shared_module('vips-poppler',
'module/poppler.c',
poppler_module_sources,
name_prefix: '',
name_suffix: module_suffix,
dependencies: [libvips_dep, libpoppler_dep, cairo_dep],
install: true,
install_dir: module_dir
)
endif
if openslide_dep.found() and get_option('openslide-module')
shared_module('vips-openslide',
'module/openslide.c',
openslide_module_sources,
name_prefix: '',
name_suffix: module_suffix,
dependencies: [libvips_dep, openslide_dep],
install: true,
install_dir: module_dir
)
endif

View File

@ -0,0 +1,22 @@
morphology_sources = files(
'nearest.c',
'morphology.c',
'countlines.c',
'rank.c',
'morph.c',
'labelregions.c',
)
morphology_headers = files(
'pmorphology.h',
)
libvips_sources += morphology_sources
morphology_lib = static_library('morphology',
morphology_sources,
morphology_headers,
dependencies: libvips_deps,
)
libvips_components += morphology_lib

View File

@ -0,0 +1,36 @@
mosaicing_sources = files(
'mosaicing.c',
'merge.c',
'mosaic.c',
'match.c',
'mosaic1.c',
'chkpair.c',
'matrixinvert.c',
'global_balance.c',
'lrmerge.c',
'tbmerge.c',
'lrmosaic.c',
'tbmosaic.c',
'remosaic.c',
'im_avgdxdy.c',
'im_clinear.c',
'im_improve.c',
'im_initialize.c',
'im_lrcalcon.c',
'im_tbcalcon.c',
)
mosaicing_headers = files(
'global_balance.h',
'pmosaicing.h',
)
libvips_sources += mosaicing_sources
mosaicing_lib = static_library('mosaicing',
mosaicing_sources,
mosaicing_headers,
dependencies: libvips_deps,
)
libvips_components += mosaicing_lib

View File

@ -0,0 +1,36 @@
resample_sources = files(
'thumbnail.c',
'mapim.c',
'affine.c',
'quadratic.c',
'resample.c',
'similarity.c',
'resize.c',
'shrink.c',
'shrinkh.c',
'shrinkv.c',
'reduce.c',
'reduceh.cpp',
'reducev.cpp',
'interpolate.c',
'transform.c',
'bicubic.cpp',
'lbb.cpp',
'nohalo.cpp',
'vsqbs.cpp',
)
resample_headers = files(
'presample.h',
'templates.h',
)
libvips_sources += resample_sources
resample_lib = static_library('resample',
resample_sources,
resample_headers,
dependencies: libvips_deps,
)
libvips_components += resample_lib

11
man/meson.build Normal file
View File

@ -0,0 +1,11 @@
install_man(
'batch_crop.1',
'batch_image_convert.1',
'batch_rubber_sheet.1',
'vipsedit.1',
'vipsheader.1',
'light_correct.1',
'vips.1',
'vipsprofile.1',
'vipsthumbnail.1'
)

544
meson.build Normal file
View File

@ -0,0 +1,544 @@
project('vips', 'c', 'cpp',
version: '8.13.0',
meson_version: '>=0.56',
default_options: [
'c_std=c99'
]
)
version_parts = meson.project_version().split('.')
version_major = version_parts[0]
version_minor = version_parts[1]
version_patch = version_parts[2]
# rules:
# sources changed: increment revision
# binary interface changed: increment current, reset revision to 0
# binary interface changes backwards compatible?: increment age
# binary interface changes not backwards compatible?: reset age to 0
library_current = 57
library_age = 15
library_revision = 0
library_version = '@0@.@1@.@2@'.format(library_current - library_age, library_age, library_revision)
gnome = import('gnome')
pymod = import('python')
pkg = import('pkgconfig')
i18n = import('i18n')
add_project_arguments('-Drestrict=__restrict', language: 'cpp')
add_project_link_arguments(
'-no-undefined',
language: 'c',
)
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
glib_dep = dependency('glib-2.0')
gio_dep = dependency('gio-2.0')
gobject_dep = dependency('gobject-2.0')
gmodule_dep = dependency('gmodule-no-export-2.0')
expat_dep = dependency('expat')
thread_dep = dependency('threads')
m_dep = cc.find_library('m', required : false)
libvips_deps = [
glib_dep,
gio_dep,
gobject_dep,
gmodule_dep,
expat_dep,
thread_dep,
m_dep,
]
prefix_dir = get_option('prefix')
lib_dir = prefix_dir / get_option('libdir')
if gmodule_dep.get_variable(pkgconfig: 'gmodule_supported') != 'false'
modules_enabled = get_option('modules').enabled() or get_option('modules').auto()
elif get_option('modules').enabled()
error('GModule is not supported on your system, please reconfigure with -Dmodules=disabled')
else
modules_enabled = false
endif
module_dir = lib_dir / 'vips-modules-@0@.@1@'.format(version_major, version_minor)
cfg_var = configuration_data()
cfg_var.set_quoted('G_LOG_DOMAIN', 'VIPS')
if (glib_dep.version().version_compare('>=2.48'))
cfg_var.set('HAVE_CHECKED_MUL', '1')
endif
if (glib_dep.version().version_compare('>=2.62'))
cfg_var.set('HAVE_DATE_TIME_FORMAT_ISO8601', '1')
endif
if modules_enabled
cfg_var.set('ENABLE_MODULES', '1')
endif
# we also need to be able to mix vector and scalar arithmetic
vector_arithmetic_check = '''
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
int main(void) {
v4f f = {1, 2, 3, 4}; f *= 12.0;
v4f g = {5, 6, 7, 8}; f = g > 0 ? g : -1 * g;
}
'''
# gcc 7.2 seems to work, but then gets confused by signed constants in templates
signed_constants_check = '''
typedef float v4f __attribute__((vector_size(4 * sizeof(float)),aligned(16)));
template <typename T>
static void
h( v4f B )
{
v4f f;
f = -1 * B;
}
'''
if cpp.compiles(vector_arithmetic_check, name: 'Has vector arithmetic', dependencies: m_dep)
if cpp.compiles(signed_constants_check, name: 'Has signed constants in vector templates', dependencies: m_dep)
cfg_var.set('HAVE_VECTOR_ARITH', '1')
endif
endif
func_names = [ 'getcwd', 'gettimeofday', 'getwd', 'memset', 'munmap', 'putenv', 'realpath', 'strcasecmp', 'strchr', 'strcspn', 'strdup', 'strerror', 'strrchr', 'strspn', 'vsnprintf', 'realpath', 'mkstemp', 'mktemp', 'random', 'rand', 'sysconf', 'atexit', '_aligned_malloc', 'posix_memalign', 'memalign', 'cbrt', 'hypot', 'atan2', 'asinh' ]
foreach func_name : func_names
if cc.has_function(func_name, dependencies: m_dep)
cfg_var.set('HAVE_' + func_name.to_upper(), '1')
endif
endforeach
if cc.has_function('pthread_setattr_default_np', args: '-D_GNU_SOURCE', prefix: '#include <pthread.h>', dependencies: thread_dep)
cfg_var.set('HAVE_PTHREAD_DEFAULT_NP', '1')
endif
gsf_dep = dependency('libgsf-1', version: '>=1.14.26', required: get_option('gsf'))
if gsf_dep.found()
libvips_deps += gsf_dep
cfg_var.set('HAVE_GSF', '1')
if gsf_dep.version().version_compare('>=1.14.31')
cfg_var.set('HAVE_GSF_ZIP64', '1')
cfg_var.set('HAVE_GSF_DEFLATE_LEVEL', '1')
endif
endif
fftw_dep = dependency('fftw3', required: get_option('fftw'))
if fftw_dep.found()
libvips_deps += fftw_dep
cfg_var.set('HAVE_FFTW', '1')
endif
# We can simplify this when requiring meson>=0.60.0
magick_dep = dependency('MagickCore', required: false)
if not magick_dep.found()
magick_dep = dependency('ImageMagick', required: get_option('magick'))
endif
if not get_option('magick').disabled() and magick_dep.found()
if get_option('magick-module') and modules_enabled
cfg_var.set('MAGICK_MODULE', '1')
else
libvips_deps += magick_dep
endif
if magick_dep.version().version_compare('>=7.0')
cfg_var.set('HAVE_MAGICK7', '1')
elif magick_dep.version().version_compare('>=6.0')
cfg_var.set('HAVE_MAGICK6', '1')
if cc.has_member('struct _ImageInfo', 'number_scenes', prefix : '#include <magick/api.h>', dependencies: magick_dep)
cfg_var.set('HAVE_NUMBER_SCENES', '1')
endif
func_names = [ 'InheritException', 'AcquireExceptionInfo', 'SetImageProperty', 'SetImageExtent', 'AcquireImage', 'GetVirtualPixels', 'ResetImageProfileIterator', 'ResetImageAttributeIterator', 'ResetImagePropertyIterator', 'MagickCoreGenesis', 'SetImageOption', 'BlobToStringInfo', 'OptimizePlusImageLayers', 'OptimizeImageTransparency' ]
foreach func_name : func_names
if cc.has_function(func_name, prefix : '#include <magick/api.h>', dependencies: magick_dep)
cfg_var.set('HAVE_' + func_name.to_upper(), '1')
endif
endforeach
if cc.compiles('#include <magick/api.h>\nColorspaceType colorspace = CMYColorspace;', name: 'Has CMYColorspace', dependencies: magick_dep)
cfg_var.set('HAVE_CMYCOLORSPACE', '1')
endif
if cc.compiles('#include <magick/api.h>\nColorspaceType colorspace = HCLpColorspace;', name: 'Has HCLpColorspace', dependencies: magick_dep)
cfg_var.set('HAVE_HCLPCOLORSPACE', '1')
endif
# GetImageMagick() takes two args under GM, three under IM
if cc.compiles('#include <magick/api.h>\nint main() {(void)GetImageMagick(NULL, 0, NULL);}', name: 'GetImageMagick takes three arguments', dependencies: magick_dep)
cfg_var.set('HAVE_GETIMAGEMAGICK3', '1')
endif
else
error('Unsupported libmagick version')
endif
if 'load' in get_option('magick-features')
cfg_var.set('ENABLE_MAGICKLOAD', '1')
endif
if 'save' in get_option('magick-features')
cfg_var.set('ENABLE_MAGICKSAVE', '1')
if cc.has_function('ImportImagePixels', prefix : '#include <magick/api.h>', dependencies: magick_dep)
cfg_var.set('HAVE_IMPORTIMAGEPIXELS', '1')
endif
if cc.has_function('ImagesToBlob', prefix : '#include <magick/api.h>', dependencies: magick_dep)
cfg_var.set('HAVE_IMAGESTOBLOB', '1')
endif
endif
endif
cfitsio_dep = dependency('cfitsio', required: get_option('cfitsio'))
if cfitsio_dep.found()
libvips_deps += cfitsio_dep
cfg_var.set('HAVE_CFITSIO', '1')
endif
# quant package we use
quantisation_package = disabler()
imagequant_dep = dependency('imagequant', required: get_option('imagequant'))
if imagequant_dep.found()
libvips_deps += imagequant_dep
cfg_var.set('HAVE_IMAGEQUANT', '1')
quantisation_package = imagequant_dep
endif
# only if libimagequant not found
quantizr_dep = disabler()
if not quantisation_package.found()
quantizr_dep = dependency('quantizr', required: get_option('quantizr'))
if quantizr_dep.found()
libvips_deps += quantizr_dep
cfg_var.set('HAVE_QUANTIZR', '1')
quantisation_package = quantizr_dep
endif
endif
cgif_dep = disabler()
if quantisation_package.found()
cgif_dep = dependency('cgif', required: get_option('cgif'))
if cgif_dep.found()
libvips_deps += cgif_dep
cfg_var.set('HAVE_CGIF', '1')
endif
endif
libexif_dep = dependency('libexif', version: '>=0.6', required: get_option('exif'))
if libexif_dep.found()
libvips_deps += libexif_dep
cfg_var.set('HAVE_EXIF', '1')
# some libexif packages need include <libexif/poop.h>, some just <poop.h>
# how annoying
if cc.has_header('exif-data.h', dependencies: libexif_dep)
# libexif includes don't need libexif prefix
cfg_var.set('UNTAGGED_EXIF', '1')
endif
endif
libjpeg_dep = dependency('libjpeg', required: get_option('jpeg'))
if libjpeg_dep.found()
libvips_deps += libjpeg_dep
cfg_var.set('HAVE_JPEG', '1')
# features like trellis quant are exposed as extension parameters ...
# mozjpeg 3.2 and later have #define JPEG_C_PARAM_SUPPORTED, but we must
# work with earlier versions
if cc.has_function('jpeg_c_bool_param_supported', prefix: '#include <stdio.h>\n#include <jpeglib.h>', dependencies: libjpeg_dep)
cfg_var.set('HAVE_JPEG_EXT_PARAMS', '1')
endif
endif
# Look for libspng first
# 0.6.1 uses "libspng.pc", git master libspng uses "spng.pc"
# We can simplify this when requiring meson>=0.60.0
spng_dep = dependency('libspng', version: '>=0.6', required: false)
if not spng_dep.found()
spng_dep = dependency('spng', version: '>=0.6', required: get_option('spng'))
endif
if not get_option('spng').disabled() and spng_dep.found()
libvips_deps += spng_dep
cfg_var.set('HAVE_SPNG', '1')
endif
# we can have both PNG and SPNG enabled, with SPNG for read and PNG for write
png_dep = dependency('libpng', version: '>=1.2.9', required: get_option('png'))
if png_dep.found()
libvips_deps += png_dep
cfg_var.set('HAVE_PNG', '1')
if cc.has_function('png_set_chunk_malloc_max', prefix: '#include <png.h>', dependencies: png_dep)
cfg_var.set('HAVE_PNG_SET_CHUNK_MALLOC_MAX', '1')
endif
endif
# libwebp ... target 0.6+ to reduce complication
# webp has the stuff for handling metadata in two separate libraries -- we
# insit on having all of them
libwebp_dep = dependency('libwebp', version: '>=0.6', required: get_option('png'))
if libwebp_dep.found()
libvips_deps += libwebp_dep
libvips_deps += dependency('libwebpmux', version: '>=0.6')
libvips_deps += dependency('libwebpdemux', version: '>=0.6')
cfg_var.set('HAVE_LIBWEBP', '1')
endif
pangocairo_dep = dependency('pangocairo', required: get_option('pangocairo'))
if pangocairo_dep.found()
libvips_deps += pangocairo_dep
cfg_var.set('HAVE_PANGOCAIRO', '1')
endif
fontconfig_dep = dependency('fontconfig', required: get_option('fontconfig'))
if fontconfig_dep.found() and pangocairo_dep.found()
libvips_deps += fontconfig_dep
cfg_var.set('HAVE_FONTCONFIG', '1')
endif
libtiff_dep = dependency('libtiff-4', required: get_option('tiff'))
if libtiff_dep.found()
libvips_deps += libtiff_dep
cfg_var.set('HAVE_TIFF', '1')
# ZSTD and WEBP in TIFF added in libtiff 4.0.10
if cc.get_define('COMPRESSION_WEBP', prefix: '#include <tiff.h>', dependencies: libtiff_dep) != ''
cfg_var.set('HAVE_TIFF_COMPRESSION_WEBP', '1')
endif
endif
# 2.40.3 so we get the UNLIMITED open flag
librsvg_dep = dependency('librsvg-2.0', version: '>=2.40.3', required: get_option('rsvg'))
cairo_dep = dependency('cairo', version: '>=1.2', required: get_option('rsvg'))
if librsvg_dep.found() and cairo_dep.found()
libvips_deps += librsvg_dep
libvips_deps += cairo_dep
cfg_var.set('HAVE_RSVG', '1')
# 2.46 for rsvg_handle_render_document
if librsvg_dep.version().version_compare('>=2.46')
cfg_var.set('HAVE_RSVG_HANDLE_RENDER_DOCUMENT', '1')
endif
zlib_dep = dependency('zlib', version: '>=0.4', required: get_option('zlib'))
if zlib_dep.found()
libvips_deps += zlib_dep
cfg_var.set('HAVE_ZLIB', '1')
endif
endif
if get_option('zlib').enabled() and not librsvg_dep.found()
message('zlib is only enabled alongside rsvg, disabling as rsvg is not enabled')
endif
openslide_dep = dependency('openslide', version: '>=3.3.0', required: get_option('openslide'))
if openslide_dep.found()
if get_option('openslide-module') and modules_enabled
cfg_var.set('OPENSLIDE_MODULE', '1')
else
libvips_deps += openslide_dep
endif
cfg_var.set('HAVE_OPENSLIDE', '1')
if openslide_dep.version().version_compare('>=3.4.0')
cfg_var.set('HAVE_OPENSLIDE_3_4', '1')
endif
endif
matio_dep = dependency('matio', required: get_option('matio'))
if matio_dep.found()
libvips_deps += matio_dep
cfg_var.set('HAVE_MATIO', '1')
endif
# lcms ... refuse to use lcms1
lcms_dep = dependency('lcms2', required: get_option('lcms'))
if lcms_dep.found()
libvips_deps += lcms_dep
cfg_var.set('HAVE_LCMS', '1')
cfg_var.set('HAVE_LCMS2', '1')
endif
# require 1.2.2 since 1.2.1 has a broken ImfCloseTiledInputFile()
openexr_dep = dependency('OpenEXR', version: '>=0.1.2.2', required: get_option('openexr'))
if openexr_dep.found()
libvips_deps += openexr_dep
cfg_var.set('HAVE_OPENEXR', '1')
endif
# 2.4 is the first one to have working threading and tiling
libopenjp2_dep = dependency('libopenjp2', version: '>=2.4', required: get_option('openjpeg'))
if libopenjp2_dep.found()
libvips_deps += libopenjp2_dep
cfg_var.set('HAVE_LIBOPENJP2', '1')
endif
# we use loadpw etc.
orc_dep = dependency('orc-0.4', version: '>=0.4.11', required: get_option('orc'))
if orc_dep.found()
libvips_deps += orc_dep
cfg_var.set('HAVE_ORC', '1')
# orc 0.4.30+ works with cf-protection, but 0.4.30 has a bug with multiple
# definitions of OrcTargetPowerPCFlags, so insist on 0.4.31
if orc_dep.version().version_compare('>=0.4.31')
cfg_var.set('HAVE_ORC_CF_PROTECTION', '1')
endif
if cc.has_function('orc_program_get_error', prefix: '#include <orc/orc.h>', dependencies: orc_dep)
cfg_var.set('HAVE_ORC_PROGRAM_GET_ERROR', '1')
endif
endif
# pick 4200 as the starting version number ... no reason, really, it'd
# probably work with much older versions
pdfium_dep = dependency('pdfium', version: '>=4200', required: get_option('pdfium'))
if pdfium_dep.found()
libvips_deps += pdfium_dep
cfg_var.set('HAVE_PDFIUM', '1')
endif
libheif_dep = dependency('libheif', version: '>=0.4.11', required: get_option('heif'))
if libheif_dep.found()
if get_option('heif-module') and modules_enabled
cfg_var.set('HEIF_MODULE', '1')
else
libvips_deps += libheif_dep
endif
if libheif_dep.get_variable(pkgconfig: 'builtin_h265_decoder', internal: 'builtin_h265_decoder', default_value: 'no') != 'no' or libheif_dep.get_variable(pkgconfig: 'builtin_avif_decoder', internal: 'builtin_avif_decoder', default_value: 'no') != 'no'
cfg_var.set('HAVE_HEIF_DECODER', '1')
endif
if libheif_dep.get_variable(pkgconfig: 'builtin_h265_encoder', internal: 'builtin_h265_encoder', default_value: 'no') != 'no' or libheif_dep.get_variable(pkgconfig: 'builtin_avif_encoder', internal: 'builtin_avif_encoder', default_value: 'no') != 'no'
cfg_var.set('HAVE_HEIF_ENCODER', '1')
endif
if cc.has_function('heif_image_handle_get_raw_color_profile', prefix: '#include <libheif/heif.h>', dependencies: libheif_dep)
cfg_var.set('HAVE_HEIF_COLOR_PROFILE', '1')
endif
if cc.has_member('struct heif_decoding_options', 'convert_hdr_to_8bit', prefix: '#include <libheif/heif.h>', dependencies: libheif_dep)
cfg_var.set('HAVE_HEIF_DECODING_OPTIONS_CONVERT_HDR_TO_8BIT', '1')
endif
# heif_main_brand added in 1.4.0, but heif_avif appeared in 1.7 ... just check
# the libheif version number since testing for enums is annoying
if libheif_dep.version().version_compare('>=1.7.0')
cfg_var.set('HAVE_HEIF_AVIF', '1')
endif
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 get_option('jpeg-xl-module') and modules_enabled
cfg_var.set('LIBJXL_MODULE', '1')
else
libvips_deps += libjxl_dep
libvips_deps += libjxl_threads_dep
endif
cfg_var.set('HAVE_LIBJXL', '1')
if cc.has_function('JxlEncoderInitBasicInfo', prefix: '#include <jxl/encode.h>', dependencies: libjxl_dep)
cfg_var.set('HAVE_LIBJXL_JXLENCODERINITBASICINFO', '1')
endif
endif
libpoppler_dep = dependency('poppler-glib', version: '>=0.16.0', required: get_option('poppler'))
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 get_option('poppler-module') and modules_enabled
cfg_var.set('POPPLER_MODULE', '1')
else
libvips_deps += libpoppler_dep
libvips_deps += cairo_dep
endif
cfg_var.set('HAVE_POPPLER', '1')
endif
libnifti_dep = cc.find_library('niftiio', has_headers: 'nifti1_io.h', required: false)
if not libnifti_dep.found()
libnifti_dep = dependency('NIFTI', method : 'cmake', modules : ['NIFTI'], required: get_option('nifti'))
endif
if libnifti_dep.found()
libvips_deps += libnifti_dep
cfg_var.set('HAVE_NIFTI', '1')
endif
if cc.has_header('sys/file.h')
cfg_var.set('HAVE_SYS_FILE_H', '1')
endif
if cc.has_header('sys/param.h')
cfg_var.set('HAVE_SYS_PARAM_H', '1')
endif
if cc.has_header('sys/mman.h')
cfg_var.set('HAVE_SYS_MMAN_H', '1')
endif
if cc.has_header('unistd.h')
cfg_var.set('HAVE_UNISTD_H', '1')
endif
if cc.has_header('io.h')
cfg_var.set('HAVE_IO_H', '1')
endif
if cc.has_header('direct.h')
cfg_var.set('HAVE_DIRECT_H', '1')
endif
if cc.has_header('windows.h')
cfg_var.set('HAVE_WINDOWS_H', '1')
endif
if get_option('deprecated')
cfg_var.set('ENABLE_DEPRECATED', '1')
endif
if get_option('nsgif')
cfg_var.set('HAVE_NSGIF', '1')
endif
if get_option('ppm')
cfg_var.set('HAVE_PPM', '1')
endif
if get_option('analyze')
cfg_var.set('HAVE_ANALYZE', '1')
endif
if get_option('radiance')
cfg_var.set('HAVE_RADIANCE', '1')
endif
gettext_domain = 'vips@0@.@1@'.format(version_major, version_minor)
cfg_var.set_quoted('GETTEXT_PACKAGE', gettext_domain)
cfg_var.set_quoted('VIPS_PREFIX', prefix_dir)
cfg_var.set_quoted('VIPS_LIBDIR', lib_dir)
if cc.has_function('ngettext')
cfg_var.set('ENABLE_NLS', 1)
else
libintl_dep = cc.find_library('intl', required : false)
if libintl_dep.found()
libvips_deps += libintl_dep
cfg_var.set('ENABLE_NLS', 1)
endif
endif
target_system = target_machine.system()
if target_system == 'darwin'
profile_dir = '/Library/ColorSync/Profiles'
elif target_system == 'windows'
# need double escapes since this will get pasted into a #define in a C
# header ... the C:\Windows is usually overwritten with the result of
# GetWindowsDirectoryW()
profile_dir = 'C:\\\\Windows\\\\System32\\\\spool\\\\drivers\\\\color'
else
profile_dir = get_option('prefix') / get_option('datadir') / 'color' / 'icc'
endif
cfg_var.set_quoted('VIPS_ICC_DIR', profile_dir)
config_file = configure_file(
configuration: cfg_var,
output: 'config.h'
)
config_dep = declare_dependency(
sources: config_file,
include_directories: include_directories('.'),
compile_args: '-DHAVE_CONFIG_H=1',
)
libvips_deps += config_dep
subdir('libvips')
if get_option('gtk_doc')
subdir('doc')
endif
subdir('cplusplus')
subdir('man')
subdir('po')
subdir('tools')
subdir('test')
subdir('fuzz')

46
meson_options.txt Normal file
View File

@ -0,0 +1,46 @@
option('deprecated', type : 'boolean', value : true, description: 'Build deprecated components')
option('doxygen', type : 'boolean', value : false, description: 'Build C++ documentation')
option('gtk_doc', type : 'boolean', value : false, description: 'Build GTK-doc documentation')
option('modules', type : 'feature', value : 'auto', description: 'Build dynamic modules')
option('introspection', type : 'boolean', value : false, description: 'Build GObject Introspection')
option('vapi', type : 'boolean', value : false, description: 'Build VAPI')
# External libraries
option('cfitsio', type : 'feature', value : 'auto', description: 'Build with cfitsio')
option('cgif', type : 'feature', value : 'auto', description: 'Build with cgif')
option('exif', type : 'feature', value : 'auto', description: 'Build with libexif')
option('fftw', type : 'feature', value : 'auto', description: 'Build with fftw3')
option('fontconfig', type : 'feature', value : 'auto', description: 'Build with fontconfig')
option('gsf', type : 'feature', value : 'auto', description: 'Build with libgsf-1')
option('heif', type : 'feature', value : 'auto', description: 'Build with libheif')
option('heif-module', type : 'boolean', value : false, description: 'Build libheif as module')
option('imagequant', type : 'feature', value : 'auto', description: 'Build with imagequant')
option('jpeg', type : 'feature', value : 'auto', description: 'Build with jpeg')
option('jpeg-xl', type : 'feature', value : 'auto', description: 'Build with libjxl')
option('jpeg-xl-module', type : 'boolean', value : false, description: 'Build libjxl as module')
option('lcms', type : 'feature', value : 'auto', description: 'Build with lcms2')
option('magick', type : 'feature', value : 'auto', description: 'Build with libMagic')
option('magick-features', type : 'array', choices : ['load', 'save'], value : ['load', 'save'], description: 'Enable libMagic load or save capabilities')
option('magick-module', type : 'boolean', value : false, description: 'Build libMagic as module')
option('matio', type : 'feature', value : 'auto', description: 'Build with matio')
option('nifti', type : 'feature', value : 'auto', description: 'Build with nifti')
option('openexr', type : 'feature', value : 'auto', description: 'Build with OpenEXR')
option('openjpeg', type : 'feature', value : 'auto', description: 'Build with libopenjp2')
option('openslide', type : 'feature', value : 'auto', description: 'Build with OpenSlide')
option('openslide-module', type : 'boolean', value : false, description: 'Build OpenSlide as module')
option('orc', type : 'feature', value : 'auto', description: 'Build with orc-0.4')
option('pangocairo', type : 'feature', value : 'auto', description: 'Build with pangocairo')
option('pdfium', type : 'feature', value : 'auto', description: 'Build with pdfium')
option('png', type : 'feature', value : 'auto', description: 'Build with png')
option('poppler', type : 'feature', value : 'auto', description: 'Build with poppler')
option('poppler-module', type : 'boolean', value : false, description: 'Build poppler as module')
option('quantizr', type : 'feature', value : 'auto', description: 'Build with quantizr')
option('rsvg', type : 'feature', value : 'auto', description: 'Build with rsvg')
option('spng', type : 'feature', value : 'auto', description: 'Build with spng')
option('tiff', type : 'feature', value : 'auto', description: 'Build with tiff')
option('webp', type : 'feature', value : 'auto', description: 'Build with libwebp')
option('zlib', type : 'feature', value : 'auto', description: 'Build with zlib')
# not external libraries, but have options to disable them, helps to reduce attack surface
option('nsgif', type : 'boolean', value : true, description: 'Build with nsgif')
option('ppm', type : 'boolean', value : true, description: 'Build with ppm')
option('analyze', type : 'boolean', value : true, description: 'Build with analyze')
option('radiance', type : 'boolean', value : true, description: 'Build with radiance')

View File

@ -0,0 +1,2 @@
de
en_GB

View File

@ -47,7 +47,7 @@ libvips/include/vips/transform.h
libvips/include/vips/type.h libvips/include/vips/type.h
libvips/include/vips/util.h libvips/include/vips/util.h
libvips/include/vips/vector.h libvips/include/vips/vector.h
libvips/include/vips/version.h libvips/include/vips/version.h.in
libvips/include/vips/video.h libvips/include/vips/video.h
libvips/include/vips/vips7compat.h libvips/include/vips/vips7compat.h
libvips/include/vips/vips.h libvips/include/vips/vips.h

3
po/meson.build Normal file
View File

@ -0,0 +1,3 @@
i18n.gettext(
gettext_domain
)

59
test/meson.build Normal file
View File

@ -0,0 +1,59 @@
variables_data = configuration_data()
variables_data.set('abs_top_srcdir', meson.project_source_root())
variables_data.set('abs_top_builddir', meson.project_build_root())
variables_data.set('PYTHON', pymod.find_installation().full_path())
variables_sh = configure_file(
input: 'variables.sh.in',
output: '@BASENAME@',
configuration: variables_data
)
script_tests = [
'cli',
'formats',
'seq',
'stall',
'threading',
]
foreach script_test : script_tests
test(script_test,
files('test_' + script_test + '.sh'),
workdir: meson.current_build_dir()
)
endforeach
test_connections = executable('test_connections',
'test_connections.c',
dependencies: libvips_dep,
)
test_connections_sh = configure_file(
input: 'test_connections.sh',
output: 'test_connections.sh',
copy: true,
)
test('connections',
test_connections_sh,
depends: test_connections,
workdir: meson.current_build_dir(),
)
test_descriptors = executable('test_descriptors',
'test_descriptors.c',
dependencies: libvips_dep,
)
test_descriptors_sh = configure_file(
input: 'test_descriptors.sh',
output: 'test_descriptors.sh',
copy: true,
)
test('descriptors',
test_descriptors_sh,
depends: test_descriptors,
workdir: meson.current_build_dir(),
)

42
tools/meson.build Normal file
View File

@ -0,0 +1,42 @@
tools = [
'vips',
'vipsedit',
'vipsthumbnail',
'vipsheader'
]
foreach tool : tools
executable(tool,
tool + '.c',
dependencies: libvips_dep,
install: true
)
endforeach
scripts = [
'light_correct.in',
'shrink_width.in',
'batch_image_convert.in',
'batch_rubber_sheet.in',
'batch_crop.in',
]
script_data = configuration_data()
script_data.set('prefix', get_option('prefix'))
foreach script : scripts
configure_file(
input: script,
output: '@BASENAME@',
install: true,
install_dir: get_option('prefix') / get_option('bindir'),
install_mode: 'rwxr-xr-x',
configuration: script_data
)
endforeach
install_data(
'vipsprofile',
'vips-8.13',
install_dir: get_option('prefix') / get_option('bindir'),
install_mode: 'rwxr-xr-x',
)