aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build35
1 files changed, 7 insertions, 28 deletions
diff --git a/meson.build b/meson.build
index c602d008..71e75fd9 100644
--- a/meson.build
+++ b/meson.build
@@ -3,7 +3,7 @@ project(
3 'c', 3 'c',
4 version: '1.10-dev', 4 version: '1.10-dev',
5 license: 'MIT', 5 license: 'MIT',
6 meson_version: '>=0.60.0', 6 meson_version: '>=1.3',
7 default_options: [ 7 default_options: [
8 'c_std=c11', 8 'c_std=c11',
9 'warning_level=2', 9 'warning_level=2',
@@ -38,14 +38,14 @@ if is_freebsd
38endif 38endif
39 39
40# Execute the wlroots subproject, if any 40# Execute the wlroots subproject, if any
41wlroots_version = ['>=0.18.0', '<0.19.0'] 41wlroots_version = ['>=0.19.0', '<0.20.0']
42subproject( 42subproject(
43 'wlroots', 43 'wlroots',
44 default_options: ['examples=false'], 44 default_options: ['examples=false'],
45 required: false, 45 required: false,
46 version: wlroots_version, 46 version: wlroots_version,
47) 47)
48wlroots = dependency('wlroots-0.18', version: wlroots_version, fallback: 'wlroots') 48wlroots = dependency('wlroots-0.19', version: wlroots_version, fallback: 'wlroots')
49wlroots_features = { 49wlroots_features = {
50 'xwayland': false, 50 'xwayland': false,
51 'libinput_backend': false, 51 'libinput_backend': false,
@@ -160,8 +160,8 @@ add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir
160version = '"@0@"'.format(meson.project_version()) 160version = '"@0@"'.format(meson.project_version())
161git = find_program('git', native: true, required: false) 161git = find_program('git', native: true, required: false)
162if git.found() 162if git.found()
163 git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false) 163 git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
164 git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false) 164 git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
165 if git_commit.returncode() == 0 and git_branch.returncode() == 0 165 if git_commit.returncode() == 0 and git_branch.returncode() == 0
166 version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format( 166 version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
167 meson.project_version(), 167 meson.project_version(),
@@ -172,31 +172,10 @@ if git.found()
172endif 172endif
173add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c') 173add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
174 174
175# Compute the relative path used by compiler invocations. 175fs = import('fs')
176source_root = meson.current_source_dir().split('/')
177build_root = meson.global_build_root().split('/')
178relative_dir_parts = []
179i = 0
180in_prefix = true
181foreach p : build_root
182 if i >= source_root.length() or not in_prefix or p != source_root[i]
183 in_prefix = false
184 relative_dir_parts += '..'
185 endif
186 i += 1
187endforeach
188i = 0
189in_prefix = true
190foreach p : source_root
191 if i >= build_root.length() or not in_prefix or build_root[i] != p
192 in_prefix = false
193 relative_dir_parts += p
194 endif
195 i += 1
196endforeach
197relative_dir = join_paths(relative_dir_parts) + '/'
198 176
199# Strip relative path prefixes from the code if possible, otherwise hide them. 177# Strip relative path prefixes from the code if possible, otherwise hide them.
178relative_dir = fs.relative_to(meson.current_source_dir(), meson.global_build_root()) + '/'
200if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=') 179if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
201 add_project_arguments( 180 add_project_arguments(
202 '-fmacro-prefix-map=@0@='.format(relative_dir), 181 '-fmacro-prefix-map=@0@='.format(relative_dir),