|
|
@ -3,7 +3,7 @@ project(
|
|
|
|
'c',
|
|
|
|
'c',
|
|
|
|
version: '0.19.0-dev',
|
|
|
|
version: '0.19.0-dev',
|
|
|
|
license: 'MIT',
|
|
|
|
license: 'MIT',
|
|
|
|
meson_version: '>=0.59.0',
|
|
|
|
meson_version: '>=1.3',
|
|
|
|
default_options: [
|
|
|
|
default_options: [
|
|
|
|
'c_std=' + (meson.version().version_compare('>=1.3.0') ? 'c23,c11' : 'c11'),
|
|
|
|
'c_std=' + (meson.version().version_compare('>=1.3.0') ? 'c23,c11' : 'c11'),
|
|
|
|
'warning_level=2',
|
|
|
|
'warning_level=2',
|
|
|
@ -48,31 +48,10 @@ add_project_arguments(cc.get_supported_arguments([
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
'-Wno-unused-parameter',
|
|
|
|
]), language: 'c')
|
|
|
|
]), language: 'c')
|
|
|
|
|
|
|
|
|
|
|
|
# Compute the relative path used by compiler invocations.
|
|
|
|
fs = import('fs')
|
|
|
|
source_root = meson.current_source_dir().split('/')
|
|
|
|
|
|
|
|
build_root = meson.global_build_root().split('/')
|
|
|
|
|
|
|
|
relative_dir_parts = []
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
|
|
|
|
in_prefix = true
|
|
|
|
|
|
|
|
foreach p : build_root
|
|
|
|
|
|
|
|
if i >= source_root.length() or not in_prefix or p != source_root[i]
|
|
|
|
|
|
|
|
in_prefix = false
|
|
|
|
|
|
|
|
relative_dir_parts += '..'
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
i += 1
|
|
|
|
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
|
|
|
|
in_prefix = true
|
|
|
|
|
|
|
|
foreach p : source_root
|
|
|
|
|
|
|
|
if i >= build_root.length() or not in_prefix or build_root[i] != p
|
|
|
|
|
|
|
|
in_prefix = false
|
|
|
|
|
|
|
|
relative_dir_parts += p
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
i += 1
|
|
|
|
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
relative_dir = join_paths(relative_dir_parts) + '/'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
|
|
|
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
|
|
|
|
|
|
|
relative_dir = fs.relative_to(meson.current_source_dir(), meson.global_build_root()) + '/'
|
|
|
|
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
|
|
|
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
|
|
|
add_project_arguments(
|
|
|
|
add_project_arguments(
|
|
|
|
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
|
|
|
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
|
|
|