[libmediaart/wip/sam/meson: 2/2] Initial Meson build instructions for libmediaart



commit 2687ef55e494fc0cd863f074708745be6bac0bb6
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Tue May 23 17:13:18 2017 +0100

    Initial Meson build instructions for libmediaart
    
    Mostly complete, but not finished -- tests fail, .pc file isn't
    created, and possibly other stuff missing.

 config.h.meson.in                      |   13 +++++
 docs/meson.build                       |    1 +
 docs/reference/libmediaart/meson.build |    8 +++
 docs/reference/meson.build             |    1 +
 libmediaart/meson.build                |   59 ++++++++++++++++++++++
 meson.build                            |   85 ++++++++++++++++++++++++++++++++
 meson_options.txt                      |    2 +
 tests/meson.build                      |    6 ++
 8 files changed, 175 insertions(+), 0 deletions(-)
---
diff --git a/config.h.meson.in b/config.h.meson.in
new file mode 100644
index 0000000..c6e9db5
--- /dev/null
+++ b/config.h.meson.in
@@ -0,0 +1,13 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if we have GdkPixbuf */
+#mesondefine HAVE_GDKPIXBUF
+
+/* Define if we have Qt */
+#mesondefine HAVE_QT
+
+/* Define if we have Qt4 */
+#mesondefine HAVE_QT4
+
+/* Define if we have Qt5 */
+#mesondefine HAVE_QT5
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..ead14c4
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1 @@
+subdir('reference')
diff --git a/docs/reference/libmediaart/meson.build b/docs/reference/libmediaart/meson.build
new file mode 100644
index 0000000..77a575f
--- /dev/null
+++ b/docs/reference/libmediaart/meson.build
@@ -0,0 +1,8 @@
+version_xml = configure_file(input: 'version.xml.in',
+    output: 'version.xml',
+    configuration: conf)
+
+gnome.gtkdoc('libmediaart',
+    src_dir: 'libmediaart',
+    main_sgml: 'libmediaart.sgml',
+    install: true)
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..a6130a4
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1 @@
+subdir('libmediaart')
diff --git a/libmediaart/meson.build b/libmediaart/meson.build
new file mode 100644
index 0000000..c8022bf
--- /dev/null
+++ b/libmediaart/meson.build
@@ -0,0 +1,59 @@
+libmediaart_headers = [
+  'cache.h',
+  'extract.h',
+  'extractgeneric.h',
+  'storage.h'
+]
+
+libmediaart_sources = [
+  'cache.c',
+  'extract.c',
+  'storage.c'
+]
+
+if image_library_name == 'gdk-pixbuf'
+  libmediaart_sources += 'extractpixbuf.c'
+elif image_library_name == 'qt4' or image_library_name == 'qt5'
+  libmediaart_sources += 'extractqt.c'
+else
+  libmediaart_sources += 'extractdummy.c'
+endif
+
+marshal = gnome.genmarshal('marshal',
+  sources: 'marshal.list',
+  prefix: 'media_art_marshal')
+
+libmediaart_dependencies = [gio, gio_unix, glib, gobject, image_library]
+
+libmediaart = library(
+  'libmediaart-' + libmediaart_api_version,
+  libmediaart_sources, marshal[0], marshal[1],
+  c_args: ['-DLIBMEDIAART_COMPILATION'],
+  dependencies: libmediaart_dependencies,
+  include_directories: configinc,
+  install: true,
+)
+
+libmediaart_dep = declare_dependency(
+  link_with: libmediaart,
+  dependencies: libmediaart_dependencies,
+  include_directories: configinc
+)
+
+libmediaart_gir = gnome.generate_gir(libmediaart,
+  sources: libmediaart_sources + libmediaart_headers,
+  nsversion: libmediaart_api_version,
+  namespace: 'MediaArt',
+  identifier_prefix: 'MediaArt',
+  symbol_prefix: 'media_art',
+  includes: ['Gio-2.0', 'GObject-2.0'],
+  extra_args: [
+    '--c-include=libmediaart/mediaart.h',
+    '-D', 'LIBMEDIAART_COMPILATION',
+  ],
+  install: true
+)
+
+libmediaart_vapi = gnome.generate_vapi('libmediaart-' + libmediaart_api_version,
+  sources: libmediaart_gir[0],
+  packages: 'gio-2.0')
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..c99ef3b
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,85 @@
+project('libmediaart', 'c', version: '1.9.1')
+
+gnome = import('gnome')
+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: 'QtGui', required: false)
+qt5 = dependency('qt5', version: '> 5.0.0', modules: 'QtGui', required: false)
+
+##################################################################
+# Choose between backends (GdkPixbuf/Qt/etc)
+##################################################################
+
+image_library_name = ''
+
+if gdk_pixbuf.found()
+  if get_option('image_library') == 'auto' or get_option('backend') == 'gdk-pixbuf'
+    image_library = gdk_pixbuf
+    image_library_name = 'gdk-pixbuf'
+  endif
+elif get_option('image_library') == 'icu'
+  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('backend') == 'qt5'
+      image_library = qt5
+      image_library_name = 'qt5'
+    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('backend') == 'qt4'
+      image_library = qt4
+      image_library_name = 'qt4'
+    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')
+conf.set('HAVE_QT', image_library_name == 'qt4' or image_library_name == 'qt5')
+conf.set('HAVE_QT4', image_library_name == 'qt4')
+conf.set('HAVE_QT5', image_library_name == 'qt5')
+
+configure_file(input: 'config.h.meson.in',
+               output: 'config.h',
+               configuration: conf)
+
+configinc = include_directories('.')
+
+subdir('libmediaart')
+subdir('docs')
+subdir('tests')
+
+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))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..9fc8221
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('image_library', type: 'combo', choices: ['auto', 'gdk-pixbuf', 'qt4', 'qt5'],
+       description: 'Which image processing backend to use')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..d3648f8
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,6 @@
+mediaart_test = executable('mediaart-test',
+    'mediaarttest.c',
+    dependencies: libmediaart_dep,
+)
+
+test('mediaart', mediaart_test)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]