Skip to content

Commit

Permalink
build(c/adbc): Add support to build Vala bindings
Browse files Browse the repository at this point in the history
Vala VAPI file is generated for current GADBC 1.0 API version.

It is disable by default, but recommended to be enable when
a development package is distributed.

This commit force a 1.0 API versioning, replacing the old one
where 0 were used for GIR API version (gir_version), so now
shows '1.0' instead of '0.0'.
  • Loading branch information
esodan committed Oct 3, 2023
1 parent 213cb41 commit cabfdda
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
22 changes: 21 additions & 1 deletion glib/adbc-glib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,20 @@ pkgconfig.generate(libadbc_glib,
variables: pkgconfig_variables,
version: meson.project_version())

adbc_glib_gir = gnome.generate_gir(libadbc_glib,

gi_fatal_warnings = (build_machine.system() != 'windows')
have_gi = dependency('gobject-introspection-1.0', required: false).found()
if have_gi
pkgconfig_variables += ['girdir=@0@'.format(gir_dir)]
endif
generate_vapi = have_gi and get_option('vapi')
if generate_vapi
pkgconfig_variables += ['vapidir=@0@'.format(vapi_dir)]
add_languages('vala')
endif

if have_gi
adbc_glib_gir = gnome.generate_gir(libadbc_glib,
export_packages: 'adbc-glib',
extra_args: [
'--warn-all',
Expand All @@ -102,3 +115,10 @@ adbc_glib_gir = gnome.generate_gir(libadbc_glib,
nsversion: api_version,
sources: sources + definition_headers + enums,
symbol_prefix: 'gadbc')
if generate_vapi
adbc_glib_vapi = gnome.generate_vapi('adbc-glib',
install: true,
packages: ['gio-2.0'],
sources: [adbc_glib_gir[0]])
endif
endif
3 changes: 2 additions & 1 deletion glib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ version_major = version_numbers[0].to_int()
version_minor = version_numbers[1].to_int()
version_micro = version_numbers[2].to_int()

api_version = '@0@.0'.format(version_major)
api_version = '1.0'
so_version = version_major
library_version = '.'.join(version_numbers)

Expand All @@ -39,6 +39,7 @@ include_dir = get_option('includedir')
project_include_sub_dir = meson.project_name()
data_dir = get_option('datadir')
gir_dir = prefix / data_dir / 'gir-1.0'
vapi_dir = data_dir / 'vala' / 'vapi'

gnome = import('gnome')
pkgconfig = import('pkgconfig')
Expand Down
6 changes: 6 additions & 0 deletions glib/meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ option('adbc_build_dir',
type: 'string',
value: '',
description: 'Use this option to build with not installed ADBC')


option('vapi',
type: 'boolean',
value: false,
description: 'Build Vala API')

0 comments on commit cabfdda

Please sign in to comment.