meson.build 3.36 KB
Newer Older
Zeeshan Ali's avatar
Zeeshan Ali committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
sources = [ 'gclue-helpers.c', 'gclue-simple.c' ]
header_dir = 'libgeoclue-' + gclue_api_version

# FIXME: meson 0.46 doesn't seem to be actually installing the headers
# generated by gnome.gdbus_codegen:
#
# https://github.com/mesonbuild/meson/pull/3487

# Client interface
sources += gnome.gdbus_codegen('gclue-client',
                               '../src/org.freedesktop.GeoClue2.Client.xml',
                               interface_prefix: 'org.freedesktop.GeoClue2.',
                               namespace: 'GClue',
                               install_header: true,
                               install_dir: header_dir)
# Location interface
sources += gnome.gdbus_codegen('gclue-location',
                               '../src/org.freedesktop.GeoClue2.Location.xml',
                               interface_prefix: 'org.freedesktop.GeoClue2.',
                               namespace: 'GClue',
                               install_header: true,
                               install_dir: header_dir)
# Manager interface
sources += gnome.gdbus_codegen('gclue-manager',
                               '../src/org.freedesktop.GeoClue2.Manager.xml',
                               interface_prefix: 'org.freedesktop.GeoClue2.',
                               namespace: 'GClue',
                               install_header: true,
                               install_dir: header_dir)

headers = [ 'geoclue.h', 'gclue-helpers.h', 'gclue-simple.h' ]
install_headers(headers, subdir: header_dir)

c_args = [ '-DG_LOG_DOMAIN="Geoclue"', '-Werror' ]
include_dirs = [ libgeoclue_public_api_inc, include_directories('.') ]
link_with = [ libgeoclue_public_api ]
libgeoclue = library('geoclue-2',
                     sources,
                     include_directories: include_dirs,
                     dependencies: base_deps,
                     link_with: link_with,
                     install: true)

gir = find_program('g-ir-scanner', required: false)
cross_build = meson.is_cross_build()
enable_gir = get_option('enable-introspection')

if gir.found() and not cross_build and enable_gir
  gir_args = [ '--quiet', '--c-include=geoclue.h' ]

  gnome.generate_gir(libgeoclue,
                     sources: headers,
                     namespace: 'Geoclue',
                     nsversion: gclue_api_version,
                     identifier_prefix: 'GClue',
                     symbol_prefix: 'gclue',
                     export_packages: 'libgeoclue-' + gclue_api_version,
                     dependencies: base_deps,
                     includes: [ 'GObject-2.0', 'Gio-2.0' ],
                     include_directories: include_dirs,
                     install: true,
                     extra_args: gir_args)
endif

description = 'A convenience library to interact with Geoclue service'
pkgconf = import('pkgconfig')
pkgconf.generate(version: gclue_version,
                 name: 'Geoclue Client Library',
                 description: description,
                 filebase: 'libgeoclue-' + gclue_api_version,
                 libraries: libgeoclue,
                 subdirs: [ header_dir ],
                 requires: ['glib-2.0', 'gio-2.0', 'gio-unix-2.0'])

libgeoclue_dep = declare_dependency(link_with: libgeoclue,
                                    include_directories: include_dirs,
                                    dependencies: base_deps,
                                    sources: sources)