summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-05-23 17:13:18 +0100
committerCarlos Garnacho <carlosg@gnome.org>2017-08-09 17:12:02 +0200
commit4f31ee048268b03eda4c8bd631bd44bebe1ccfcb (patch)
treed43a320d31a0f57d3fb4e2382bd9d4c79b366320 /meson.build
parent213a8c015b0d233dc32ca3b2699da71c706958a7 (diff)
downloadlibmediaart-4f31ee048268b03eda4c8bd631bd44bebe1ccfcb.tar.gz
Meson build instructions for libmediaart
These are hopefully complete already. I have compared an Autotools-built and a Meson-built install of libmediaart and found only the following differences: * libmediaart-2.0.la isn't generated by Meson * External references in the gtk-doc documentation are relative with Meson and absolute with Autotools * Some changes in generated .vapi file and .pc file https://bugzilla.gnome.org/show_bug.cgi?id=783562
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build127
1 files changed, 127 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..8bdd4b5
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,127 @@
+project('libmediaart', 'c', 'cpp',
+ version: '1.9.1',
+ default_options: [ 'warning_level=1' ])
+
+gnome = import('gnome')
+pkgconfig = import('pkgconfig')
+
+cc = meson.get_compiler('c')
+
+# This is the X.Y used in -lliblibmediaart-FOO-X.Y
+libmediaart_api_version = '2.0'
+
+glib_required = '2.38.0'
+
+gdk_pixbuf = dependency('gdk-pixbuf-2.0', version: '> 2.12.0', required: false)
+glib = dependency('glib-2.0', version: '> ' + glib_required)
+gio = dependency('gio-2.0', version: '> ' + glib_required)
+gio_unix = dependency('gio-unix-2.0', version: '> ' + glib_required)
+gobject = dependency('gobject-2.0', version: '> ' + glib_required)
+qt4 = dependency('qt4', version: '> 4.7.1', modules: 'Gui', required: false)
+qt5 = dependency('qt5', version: '> 5.0.0', modules: 'Gui', required: false)
+
+##################################################################
+# Choose between backends (GdkPixbuf/Qt/etc)
+##################################################################
+
+image_library_name = ''
+
+if gdk_pixbuf.found()
+ if get_option('image_library') == 'auto' or get_option('image_library') == 'gdk-pixbuf'
+ image_library = gdk_pixbuf
+ image_library_name = 'gdk-pixbuf-2.0'
+ endif
+elif get_option('image_library') == 'gdk-pixbuf'
+ error('gdk-pixbuf backend explicitly requested, but gdk-pixbuf library was not found')
+endif
+
+if image_library_name == ''
+ if qt5.found()
+ if get_option('image_library') == 'auto' or get_option('image_library') == 'qt5'
+ image_library = qt5
+ image_library_name = 'Qt5Gui'
+ endif
+ elif get_option('image_library') == 'qt5'
+ error('qt5 explicitly requested, but not found')
+ endif
+endif
+
+if image_library_name == ''
+ if qt4.found()
+ if get_option('image_library') == 'auto' or get_option('image_library') == 'qt4'
+ image_library = qt4
+ image_library_name = 'QtGui'
+ endif
+ elif get_option('image_library') == 'qt4'
+ error('qt4 explicitly requested, but not found')
+ endif
+endif
+
+if image_library_name == ''
+ error('No usable image processing backends were found.')
+endif
+
+conf = configuration_data()
+
+conf.set('HAVE_GDKPIXBUF', (image_library_name == 'gdk-pixbuf-2.0'),
+ description: 'Define if GdkPixbuf is available')
+conf.set('HAVE_QT', (image_library_name == 'QtGui' or image_library_name == 'Qt5Gui'),
+ description: 'Define if QtGui is available')
+conf.set('HAVE_QT4', (image_library_name == 'QtGui'),
+ description: 'Define if Qt4 is available')
+conf.set('HAVE_QT5', (image_library_name == 'Qt5Gui'),
+ description: 'Define Qt5 is available')
+conf.set('LIBMEDIAART_VERSION', meson.project_version(),
+ description: 'Libmediaart version')
+
+visibility_cflags = []
+libmediaart_cflags = [
+ '-DLIBMEDIAART_COMPILATION'
+]
+
+# Symbol visibility.
+if get_option('default_library') != 'static'
+ if host_machine.system() == 'windows'
+ conf.set('DLL_EXPORT', true,
+ description: 'Define if DLL_EXPORT is available')
+ conf.set('_LIBMEDIAART_EXTERN', '__declspec(dllexport) extern',
+ description: 'Define for publicly visible symbols')
+ if cc.get_id() != 'msvc'
+ visibility_cflags = ['-fvisibility=hidden']
+ endif
+ else
+ conf.set('_LIBMEDIAART_EXTERN', '__attribute__((visibility("default"))) extern',
+ description: 'Define for publicly visible symbols')
+ visibility_cflags = ['-fvisibility=hidden']
+ endif
+endif
+
+configure_file(output: 'config.h',
+ configuration: conf)
+
+root_inc = include_directories('.')
+
+subdir('libmediaart')
+subdir('docs/reference/libmediaart')
+subdir('tests')
+
+pkgconfig.generate(
+ libraries: libmediaart,
+ name: 'libmediaart- ' + libmediaart_api_version,
+ version: meson.project_version(),
+ description: 'libmediaart - Media art extraction and cache management library',
+ filebase: 'libmediaart-' + libmediaart_api_version,
+ subdirs: 'libmediaart-' + libmediaart_api_version,
+ requires: 'glib-2.0',
+ requires_private: image_library_name,
+ libraries_private: ['-lz', '-lm'])
+
+summary = [
+ '\nBuild Configuration:',
+ ' Prefix: ' + get_option('prefix'),
+ ' Source code location: ' + meson.source_root(),
+ ' Compiler: ' + cc.get_id(),
+ ' Image processing library: ' + image_library_name,
+]
+
+message('\n'.join(summary))