Skip to content

Commit 3ac6dbc

Browse files
committed
Add support for generating vapi files for Vala
1 parent beb30f2 commit 3ac6dbc

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,19 @@ Layer shell __is not supported__ on:
3030
* [GTK3](https://www.gtk.org/) (>=3.22.0)
3131
* [GObject introspection](https://gitlab.gnome.org/GNOME/gobject-introspection/)
3232
* [GTK Doc](https://www.gtk.org/gtk-doc/) (only required if docs are enabled)
33+
* [Vala](https://wiki.gnome.org/Projects/Vala) (only required if vapi is enabled)
3334

3435
To install these dependencies on Ubuntu 18.04 and later:
3536
```
36-
sudo apt install meson libwayland-dev libgtk-3-dev gobject-introspection libgirepository1.0-dev gtk-doc-tools
37+
sudo apt install meson libwayland-dev libgtk-3-dev gobject-introspection libgirepository1.0-dev gtk-doc-tools valac
3738
```
3839

3940
### Meson Options
4041
* `-Dexamples` (default `false`): If to build the example C apps; gtk-layer-demo is installed if examples are built; The Vala example is never built with the rest of the project
4142
* `-Ddocs` (default `false`): If to generate the docs
4243
* `-Dtests` (default `false`): If to build the tests
4344
* `-Dintrospection` (default: `true`): If to build GObject Introspection data (used for bindings to langauges other than C/C++)
45+
* `-Dvapi` (default: `false`): If to build VAPI data (allows this library to be used in Vala). Requires `-Dintrospection=true`
4446

4547
### Running the Tests
4648
* `ninja -C build test`

examples/vala-standalone/meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ project('vala-gtk-layer-shell-example',
44
license: 'MIT',
55
meson_version: '>=0.45.1')
66

7+
gtk = dependency('gtk+-3.0')
8+
gtk_layer_shell = dependency('gtk-layer-shell-0')
9+
710
executable(
811
'vala-layer-shell',
912
files('main.vala'),
10-
vala_args: ['--pkg=GtkLayerShell-0.1'],
11-
dependencies: [
12-
dependency('gtk+-3.0'),
13-
meson.get_compiler('c').find_library('gtk-layer-shell')])
13+
dependencies: [ gtk, gtk_layer_shell ])

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ option('examples', type: 'boolean', value: false, description: 'Build example ap
22
option('docs', type: 'boolean', value: false, description: 'Build devhelp API documentation')
33
option('tests', type: 'boolean', value: false, description: 'Build tests')
44
option('introspection', type: 'boolean', value: true, description: 'Build gobject-introspection data')
5+
option('vapi', type: 'boolean', value: true, description: 'Generate vapi data (needs vapigen & introspection option)')

src/meson.build

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ if get_option('introspection')
3939
includes: [ 'Gtk-3.0' ],
4040
header: 'gtk-layer-shell/gtk-layer-shell.h',
4141
install: true)
42+
43+
if get_option('vapi')
44+
gnome.generate_vapi(
45+
pkg_config_name,
46+
sources: gir[0],
47+
packages: 'gtk+-3.0',
48+
install: true)
49+
endif
4250
endif
4351

4452
pkg_config.generate(

0 commit comments

Comments
 (0)