-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
156 lines (131 loc) · 4.1 KB
/
meson.build
File metadata and controls
156 lines (131 loc) · 4.1 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
project(
'ctrash', 'cpp', 'c',
version : '0.0.1',
license : 'GPL3',
meson_version : '>= 0.59.0',
default_options : [
'cpp_std=c++20',
'buildtype=release',
'default_library=shared',
'auto_features=auto',
'optimization=3'
],
)
compiler = meson.get_compiler('cpp')
cpp_args = []
cpp_link_args = []
if get_option('libcxx')
cpp_args += ['-stdlib=libc++']
cpp_link_args += ['-stdlib=libc++', '-lc++abi']
endif
if compiler.has_link_argument('-lc++fs')
cpp_link_args += ['-lc++fs']
elif compiler.has_link_argument('-lstdc++fs')
cpp_link_args += ['-lstdc++fs']
endif
git = find_program('git', native : true, required : false)
if not git.found()
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language : 'cpp')
else
git_path = run_command(git, 'rev-parse', '--show-toplevel', check : false).stdout().strip()
if meson.project_source_root() == git_path
git_commit_hash = run_command(git, 'describe', '--always', '--tags', check : false).stdout().strip()
git_branch = run_command(git, 'rev-parse', '--abbrev-ref', 'HEAD', check : false).stdout().strip()
version = '"@0@ (branch \'@1@\')"'.format(git_commit_hash, git_branch)
add_project_arguments('-DVERSION=@0@'.format(version), language : 'cpp')
else
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language : 'cpp')
endif
endif
add_global_arguments(cpp_args, language : 'cpp')
add_global_link_arguments(cpp_link_args, language : 'cpp')
system = host_machine.system()
prefix = get_option('prefix')
sysconfdir = get_option('sysconfdir')
conf_data = configuration_data()
conf_data.set('prefix', prefix)
add_project_arguments('-DSYSCONFDIR="@0@"'.format(prefix / sysconfdir), language : 'cpp')
systemd = dependency('systemd', required : false)
if systemd.found()
user_units_dir = systemd.get_variable(pkgconfig : 'systemduserunitdir')
# configure_file(
# configuration : conf_data,
# input : './resources/waybar.service.in',
# output : '@BASENAME@',
# install_dir : user_units_dir
# )
endif
src_files = files(
'src/trash_item.hpp',
'src/trash_context.hpp',
'src/ctrash.cpp'
)
man_files = files(
# string list here with all doc files.
)
inc_dirs = ['include']
libtrash = library('libtrash.so', 'src/trash.cpp')
executable(
'ctrash',
[src_files],
dependencies : [], # can place dependencies external here.
include_directories : inc_dirs,
#link_with : libtrash.so,
install : true
)
install_data(
# to fill in here, files to install.
# 'resources/config.jsonc',
# 'resources/style.css',
# install_dir: sysconfdir / 'xdg/waybar'
)
scdoc = dependency('scdoc', version : '>=1.9.2', native : true, required : get_option('man-pages'))
#if scdoc.found()
# man_files += configure_file(
# input : 'man/ctrash.5.scd.in',
# output : 'ctrash.5.scd',
# configuration : {
# 'sysconfdir' : prefix / sysconfdir
# }
# )
#
# fs = import('fs')
# mandir = get_option('mandir')
# foreach file : man_files
# basename = fs.name(file)
#
# topic = basename.split('.')[-3]
# section = basename.split('.')[-2]
# output = '@0@.@1@'.format(topic, section)
#
# custom_target(
# output,
# input : file,
# output : output,
# command : scdoc.get_variable('scdoc'),
# feed : true,
# capture : true,
# install : true,
# install_dir : '@0@/man@1@'.format(mandir, section)
# )
# endforeach
#endif
catch2 = dependency(
'catch2',
default_options : ['tests=false'],
fallback : ['catch2', 'catch2_dep'],
required : get_option('tests'),
)
if catch2.found()
# subdir('test')
endif
clangtidy = find_program('clang-tidy', required : false)
if clangtidy.found()
run_target(
'tidy',
command : [
clangtidy,
'-checks=*,-fuchsia-default-arguments',
'-p', meson.project_build_root()
] + src_files)
endif