[libchamplain: 1/3] Port to meson build system



commit f5377d5fdcdb0a3bbc292335103a9fcd791e97ea
Author: Martin Blanchard <tchaik gmx com>
Date:   Tue May 29 23:13:34 2018 +0100

    Port to meson build system
    
    The meson build system focuses on speed an ease of use,
    which helps speeding up the software development.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=794324
    https://gitlab.gnome.org/GNOME/libchamplain/issues/37
    
    Closes #37

 champlain-gtk/meson.build      | 148 ++++++++++++++++++++++
 champlain/meson.build          | 273 +++++++++++++++++++++++++++++++++++++++++
 demos/icons/meson.build        |  14 +++
 demos/meson.build              |  70 +++++++++++
 docs/meson.build               |   6 +
 docs/reference-gtk/meson.build |  51 ++++++++
 docs/reference/meson.build     |  72 +++++++++++
 meson.build                    | 156 +++++++++++++++++++++++
 meson_options.txt              |  22 ++++
 9 files changed, 812 insertions(+)
---
diff --git a/champlain-gtk/meson.build b/champlain-gtk/meson.build
new file mode 100644
index 0000000..e777594
--- /dev/null
+++ b/champlain-gtk/meson.build
@@ -0,0 +1,148 @@
+libchamplain_gtk_public_h = [
+  'champlain-gtk.h',
+  'gtk-champlain-embed.h',
+]
+
+libchamplain_gtk_sources = [
+  'gtk-champlain-embed.c',
+]
+
+libchamplain_gtk_deps = [
+  glib_dep,
+  gobject_dep,
+  gtk_dep,
+  clutter_gtk_dep,
+  libchamplain_dep,
+]
+
+libchamplain_gtk_srcdir = include_directories('.')
+
+libchamplain_gtk_c_args = [
+  '-DHAVE_CONFIG_H',
+  '-DCHAMPLAIN_GTK_COMPILATION',
+  '-DG_LOG_DOMAIN="@0@"'.format(package_gtk_name),
+]
+
+libchamplain_gtk_link_args = [
+]
+
+libchamplain_gtk_marshals = gnome.genmarshal(
+  'champlain-gtk-marshal',
+  sources: 'champlain-gtk-marshal.list',
+  prefix: '_champlain_gtk_marshal',
+  install_header: true,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain-gtk',
+  )
+)
+
+libchamplain_gtk_enums = gnome.mkenums(
+  'champlain-gtk-enum-types',
+  sources: libchamplain_gtk_public_h,
+  h_template: 'champlain-gtk-enum-types.h.in',
+  c_template: 'champlain-gtk-enum-types.c.in',
+  install_header: true,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain-gtk',
+  )
+)
+
+libchamplain_gtk_marshals_h = libchamplain_gtk_marshals.get(1)
+libchamplain_gtk_enums_h = libchamplain_gtk_enums.get(1)
+
+libchamplain_gtk_sources += [
+  libchamplain_gtk_marshals,
+  libchamplain_gtk_enums,
+]
+
+install_headers(
+  libchamplain_gtk_public_h,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain-gtk',
+  )
+)
+
+libchamplain_gtk_sha = library(
+  package_gtk_string,
+  libchamplain_gtk_sources,
+  version: lib_version,
+  include_directories: rootdir,
+  dependencies: libchamplain_gtk_deps,
+  c_args: libchamplain_gtk_c_args,
+  link_args: libchamplain_gtk_link_args,
+  install: true,
+  install_dir: libdir,
+)
+
+libchamplain_gtk_dep_sources = [
+  libchamplain_gtk_enums_h,
+  libchamplain_gtk_marshals_h,
+]
+
+if generate_gir == true
+  libchamplain_gtk_gir_includes = [
+    'GObject-2.0',
+    'Clutter-1.0',
+    'Gtk-3.0',
+    libchamplain_gir.get(0),
+  ]
+
+  libchamplain_gtk_gir = gnome.generate_gir(
+    libchamplain_gtk_sha,
+    sources: libchamplain_gtk_sources + libchamplain_gtk_public_h,
+    nsversion: api_version,
+    namespace: 'GtkChamplain',
+    symbol_prefix: 'gtk_champlain',
+    identifier_prefix: 'GtkChamplain',
+    header: 'champlain-gtk/champlain-gtk.h',
+    export_packages: [package_gtk_string],
+    includes: ['Clutter-1.0', 'Gtk-3.0', libchamplain_gir.get(0)],
+    link_with: libchamplain_gtk_sha,
+    install: true,
+    install_dir_gir: girdir,
+    install_dir_typelib: typelibdir,
+    extra_args: [
+      '-DCHAMPLAIN_GTK_COMPILATION',
+    ]
+  )
+
+  libchamplain_gtk_dep_sources += [
+    libchamplain_gtk_gir,
+  ]
+
+  if generate_vapi == true
+    libchamplain_gtk_vapi_packages = [
+      'clutter-gtk-1.0',
+      'cogl-pango-1.0',
+      'gtk+-3.0',
+      'atk',
+      'pangocairo',
+      libchamplain_vapi,
+    ]
+
+    libchamplain_gtk_vapi = gnome.generate_vapi(
+      package_gtk_string,
+      sources: libchamplain_gtk_gir.get(0),
+      packages: libchamplain_gtk_vapi_packages,
+      install: true,
+      install_dir: vapidir,
+    )
+  endif
+endif
+
+libchamplain_gtk_dep = declare_dependency(
+  link_with: libchamplain_gtk_sha,
+  include_directories: rootdir,
+  dependencies: libchamplain_gtk_deps,
+  sources: libchamplain_gtk_dep_sources,
+)
+
+libchamplain_gtk_pc = pkg.generate(
+  libchamplain_gtk_sha,
+  description: 'Gtk+ Widget wrapper for libchamplain',
+  subdirs: package_string,
+  install_dir: pkgconfigdir,
+)
diff --git a/champlain/meson.build b/champlain/meson.build
new file mode 100644
index 0000000..815908b
--- /dev/null
+++ b/champlain/meson.build
@@ -0,0 +1,273 @@
+libchamplain_public_h = [
+  'champlain-adjustment.h',
+  'champlain-bounding-box.h',
+  'champlain-coordinate.h',
+  'champlain-custom-marker.h',
+  'champlain-defines.h',
+  'champlain-error-tile-renderer.h',
+  'champlain-exportable.h',
+  'champlain-file-cache.h',
+  'champlain-file-tile-source.h',
+  'champlain-image-renderer.h',
+  'champlain-kinetic-scroll-view.h',
+  'champlain-label.h',
+  'champlain-layer.h',
+  'champlain-license.h',
+  'champlain-location.h',
+  'champlain-map-source-chain.h',
+  'champlain-map-source-desc.h',
+  'champlain-map-source-factory.h',
+  'champlain-map-source.h',
+  'champlain-marker-layer.h',
+  'champlain-marker.h',
+  'champlain-memory-cache.h',
+  'champlain-network-bbox-tile-source.h',
+  'champlain-network-tile-source.h',
+  'champlain-null-tile-source.h',
+  'champlain-path-layer.h',
+  'champlain-point.h',
+  'champlain-renderer.h',
+  'champlain-scale.h',
+  'champlain-tile-cache.h',
+  'champlain-tile-source.h',
+  'champlain-tile.h',
+  'champlain-view.h',
+  'champlain-viewport.h',
+  'champlain.h',
+]
+
+if build_with_memphis == true
+  libchamplain_public_h += [
+    'champlain-memphis-renderer.h',
+  ]
+endif
+
+libchamplain_sources = [
+  'champlain-adjustment.c',
+  'champlain-bounding-box.c',
+  'champlain-coordinate.c',
+  'champlain-custom-marker.c',
+  'champlain-debug.c',
+  'champlain-error-tile-renderer.c',
+  'champlain-exportable.c',
+  'champlain-file-cache.c',
+  'champlain-file-tile-source.c',
+  'champlain-image-renderer.c',
+  'champlain-kinetic-scroll-view.c',
+  'champlain-label.c',
+  'champlain-layer.c',
+  'champlain-license.c',
+  'champlain-location.c',
+  'champlain-map-source-chain.c',
+  'champlain-map-source-desc.c',
+  'champlain-map-source-factory.c',
+  'champlain-map-source.c',
+  'champlain-marker-layer.c',
+  'champlain-marker.c',
+  'champlain-memory-cache.c',
+  'champlain-network-bbox-tile-source.c',
+  'champlain-network-tile-source.c',
+  'champlain-null-tile-source.c',
+  'champlain-path-layer.c',
+  'champlain-point.c',
+  'champlain-renderer.c',
+  'champlain-scale.c',
+  'champlain-tile-cache.c',
+  'champlain-tile-source.c',
+  'champlain-tile.c',
+  'champlain-view.c',
+  'champlain-viewport.c',
+]
+
+if build_with_memphis == true
+  libchamplain_sources += [
+    'champlain-memphis-renderer.c',
+  ]
+endif
+
+libchamplain_deps = [
+  libm_dep,
+  glib_dep,
+  gobject_dep,
+  gio_dep,
+  clutter_dep,
+  cairo_dep,
+  sqlite_dep,
+  libsoup_dep,
+]
+
+if build_with_memphis == true
+  libchamplain_deps += memphis_dep
+endif
+
+libchamplain_srcdir = include_directories('.')
+
+libchamplain_c_args = [
+  '-DHAVE_CONFIG_H',
+  '-DCHAMPLAIN_COMPILATION',
+  '-DG_LOG_DOMAIN="@0@"'.format(package_name),
+]
+
+libchamplain_link_args = [
+]
+
+features_h = configuration_data()
+if build_with_memphis == true
+  features_h.set('CHAMPLAIN_HAS_MEMPHIS', '1')
+endif
+
+libchamplain_features_h = configure_file(
+  output: 'champlain-features.h',
+  configuration: features_h,
+  install: true,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain',
+  )
+)
+
+version_h = configuration_data()
+version_h.set('CHAMPLAIN_MAJOR_VERSION', version_major)
+version_h.set('CHAMPLAIN_MINOR_VERSION', version_minor)
+version_h.set('CHAMPLAIN_MICRO_VERSION', version_micro)
+version_h.set('CHAMPLAIN_VERSION', version)
+
+libchamplain_version_h = configure_file(
+  input: 'champlain-version.h.in',
+  output: 'champlain-version.h',
+  configuration: version_h,
+  install: true,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain',
+  )
+)
+
+libchamplain_public_h += [
+  libchamplain_features_h,
+  libchamplain_version_h,
+]
+
+libchamplain_marshals = gnome.genmarshal(
+  'champlain-marshal',
+  sources: 'champlain-marshal.list',
+  prefix: '_champlain_marshal',
+  install_header: true,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain',
+  )
+)
+
+libchamplain_enums = gnome.mkenums(
+  'champlain-enum-types',
+  sources: libchamplain_public_h,
+  h_template: 'champlain-enum-types.h.in',
+  c_template: 'champlain-enum-types.c.in',
+  install_header: true,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain',
+  )
+)
+
+libchamplain_marshals_h = libchamplain_marshals.get(1)
+libchamplain_enums_h = libchamplain_enums.get(1)
+
+libchamplain_sources += [
+  libchamplain_marshals,
+  libchamplain_enums,
+]
+
+install_headers(
+  libchamplain_public_h,
+  install_dir: join_paths(
+    pkgincludedir,
+    'champlain',
+  )
+)
+
+libchamplain_sha = library(
+  package_string,
+  libchamplain_sources,
+  version: lib_version,
+  include_directories: rootdir,
+  dependencies: libchamplain_deps,
+  c_args: libchamplain_c_args,
+  link_args: libchamplain_link_args,
+  install: true,
+  install_dir: libdir,
+)
+
+libchamplain_dep_sources = [
+  libchamplain_enums_h,
+  libchamplain_features_h,
+  libchamplain_marshals_h,
+  libchamplain_version_h,
+]
+
+if generate_gir == true
+  libchamplain_gir_includes = [
+    'GObject-2.0',
+    'Clutter-1.0',
+  ]
+
+  if build_with_memphis == true
+    libchamplain_gir_includes += 'Memphis-0.2'
+  endif
+
+  libchamplain_gir = gnome.generate_gir(
+    libchamplain_sha,
+    sources: libchamplain_sources + libchamplain_public_h,
+    nsversion: api_version,
+    namespace: 'Champlain',
+    symbol_prefix: 'champlain',
+    identifier_prefix: 'Champlain',
+    header: 'champlain/champlain.h',
+    export_packages: [package_string],
+    includes: libchamplain_gir_includes,
+    link_with: libchamplain_sha,
+    install: true,
+    install_dir_gir: girdir,
+    install_dir_typelib: typelibdir,
+    extra_args: [
+      '-DCHAMPLAIN_COMPILATION',
+    ]
+  )
+
+  libchamplain_dep_sources += [
+    libchamplain_gir,
+  ]
+
+  if generate_vapi == true
+    libchamplain_vapi_packages = [
+      'clutter-1.0',
+      'cogl-pango-1.0',
+      'atk',
+      'pangocairo',
+    ]
+
+    libchamplain_vapi = gnome.generate_vapi(
+      package_string,
+      sources: libchamplain_gir.get(0),
+      packages: libchamplain_vapi_packages,
+      install: true,
+      install_dir: vapidir,
+    )
+  endif
+endif
+
+libchamplain_dep = declare_dependency(
+  link_with: libchamplain_sha,
+  include_directories: rootdir,
+  dependencies: libchamplain_deps,
+  sources: libchamplain_dep_sources,
+)
+
+libchamplain_pc = pkg.generate(
+  libchamplain_sha,
+  name: package_string,
+  description: 'Map View for Clutter',
+  subdirs: package_string,
+  install_dir: pkgconfigdir,
+)
diff --git a/demos/icons/meson.build b/demos/icons/meson.build
new file mode 100644
index 0000000..a59921b
--- /dev/null
+++ b/demos/icons/meson.build
@@ -0,0 +1,14 @@
+libchamplain_demo_data = [
+  'emblem-favorite.png',
+  'emblem-generic.png',
+  'emblem-important.png',
+  'emblem-new.png',
+]
+
+custom_target(
+  'libchamplain-demo-data',
+  input: libchamplain_demo_data,
+  output: libchamplain_demo_data,
+  command: ['cp', '@INPUT@', '@OUTDIR@'],
+  build_by_default: true,
+)
\ No newline at end of file
diff --git a/demos/meson.build b/demos/meson.build
new file mode 100644
index 0000000..e8bcff1
--- /dev/null
+++ b/demos/meson.build
@@ -0,0 +1,70 @@
+libchamplain_demos = [
+  ['minimal', 'minimal.c'],
+  ['launcher', ['launcher.c', 'markers.c']],
+  ['animated-marker', 'animated-marker.c'],
+  ['polygons', 'polygons.c'],
+  ['url-marker', 'url-marker.c'],
+  ['create_destroy_test', 'create-destroy-test.c'],
+]
+
+foreach demo: libchamplain_demos
+  demo_name = demo.get(0)
+  demo_sources = demo.get(1)
+
+  executable(
+    demo_name,
+    demo_sources,
+    install: false,
+    dependencies: [
+      libchamplain_dep,
+    ]
+  )
+endforeach
+
+subdir('icons')
+
+if build_gtk_widgetry == true
+  libchamplain_gtk_demos = [
+    ['minimal-gtk', 'minimal-gtk.c'],
+    ['launcher-gtk', ['launcher-gtk.c', 'markers.c']],
+  ]
+
+  foreach demo: libchamplain_gtk_demos
+    demo_name = demo.get(0)
+    demo_sources = demo.get(1)
+
+    executable(
+      demo_name,
+      demo_sources,
+      install: false,
+      dependencies: [
+        libchamplain_dep,
+        libchamplain_gtk_dep,
+      ]
+    )
+  endforeach
+endif
+
+if generate_vapi == true
+  libchamplain_vala_demos = [
+    ['launcher-vala', ['launcher-vala.vala', 'markers-vala.vala']],
+  ]
+
+  add_languages('vala')
+
+  foreach demo: libchamplain_vala_demos
+    demo_name = demo.get(0)
+    demo_sources = demo.get(1)
+
+    executable(
+      demo_name,
+      demo_sources,
+      install: false,
+      dependencies: [
+        libchamplain_dep,
+        libchamplain_gtk_dep,
+        libchamplain_vapi,
+      ]
+    )
+  endforeach
+endif
\ No newline at end of file
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644
index 0000000..d7ecf41
--- /dev/null
+++ b/docs/meson.build
@@ -0,0 +1,6 @@
+if build_gtk_doc == true
+  subdir('reference')
+  if build_gtk_widgetry == true
+    subdir('reference-gtk')
+  endif
+endif
\ No newline at end of file
diff --git a/docs/reference-gtk/meson.build b/docs/reference-gtk/meson.build
new file mode 100644
index 0000000..45dc105
--- /dev/null
+++ b/docs/reference-gtk/meson.build
@@ -0,0 +1,51 @@
+gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix')
+gtk_docpath = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html', 'gtk3')
+
+libchamplain_gtk_reference_ignored_h = [
+  'champlain-gtk-marshal.h',
+  'champlain-gtk.h',
+]
+
+version_xml = configuration_data()
+version_xml.set('PACKAGE_VERSION', version)
+
+configure_file(
+  input: 'version.xml.in',
+  output: 'version.xml',
+  configuration: version_xml,
+  install: false,
+)
+
+libchamplain_gtk_reference_scan_args = [
+  '--rebuild-types',
+  '--deprecated-guards=GTK_DISABLE_DEPRECATED',
+  '--ignore-headers=' + ' '.join(libchamplain_gtk_reference_ignored_h),
+]
+
+libchamplain_gtk_reference_mkdb_args = [
+  '--output-format=xml',
+  '--name-space=gtk_champlain',
+]
+
+libchamplain_gtk_reference_fixxref_args = [
+  '--html-dir=@0@'.format(join_paths(gtkdocdir, 'html', package_gtk_string)),
+  '--extra-dir=@0@'.format(gtk_docpath),
+  '--extra-dir=@0@'.format(join_paths(gtkdocdir, 'html', package_string)),
+]
+
+gnome.gtkdoc(
+  package_gtk_string,
+  main_sgml: 'libchamplain-gtk-docs.sgml',
+  gobject_typesfile: files('libchamplain-gtk.types'),
+  src_dir: libchamplain_gtk_srcdir,
+  dependencies: libchamplain_gtk_dep,
+  scan_args: libchamplain_gtk_reference_scan_args,
+  mkdb_args: libchamplain_gtk_reference_mkdb_args,
+  fixxref_args: libchamplain_gtk_reference_fixxref_args,
+  install: true,
+  install_dir: join_paths(
+    gtkdocdir,
+    'html',
+    package_gtk_string,
+  )
+)
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..f4c83d2
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,72 @@
+glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
+glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html', 'glib')
+
+gobject_prefix = gobject_dep.get_pkgconfig_variable('prefix')
+gobject_docpath = join_paths(gobject_prefix, 'share', 'gtk-doc', 'html', 'gobject')
+
+clutter_prefix = clutter_dep.get_pkgconfig_variable('prefix')
+clutter_docpath = join_paths(clutter_prefix, 'share', 'gtk-doc', 'html', 'clutter')
+
+libchamplain_reference_ignored_h = [
+  'champlain-adjustment.h',
+  'champlain-debug.h',
+  'champlain-defines.h',
+  'champlain-enum-types.h',
+  'champlain-features.h',
+  'champlain-kinetic-scroll-view.h',
+  'champlain-marshal.h',
+  'champlain-private.h',
+  'champlain-viewport.h',
+  'champlain.h',
+]
+
+if build_with_memphis == false
+  libchamplain_reference_ignored_h += [
+    'champlain-memphis-renderer.h',
+  ]
+endif
+
+version_xml = configuration_data()
+version_xml.set('PACKAGE_VERSION', version)
+
+configure_file(
+  input: 'version.xml.in',
+  output: 'version.xml',
+  configuration: version_xml,
+  install: false,
+)
+
+libchamplain_reference_scan_args = [
+  '--rebuild-types',
+  '--deprecated-guards=GTK_DISABLE_DEPRECATED',
+  '--ignore-headers=' + ' '.join(libchamplain_reference_ignored_h),
+]
+
+libchamplain_reference_mkdb_args = [
+  '--output-format=xml',
+  '--name-space=champlain',
+]
+
+libchamplain_reference_fixxref_args = [
+  '--html-dir=@0@'.format(join_paths(gtkdocdir, 'html', package_string)),
+  '--extra-dir=@0@'.format(glib_docpath),
+  '--extra-dir=@0@'.format(gobject_docpath),
+  '--extra-dir=@0@'.format(clutter_docpath),
+]
+
+gnome.gtkdoc(
+  package_string,
+  main_sgml: 'libchamplain-docs.sgml',
+  gobject_typesfile: files('libchamplain.types'),
+  src_dir: libchamplain_srcdir,
+  dependencies: libchamplain_dep,
+  scan_args: libchamplain_reference_scan_args,
+  mkdb_args: libchamplain_reference_mkdb_args,
+  fixxref_args: libchamplain_reference_fixxref_args,
+  install: true,
+  install_dir: join_paths(
+    gtkdocdir,
+    'html',
+    package_string,
+  )
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..730e8d2
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,156 @@
+project(
+  'libchamplain', 'c',
+  version: '0.12.17',
+  license: 'LGPLv2.1+',
+  meson_version: '>= 0.49.0',
+  default_options: [
+    'buildtype=debugoptimized',
+  ]
+)
+
+gnome = import('gnome')
+pkg = import('pkgconfig')
+
+# Versioning
+version = meson.project_version()
+version_arr = version.split('.')
+version_major = version_arr[0]
+version_minor = version_arr[1]
+version_micro = version_arr[2]
+
+if version_minor.to_int().is_odd()
+  api_version = '.'.join([version_major, version_minor + 1])
+else
+  api_version = '.'.join([version_major, version_minor])
+endif
+
+lib_version = '0.10.0'
+
+package_name = meson.project_name().strip('lib')
+package_string = '@0@-@1@'.format(package_name, api_version)
+package_gtk_name = '@0@-gtk'.format(package_name)
+package_gtk_string = '@0@-@1@'.format(package_gtk_name, api_version)
+
+# Paths
+rootdir = include_directories('.')
+
+srcdir = meson.current_source_dir()
+builddir = meson.current_build_dir()
+
+prefix = get_option('prefix')
+
+includedir = join_paths(prefix, get_option('includedir'))
+libdir = join_paths(prefix, get_option('libdir'))
+datadir = join_paths(prefix, get_option('datadir'))
+pkgincludedir = join_paths(includedir, package_string)
+typelibdir = join_paths(libdir, 'girepository-1.0')
+pkgconfigdir = join_paths(libdir, 'pkgconfig')
+
+girdir = join_paths(datadir, 'gir-1.0')
+gtkdocdir = join_paths(datadir, 'gtk-doc')
+vapidir = join_paths(datadir, 'vala', 'vapi')
+
+# Dependencies
+cc = meson.get_compiler('c')
+
+libm_dep = cc.find_library('m', required: true)
+
+glib_req = '>= 2.16.0'
+gtk_req = '>= 2.90.0'
+clutter_req = '>= 1.24'
+clutter_gtk_req = '>= 0.90'
+cairo_req = '>= 1.4'
+sqlite_req = '>= 3.0'
+libsoup_req = '>= 2.42'
+memphis_req = '>=0.2.1'
+introspection_req = '>= 0.6.3'
+vala_req = '>= 0.11.0'
+gtk_doc_req = '>= 1.9'
+
+glib_dep = dependency('glib-2.0', version: glib_req)
+gobject_dep = dependency('gobject-2.0', version: glib_req)
+gio_dep = dependency('gio-2.0', version: glib_req)
+clutter_dep = dependency('clutter-1.0', version: clutter_req)
+cairo_dep = dependency('cairo', version: cairo_req)
+sqlite_dep = dependency('sqlite3', version: sqlite_req)
+libsoup_dep = dependency('libsoup-2.4', version: libsoup_req)
+
+gtk_dep = dependency('gtk+-3.0', version: gtk_req, required: false)
+clutter_gtk_dep = dependency('clutter-gtk-1.0', version: clutter_gtk_req, required: false)
+memphis_dep = dependency('memphis-0.2', version: memphis_req, required: false)
+
+introspection_dep = dependency('gobject-introspection-1.0', version: introspection_req, required: false)
+vapigen_dep = dependency('vapigen', version: vala_req, required: false)
+gtk_doc_dep = dependency('gtk-doc', version: gtk_doc_req, required: false)
+
+# Configurations
+config_h = configuration_data()
+config_h.set_quoted('VERSION', version)
+
+configure_file(
+  output: 'config.h',
+  configuration: config_h
+)
+
+# Options
+build_demos = get_option('demos')
+
+build_gtk_doc = get_option('gtk_doc')
+if build_gtk_doc and not gtk_doc_dep.found()
+  build_gtk_doc = false
+endif
+
+build_gtk_widgetry = get_option('widgetry')
+if build_gtk_widgetry and not gtk_doc_dep.found()
+  build_gtk_widgetry = false
+elif build_gtk_widgetry and not clutter_gtk_dep.found()
+  build_gtk_widgetry = false
+endif
+
+generate_gir = get_option('introspection')
+if generate_gir and not introspection_dep.found()
+  generate_gir = false
+endif
+
+build_with_memphis = get_option('memphis')
+if build_with_memphis and not memphis_dep.found()
+  build_with_memphis = false
+endif
+
+generate_vapi = generate_gir and get_option('vapi')
+if generate_vapi and not vapigen_dep.found()
+  generate_vapi = false
+endif
+
+subdir('champlain')
+if build_gtk_widgetry == true
+  subdir('champlain-gtk')
+endif
+
+subdir('docs')
+
+if build_demos == true
+  subdir('demos')
+endif
+
+summary = [
+  '',
+  '------',
+  'libchamplain @0@ (@1@)'.format(version, api_version),
+  '',
+  '             Demos: @0@'.format(build_demos),
+  '     Documentation: @0@'.format(build_gtk_doc),
+  '     GTK+ widgetry: @0@'.format(build_gtk_widgetry),
+  '     Introspection: @0@'.format(generate_gir),
+  '  Memphis renderer: @0@'.format(build_with_memphis),
+  '          Vala API: @0@'.format(generate_vapi),
+  '',
+  'Directories:',
+  '           prefix: @0@'.format(prefix),
+  '       includedir: @0@'.format(includedir),
+  '           libdir: @0@'.format(libdir),
+  '          datadir: @0@'.format(datadir),
+  '------',
+]
+
+message('\n'.join(summary))
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..8713d62
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,22 @@
+option('memphis',
+       type: 'boolean', value: false,
+       description: 'Enable Memphis support (requires libmemphis)')
+
+option('introspection',
+       type: 'boolean', value: true,
+       description: 'Generate introspection data (requires gobject-introspection)')
+option('vapi',
+       type: 'boolean', value: true,
+       description: 'Generate vapi data (requires vapigen)')
+
+option('widgetry',
+       type: 'boolean', value: true,
+       description: 'Build GTK+ widgetry')
+
+option('gtk_doc',
+       type: 'boolean', value: false,
+       description: 'Build reference manual (requires gtk-doc)')
+
+option('demos',
+       type: 'boolean', value: false,
+       description: 'Build demonstration programs')


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