This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
meson.build
118 lines (105 loc) · 2.27 KB
/
meson.build
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
project(
'kanshi',
'c',
version: '1.2.0',
license: 'MIT',
meson_version: '>=0.47.0',
default_options: [
'c_std=c99',
'warning_level=3',
'werror=true',
],
)
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments([
'-Wundef',
'-Wlogical-op',
'-Wmissing-include-dirs',
'-Wold-style-definition',
'-Wpointer-arith',
'-Winit-self',
'-Wfloat-equal',
'-Wstrict-prototypes',
'-Wredundant-decls',
'-Wimplicit-fallthrough=2',
'-Wendif-labels',
'-Wstrict-aliasing=2',
'-Woverflow',
'-Wformat=2',
'-Wno-missing-braces',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
]), language: 'c')
wayland_client = dependency('wayland-client')
varlink = dependency('libvarlink', required: get_option('ipc'))
add_project_arguments([
'-DKANSHI_VERSION="@0@"'.format(meson.project_version()),
'-DKANSHI_HAS_VARLINK=@0@'.format(varlink.found().to_int()),
], language: 'c')
subdir('protocol')
kanshi_deps = [
wayland_client,
client_protos,
]
kanshi_srcs = [
'event-loop.c',
'main.c',
'parser.c',
'ipc-addr.c',
]
if varlink.found()
kanshi_deps += varlink
kanshi_srcs += ['ipc.c', 'ipc-addr.c']
endif
executable(
meson.project_name(),
kanshi_srcs,
include_directories: include_directories('include'),
dependencies: kanshi_deps,
install: true,
)
if varlink.found()
executable(
meson.project_name() + 'ctl',
files(
'ctl.c',
'ipc-addr.c',
),
include_directories: include_directories('include'),
dependencies: [varlink],
install: true,
)
endif
scdoc = dependency(
'scdoc',
version: '>=1.9.2',
native: true,
required: get_option('man-pages'),
)
if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
man_files = [
'kanshi.1.scd',
'kanshi.5.scd',
]
if varlink.found()
man_files += 'kanshictl.1.scd'
endif
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: filename,
output: output,
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif