diff options
author | Corentin Noël <corentin@elementary.io> | 2018-07-10 16:05:58 +0200 |
---|---|---|
committer | Corentin Noël <corentin@elementary.io> | 2018-07-10 16:05:58 +0200 |
commit | 5c9f0a1c7ccdc77e1a1436d7689ada55b5d83a33 (patch) | |
tree | 13dfb610509157c61326faef21289c6d257e274c | |
parent | ddfc45fe1f9fc62c99d25c9cbdd4d42ad6e7d95c (diff) | |
download | libchamplain-wip/tintou/meson.tar.gz |
meson: add meson build systemwip/tintou/meson
-rw-r--r-- | champlain-gtk/meson.build | 91 | ||||
-rw-r--r-- | champlain/meson.build | 205 | ||||
-rw-r--r-- | demos/meson.build | 59 | ||||
-rw-r--r-- | docs/meson.build | 4 | ||||
-rw-r--r-- | docs/reference-gtk/meson.build | 26 | ||||
-rw-r--r-- | docs/reference/meson.build | 39 | ||||
-rw-r--r-- | meson.build | 76 | ||||
-rw-r--r-- | meson_options.txt | 4 |
8 files changed, 504 insertions, 0 deletions
diff --git a/champlain-gtk/meson.build b/champlain-gtk/meson.build new file mode 100644 index 0000000..da6d803 --- /dev/null +++ b/champlain-gtk/meson.build @@ -0,0 +1,91 @@ + +headers_subdir = meson.project_name() + '-gtk-' + api_version +headers_subdir_full = join_paths(headers_subdir, 'champlain-gtk') + +libchamplain_gtk_headers_public = files( + 'gtk-champlain-embed.h', + 'champlain-gtk.h' +) + +install_headers( + libchamplain_gtk_headers_public, + subdir: headers_subdir_full +) + +libchamplain_gtk_sources = files( + 'gtk-champlain-embed.c' +) + +champlain_gtk_marshal = gnome.genmarshal('champlain-gtk-marshal', + sources: 'champlain-gtk-marshal.list', + prefix: '_champlain_gtk_marshal', + install_header: true, + install_dir: join_paths(get_option('includedir'), headers_subdir_full) +) + +champlain_gtk_enum_types = gnome.mkenums_simple('champlain-gtk-enum-types', + sources: libchamplain_gtk_headers_public, + install_header: true, + install_dir: join_paths(get_option('includedir'), headers_subdir_full) +) + +libchamplain_gtk_library_sources = [ + libchamplain_gtk_headers_public, + libchamplain_gtk_sources, + champlain_gtk_marshal, + champlain_gtk_enum_types +] + +libchamplain_gtk_library = shared_library('champlain-gtk', + libchamplain_gtk_library_sources, + dependencies: libchamplain_gtk_deps, + include_directories: root_dir, + c_args: [ + '-DCHAMPLAIN_GTK_COMPILATION', + '-DG_LOG_DOMAIN="@0@"'.format (meson.project_name() + '-gtk') + ], + install: true +) + +libchamplain_gtk_pkg = ['clutter-gtk-1.0', 'champlain-' + api_version, 'gtk+-3.0'] +libchamplain_gtk_gir_includes = ['Clutter-1.0', 'Gtk-3.0', libchamplain_gir[0]] + +libchamplain_gtk_gir = gnome.generate_gir( + libchamplain_gtk_library, + sources: libchamplain_gtk_library_sources, + dependencies: libchamplain_gtk_deps, + header: 'champlain-gtk/champlain-gtk.h', + namespace: 'GtkChamplain', + nsversion: api_version, + symbol_prefix: 'gtk_champlain', + includes: libchamplain_gtk_gir_includes, + extra_args: [ '-DCHAMPLAIN_GTK_COMPILATION' ], + install: true +) + +libchamplain_gtk_pkg_name = 'champlain-gtk-' + api_version +if get_option('vala-support') + libchamplain_gtk_vapi = gnome.generate_vapi( + libchamplain_gtk_pkg_name, + sources: libchamplain_gtk_gir[0], + packages: libchamplain_gtk_pkg, + install: true + ) +endif + +libchamplain_gtk_dir = include_directories('.') +libchamplain_gtk_dep = declare_dependency( + link_with: libchamplain_gtk_library, + include_directories: [root_dir, libchamplain_gtk_dir], + dependencies: libchamplain_gtk_deps +) + +pkg.generate( + filebase: libchamplain_gtk_pkg_name, + name: 'libchamplain-gtk', + description: 'Gtk+ Widget wrapper for libchamplain', + version: meson.project_version(), + libraries: libchamplain_gtk_library, + requires: libchamplain_gtk_pkg, + subdirs: 'libchamplain-gtk-' + api_version +)
\ No newline at end of file diff --git a/champlain/meson.build b/champlain/meson.build new file mode 100644 index 0000000..58f5b6a --- /dev/null +++ b/champlain/meson.build @@ -0,0 +1,205 @@ + +version_data = configuration_data() +version_data.set('CHAMPLAIN_VERSION', meson.project_version()) +version_data.set('CHAMPLAIN_MAJOR_VERSION', major_version) +version_data.set('CHAMPLAIN_MINOR_VERSION', minor_version) +version_data.set('CHAMPLAIN_MICRO_VERSION', micro_version) + +headers_subdir = meson.project_name() + '-' + api_version +headers_subdir_full = join_paths(headers_subdir, 'champlain') + +champlain_version_h = configure_file( + input: 'champlain-version.h.in', + output: '@BASENAME@', + configuration: version_data, + install_dir: join_paths(get_option('includedir'), headers_subdir_full) +) + +feature_data = configuration_data() +if get_option('memphis') + feature_data.set('CHAMPLAIN_HAS_MEMPHIS', '1') +endif + +champlain_features_h = configure_file( + output: 'champlain-features.h', + configuration: feature_data, + install_dir: join_paths(get_option('includedir'), headers_subdir_full) +) + +libchamplain_headers_public = files( + 'champlain.h', + 'champlain-defines.h', + 'champlain-point.h', + 'champlain-custom-marker.h', + 'champlain-view.h', + 'champlain-layer.h', + 'champlain-marker-layer.h', + 'champlain-path-layer.h', + 'champlain-location.h', + 'champlain-coordinate.h', + 'champlain-marker.h', + 'champlain-label.h', + 'champlain-scale.h', + 'champlain-license.h', + 'champlain-tile.h', + 'champlain-map-source.h', + 'champlain-map-source-chain.h', + 'champlain-tile-source.h', + 'champlain-tile-cache.h', + 'champlain-memory-cache.h', + 'champlain-network-tile-source.h', + 'champlain-file-cache.h', + 'champlain-map-source-factory.h', + 'champlain-map-source-desc.h', + 'champlain-renderer.h', + 'champlain-image-renderer.h', + 'champlain-error-tile-renderer.h', + 'champlain-file-tile-source.h', + 'champlain-null-tile-source.h', + 'champlain-network-bbox-tile-source.h', + 'champlain-adjustment.h', + 'champlain-kinetic-scroll-view.h', + 'champlain-viewport.h', + 'champlain-bounding-box.h', + 'champlain-exportable.h' +) + +if get_option('memphis') + libchamplain_headers_public += files('champlain-memphis-renderer.h') +endif + +install_headers( + libchamplain_headers_public, + subdir: headers_subdir_full +) + +libchamplain_headers_private = files( + 'champlain-debug.h', + 'champlain-private.h' +) +libchamplain_headers_private += config_h + +libchamplain_sources = files( + 'champlain-debug.c', + 'champlain-view.c', + 'champlain-layer.c', + 'champlain-marker-layer.c', + 'champlain-path-layer.c', + 'champlain-location.c', + 'champlain-coordinate.c', + 'champlain-marker.c', + 'champlain-label.c', + 'champlain-scale.c', + 'champlain-license.c', + 'champlain-tile.c', + 'champlain-map-source.c', + 'champlain-map-source-chain.c', + 'champlain-tile-source.c', + 'champlain-tile-cache.c', + 'champlain-memory-cache.c', + 'champlain-network-tile-source.c', + 'champlain-file-cache.c', + 'champlain-map-source-factory.c', + 'champlain-map-source-desc.c', + 'champlain-point.c', + 'champlain-custom-marker.c', + 'champlain-renderer.c', + 'champlain-image-renderer.c', + 'champlain-error-tile-renderer.c', + 'champlain-file-tile-source.c', + 'champlain-null-tile-source.c', + 'champlain-network-bbox-tile-source.c', + 'champlain-adjustment.c', + 'champlain-kinetic-scroll-view.c', + 'champlain-viewport.c', + 'champlain-bounding-box.c', + 'champlain-exportable.c' +) + +if get_option('memphis') + libchamplain_sources += files('champlain-memphis-renderer.c') +endif + +champlain_marshal = gnome.genmarshal('champlain-marshal', + sources: 'champlain-marshal.list', + prefix: '_champlain_marshal', + install_header: true, + install_dir: join_paths(get_option('includedir'), headers_subdir_full) +) + +champlain_enum_types = gnome.mkenums_simple('champlain-enum-types', + sources: libchamplain_headers_public, + install_header: true, + install_dir: join_paths(get_option('includedir'), headers_subdir_full) +) + +libchamplain_library = shared_library('champlain', + libchamplain_headers_public, + champlain_version_h, + champlain_features_h, + libchamplain_headers_private, + libchamplain_sources, + champlain_marshal, + champlain_enum_types, + dependencies: libchamplain_deps, + include_directories: root_dir, + c_args: [ + '-DCHAMPLAIN_COMPILATION', + '-DG_LOG_DOMAIN="@0@"'.format (meson.project_name()) + ], + install: true +) + +libchamplain_pkg = ['clutter-1.0', 'cogl-pango-1.0', 'atk', 'pangocairo'] +libchamplain_gir_includes = ['GObject-2.0', 'Clutter-1.0'] + +if get_option('memphis') + libchamplain_gir_includes += 'Memphis-0.2' +endif + +libchamplain_gir = gnome.generate_gir( + libchamplain_library, + sources: [ + libchamplain_headers_public, + champlain_version_h, + champlain_enum_types, + champlain_marshal, + libchamplain_sources + ], + dependencies: libchamplain_deps, + header: 'champlain/champlain.h', + namespace: 'Champlain', + nsversion: api_version, + symbol_prefix: 'champlain', + includes: libchamplain_gir_includes, + extra_args: [ '-DCHAMPLAIN_COMPILATION' ], + install: true +) + +libchamplain_pkg_name = 'champlain-' + api_version +if get_option('vala-support') + libchamplain_vapi = gnome.generate_vapi( + libchamplain_pkg_name, + sources: libchamplain_gir[0], + packages: libchamplain_pkg, + install: true + ) +endif + +libchamplain_dir = include_directories('.') +libchamplain_dep = declare_dependency( + link_with: libchamplain_library, + include_directories: [ root_dir, libchamplain_dir ], + dependencies: libchamplain_deps +) + +pkg.generate( + filebase: libchamplain_pkg_name, + name: 'libchamplain', + description: 'Map View for Clutter', + version: meson.project_version(), + libraries: libchamplain_library, + requires: ['gobject-2.0', 'glib-2.0', 'clutter-1.0'], + requires_private: ['gdk-3.0', 'gio-2.0', 'cairo', 'sqlite3', 'libsoup-2.4'], + subdirs: 'libchamplain-' + api_version +) diff --git a/demos/meson.build b/demos/meson.build new file mode 100644 index 0000000..b1769e3 --- /dev/null +++ b/demos/meson.build @@ -0,0 +1,59 @@ +executable('minimal', + 'minimal.c', + dependencies: libchamplain_dep +) + +executable('launcher', + 'launcher.c', + 'markers.c', + dependencies: libchamplain_dep +) + +executable('animated-marker', + 'animated-marker.c', + dependencies: libchamplain_dep +) + +executable('polygons', + 'polygons.c', + dependencies: libchamplain_dep +) + +executable('url-marker', + 'url-marker.c', + dependencies: libchamplain_dep +) + +executable('create-destroy-test', + 'create-destroy-test.c', + dependencies: libchamplain_dep +) + +if get_option('gtk') + executable('minimal-gtk', + 'minimal-gtk.c', + dependencies: libchamplain_gtk_dep + ) + + executable('launcher-gtk', + 'launcher-gtk.c', + 'markers.c', + dependencies: libchamplain_gtk_dep + ) + + if get_option('memphis') + executable('local-rendering', + 'local-rendering.c', + dependencies: libchamplain_gtk_dep + ) + endif + + if get_option('vala-support') + add_languages('vala') + executable('launcher-vala', + 'launcher-vala.vala', + 'markers-vala.vala', + dependencies: [ libchamplain_gtk_dep, libchamplain_vapi ] + ) + endif +endif
\ No newline at end of file diff --git a/docs/meson.build b/docs/meson.build new file mode 100644 index 0000000..bf72a35 --- /dev/null +++ b/docs/meson.build @@ -0,0 +1,4 @@ +subdir('reference') +if get_option('gtk') + subdir('reference-gtk') +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..7f0e60f --- /dev/null +++ b/docs/reference-gtk/meson.build @@ -0,0 +1,26 @@ +glib_prefix = glib_dep.get_pkgconfig_variable('prefix') +glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') +clutter_prefix = clutter_dep.get_pkgconfig_variable('prefix') +clutter_docpath = join_paths(clutter_prefix, 'share', 'gtk-doc', 'html') +gtk_prefix = gtk_dep.get_pkgconfig_variable('prefix') +gtk_docpath = join_paths(gtk_prefix, 'share', 'gtk-doc', 'html') +docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html') + +gnome.gtkdoc( + 'libchamplain-gtk', + main_sgml: 'libchamplain-gtk-docs.sgml', + src_dir: libchamplain_gtk_dir, + dependencies: libchamplain_gtk_deps, + scan_args: ['--rebuild-types', '--deprecated-guards="GTK_DISABLE_DEPRECATED"'], + ignore_headers: 'champlain-gtk-marshal.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')), + '--extra-dir=@0@'.format(clutter_docpath), + '--extra-dir=@0@'.format(gtk_docpath), + '--extra-dir=@0@'.format(join_paths(meson.build_root(), 'docs', 'reference')), + ], + install: true +)
\ No newline at end of file diff --git a/docs/reference/meson.build b/docs/reference/meson.build new file mode 100644 index 0000000..7105309 --- /dev/null +++ b/docs/reference/meson.build @@ -0,0 +1,39 @@ +glib_prefix = glib_dep.get_pkgconfig_variable('prefix') +glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html') +clutter_prefix = clutter_dep.get_pkgconfig_variable('prefix') +clutter_docpath = join_paths(clutter_prefix, 'share', 'gtk-doc', 'html') +docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html') + +ignored_headers = [ + 'champlain-debug.h', + 'champlain-enum-types.h', + 'champlain-private.h', + 'champlain.h', + 'champlain-marshal.h', + 'champlain-defines.h', + 'champlain-features.h', + 'champlain-adjustment.h', + 'champlain-kinetic-scroll-view.h', + 'champlain-viewport.h' +] + +if get_option('memphis') + ignored_headers += 'champlain-memphis-renderer.h' +endif + +gnome.gtkdoc( + 'libchamplain', + main_sgml: 'libchamplain-docs.sgml', + src_dir: libchamplain_dir, + dependencies: libchamplain_deps, + scan_args: ['--rebuild-types', '--deprecated-guards="GTK_DISABLE_DEPRECATED"'], + ignore_headers: ignored_headers, + 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')), + '--extra-dir=@0@'.format(clutter_docpath), + ], + install: true +)
\ No newline at end of file diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..8378583 --- /dev/null +++ b/meson.build @@ -0,0 +1,76 @@ +project('libchamplain', 'c', + version: '0.12.17', + meson_version: '>=0.46.0' +) + +version_parts = meson.project_version().split('.') +major_version = version_parts[0] +minor_version = version_parts[1] +micro_version = version_parts[2] + +if minor_version.to_int().is_odd() + api_version = '.'.join(major_version, minor_version.to_int() + 1) +else + api_version = '.'.join([major_version, minor_version]) +endif + +gnome = import('gnome') +pkg = import('pkgconfig') + +gio_dep = dependency('gio-2.0', version: '>=2.16') +glib_dep = dependency('glib-2.0', version: '>=2.16') +gobject_dep = dependency('gobject-2.0', version: '>=2.10') +gdk_dep = dependency('gdk-3.0', version: '>=2.90') +clutter_dep = dependency('clutter-1.0', version: '>=1.12') +cairo_dep = dependency('cairo', version: '>=1.4') +sqlite3_dep = dependency('sqlite3', version: '>=3.0') +libsoup_dep = dependency('libsoup-2.4', version: '>=2.42') +m_dep = meson.get_compiler('c').find_library('m', required : false) + +libchamplain_deps = [ + gio_dep, + glib_dep, + gobject_dep, + gdk_dep, + clutter_dep, + cairo_dep, + sqlite3_dep, + libsoup_dep, + m_dep +] + +config_data = configuration_data() +config_h = configure_file( + output: 'config.h', + configuration: config_data +) + +if get_option('debug') + add_project_arguments('-DENABLE_DEBUG=1', language: 'c') +endif + +if get_option('memphis') + memphis_dep = dependency('memphis-0.2', version: '>=0.2.1') + add_project_arguments('-DCHAMPLAIN_HAS_MEMPHIS=1', language: 'c') + libchamplain_deps += memphis_dep +endif + +root_dir = include_directories('.') + +subdir('champlain') + +if get_option('gtk') + gtk_dep = dependency('gtk+-3.0', version: '>=2.90') + clutter_gtk_dep = dependency('clutter-gtk-1.0', version: '>=0.90') + + libchamplain_gtk_deps = [ + libchamplain_dep, + gtk_dep, + clutter_gtk_dep + ] + + subdir('champlain-gtk') +endif + +subdir('demos') +subdir('docs')
\ No newline at end of file diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..68ddeb0 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,4 @@ +option('memphis', type : 'boolean', description : 'Support of local rendering using libmemphis') +option('gtk', type : 'boolean', description : 'Compile Gtk+ embedded view') +option('vala-support', type : 'boolean', description : 'Build Vala bindings') +option('debug', type : 'boolean', value : false, description : 'Enable debug code')
\ No newline at end of file |