meson.build 4.13 KB
Newer Older
1
project(
2
	'virtboard',
3
	'c',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
4
	version: '0.0.5',
5
6
	license: 'MIT',
	meson_version: '>=0.43.0',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
7
	default_options: [ 'warning_level=1', 'c_std=gnu11' ]
8
9
)

10
if get_option('buildtype').startswith('debug')
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
11
    add_project_arguments('-DDEBUG', language : 'c')
12
endif
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
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
if get_option('buildtype') != 'plain'
    add_project_arguments('-fstack-protector-strong', language: 'c')
endif
add_project_arguments([
  '-Wcast-align',
  '-Wdate-time',
  ['-Werror=format-security', '-Werror=format=2'],
  '-Wendif-labels',
  '-Werror=incompatible-pointer-types',
  '-Werror=missing-declarations',
  '-Werror=overflow',
  '-Werror=return-type',
  '-Werror=shift-count-overflow',
  '-Werror=shift-overflow=2',
  '-Werror=implicit-fallthrough=3',
  '-Wfloat-equal',
  '-Wformat-nonliteral',
  '-Wformat-security',
  '-Winit-self',
  '-Wmaybe-uninitialized',
  '-Wmissing-field-initializers',
  '-Wmissing-include-dirs',
  '-Wmissing-noreturn',
  '-Wnested-externs',
  '-Wno-missing-field-initializers',
  '-Wno-sign-compare',
  '-Wno-strict-aliasing',
  '-Wno-unused-parameter',
  '-Wold-style-definition',
  '-Wpointer-arith',
  '-Wredundant-decls',
  '-Wshadow',
  '-Wstrict-prototypes',
  '-Wswitch-default',
  '-Wswitch-enum',
  '-Wtype-limits',
  '-Wundef',
  '-Wunused-function',
], language: 'c')
52

53
54
cc = meson.get_compiler('c')

Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
55
wayland_client = dependency('wayland-client', version: '>=1.16')
56
57
58
59
60
61
wayland_cursor = dependency('wayland-cursor')
wayland_protos = dependency('wayland-protocols', version: '>=1.14')
xkbcommon      = dependency('xkbcommon')
cairo          = dependency('cairo')
math           = cc.find_library('m', required: false)
pixman         = dependency('pixman-1')
62
png            = dependency('libpng')
63
gio            = dependency('gio-2.0')
64
gio_unix       = dependency('gio-unix-2.0')
65
66
67
68
69
70
71
72
73
74
75
76
77
78

wl_protocol_dir = wayland_protos.get_pkgconfig_variable('pkgdatadir')

wayland_scanner = find_program('wayland-scanner')

wayland_scanner_server = generator(
	wayland_scanner,
	output: '@BASENAME@-protocol.h',
	arguments: ['server-header', '@INPUT@', '@OUTPUT@'],
)

wayland_scanner_code = generator(
	wayland_scanner,
	output: '@BASENAME@-protocol.c',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
79
	arguments: ['private-code', '@INPUT@', '@OUTPUT@'],
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
)

wayland_scanner_client = generator(
	wayland_scanner,
	output: '@BASENAME@-client-protocol.h',
	arguments: ['client-header', '@INPUT@', '@OUTPUT@'],
)

protocols = [
    [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
    [wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'],
	[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
	[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
	[wl_protocol_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml'],
	'protocol/text-cursor-position.xml',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
95
96
97
	'protocol/ivi-application.xml',
	'protocol/input-method-unstable-v2.xml',
	'protocol/text-input-unstable-v3.xml',
98
99
100
101
102
103
104
105
106
107
108
109
110
	'protocol/virtual-keyboard-unstable-v1.xml',
	'protocol/wlr-layer-shell-unstable-v1.xml',
]

wl_protos_src = []
wl_protos_headers = []

foreach p : protocols
	xml = join_paths(p)
	wl_protos_src += wayland_scanner_code.process(xml)
	wl_protos_headers += wayland_scanner_client.process(xml)
endforeach

111
112
113
114
115
116
gnome = import('gnome')
dbus_src = gnome.gdbus_codegen(
    'sm.puri.OSK0',
    'data/dbus/sm.puri.Virtboard.xml'
)

117
118
119
120
121
122
123
124
125
126
sources = [
	'clients/keyboard.c',
    'clients/window.c',
    'shared/xalloc.c',
    'shared/os-compatibility.c',
    'shared/config-parser.c',
    'shared/cairo-util.c',
    'shared/frame.c',
    'shared/image-loader.c',
    'shared/file-util.c',
127
    'shared/libgwater-wayland.c'
128
129
130
131
]

sources += wl_protos_src
sources += wl_protos_headers
132
sources += dbus_src
133
134
135
136
137

add_global_arguments('-DLIBEXECDIR=""', language : 'c')
add_global_arguments('-DDATADIR=""', language : 'c')

executable(
138
    'virtboard', sources,
139
    dependencies: [png, math, pixman, wayland_cursor, wayland_client, wayland_protos, xkbcommon, cairo, gio, gio_unix], 
140
    install: true,
141
)
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
142
143
144
145
146

prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
datadir = join_paths(prefix, get_option('datadir'))
desktopdir = join_paths(datadir, 'applications')
147
dbusdir = join_paths(datadir, 'dbus-1/interfaces')
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
148
149
150
i18n  = import('i18n')

subdir('data')