summaryrefslogtreecommitdiff
path: root/bindings/vala/meson.build
blob: ec1ddf0bc746c5a7d6c45f1c91d75c1a8663f220 (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright © 2018, 2019 Iñigo Martínez
# Copyright © 2019 Christian Persch
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library.  If not, see <https://www.gnu.org/licenses/>.

assert(get_option('gir'), 'gir is required for vala support')
assert(get_option('gtk3'), 'vala support only available for gtk3')

add_languages('vala', required: true)

valac = meson.get_compiler('vala')
assert(valac.version().version_compare('>= 0.24.0'), 'vala >= 0.24 required')

posix_dep = valac.find_library('posix')

libvte_gtk3_vapi_deps = [
  'gio-2.0',
  'glib-2.0',
  'pango',
  'gtk+-3.0',
]

libvte_gtk3_vapi_dep = gnome.generate_vapi(
  vte_gtk3_api_name,
  sources: libvte_gtk3_gir[0],
  packages: libvte_gtk3_vapi_deps,
  install: true,
)

# Vala test application

vapp_resource_data = files(
  'app.ui',
  'search-popover.ui',
)

vapp_resource_sources = gnome.compile_resources(
  'appresources',
  'app.gresource.xml',
  c_name: 'app',
  dependencies: vapp_resource_data,
  export: true,
)

vapp_sources = vapp_resource_sources + files(
  'config.vapi',
  'app.vala'
)

vapp_cflags = [
  '-Wno-unused-but-set-variable',
  '-Wno-unused-variable',
]

vapp_valaflags = [
  '--enable-deprecated'
]

if valac.version().version_compare('>= 0.31.1')
  vapp_valaflags += '--disable-since-check'
endif

if gtk3_dep.version().version_compare('>= 3.16')
  vapp_valaflags += '--define=GTK_3_16'
endif

vapp_incs = [
  top_inc,
  src_inc,
  vte_inc,
]

vapp_deps = [
  gio_dep,
  glib_dep,
  gtk3_dep,
  libvte_gtk3_vapi_dep,
  posix_dep,
]

vapp = executable(
  'vala-test',
  sources: vapp_sources,
  include_directories: vapp_incs,
  dependencies: vapp_deps,
  c_args: vapp_cflags,
  vala_args: vapp_valaflags,
  install: false,
)