mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
meson: add source dir to include_directories automatically
Quite often we need to specify include_directories('.'). Normally, meson
does this automatically, but we specify implicit_include_directories : false,
see 30d20907bd for an explanation.
Passing the include_directories argument through the template layers was rather
cumbersome. Let's simplify things by always including the directory of the
first source file. This makes the definitions simpler, at the cost of having an
unnecessary include directory in the list in some cases.
(Tests are excluded from this change, because they happen to not need this, but
also because some tests have source[0] which is a custom target, and we'd need
newer meson to support that.)
This commit is contained in:
23
meson.build
23
meson.build
@@ -2334,7 +2334,6 @@ else
|
||||
}
|
||||
endif
|
||||
fuzz_additional_kwargs += {
|
||||
'include_directories' : include_directories('src/fuzz'),
|
||||
'c_args' : test_cflags,
|
||||
}
|
||||
|
||||
@@ -2565,9 +2564,9 @@ foreach dict : executables
|
||||
|
||||
kwargs = {}
|
||||
foreach key, val : dict
|
||||
if key in ['name', 'dbus', 'public', 'conditions',
|
||||
'type', 'suite', 'timeout', 'parallel',
|
||||
'objects', 'sources', 'extract']
|
||||
if key in ['name', 'dbus', 'public', 'conditions', 'type', 'suite',
|
||||
'timeout', 'parallel', 'objects', 'sources', 'extract',
|
||||
'include_directories']
|
||||
continue
|
||||
endif
|
||||
|
||||
@@ -2578,15 +2577,15 @@ foreach dict : executables
|
||||
kwargs += { key : [ kwargs.get(key, []), val ]}
|
||||
endforeach
|
||||
|
||||
include_directories = dict['include_directories']
|
||||
if not is_test
|
||||
include_directories += fs.parent(exe_sources[0])
|
||||
endif
|
||||
|
||||
foreach val : dict.get('objects', [])
|
||||
obj = objects_by_name[val]
|
||||
kwargs += {
|
||||
'objects' : obj['objects'],
|
||||
'include_directories' : [
|
||||
kwargs.get('include_directories', []),
|
||||
obj['include_directories'],
|
||||
],
|
||||
}
|
||||
kwargs += { 'objects' : obj['objects'] }
|
||||
include_directories += obj['include_directories']
|
||||
endforeach
|
||||
|
||||
if is_test
|
||||
@@ -2597,6 +2596,7 @@ foreach dict : executables
|
||||
endif
|
||||
|
||||
if is_fuzz
|
||||
include_directories += include_directories('src/fuzz')
|
||||
foreach key, val : fuzz_additional_kwargs
|
||||
if key == 'sources'
|
||||
exe_sources += val
|
||||
@@ -2611,6 +2611,7 @@ foreach dict : executables
|
||||
sources : exe_sources,
|
||||
kwargs : kwargs,
|
||||
implicit_include_directories : false,
|
||||
include_directories : include_directories,
|
||||
)
|
||||
|
||||
executables_by_name += { name : exe }
|
||||
|
||||
Reference in New Issue
Block a user