-
Notifications
You must be signed in to change notification settings - Fork 39
/
meson.build
102 lines (88 loc) · 2.11 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
project(
'swappy',
'c',
version: '1.5.1',
license: 'MIT',
meson_version: '>=0.48.0',
default_options: [
'c_std=c11',
'warning_level=2',
'werror=true',
],
)
version = '"@0@"'.format(meson.project_version())
git = find_program('git', native: true, required: false)
if git.found()
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check:true)
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check:true)
if git_commit.returncode() == 0 and git_branch.returncode() == 0
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
meson.project_version(),
git_commit.stdout().strip(),
git_branch.stdout().strip(),
)
endif
endif
add_project_arguments('-DSWAPPY_VERSION=@0@'.format(version), language: 'c')
add_project_arguments('-Wno-unused-parameter', language: 'c')
swappy_inc = include_directories('include')
cc = meson.get_compiler('c')
if cc.get_id() == 'clang'
message('clang')
add_global_arguments('-Wno-missing-field-initializers', language: 'c')
endif
cairo = dependency('cairo')
pango = dependency('pango')
math = cc.find_library('m')
gtk = dependency('gtk+-3.0', version: '>=3.20.0')
gio = dependency('gio-2.0')
subdir('res')
subdir('src/po')
executable(
'swappy',
swappy_resources,
files([
'src/main.c',
'src/algebra.c',
'src/application.c',
'src/box.c',
'src/config.c',
'src/clipboard.c',
'src/file.c',
'src/paint.c',
'src/pixbuf.c',
'src/render.c',
'src/util.c',
]),
dependencies: [
cairo,
pango,
gio,
gtk,
math,
],
link_args: '-rdynamic',
include_directories: [swappy_inc],
install: true,
)
scdoc = find_program('scdoc', required: get_option('man-pages'))
if scdoc.found()
sh = find_program('sh')
man_pages = ['swappy.1.scd']
mandir = get_option('mandir')
foreach src : man_pages
topic = src.split('.')[0]
section = src.split('.')[1]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
input: src,
output: output,
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc.path(), output)
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif