meson: fix coverage build

This moves coverage.h to src/coverage/, and specifies path to coverage.h
with files() directive, to make it can be included even when located
outside of the include directories. Otherwise, libc-wrapper cannot be
built when -Db_coverage=true option is enabled.

Follow-up for 543a48b653.
This commit is contained in:
Yu Watanabe
2025-07-12 02:14:00 +09:00
parent 375d80b04a
commit 5921c48fcf
4 changed files with 10 additions and 4 deletions

View File

@@ -344,6 +344,7 @@ conf.set10('ENABLE_FIRST_BOOT_FULL_PRESET', get_option('first-
cc = meson.get_compiler('c')
userspace_c_args = []
userspace_c_ld_args = []
userspace_sources = []
meson_build_sh = find_program('tools/meson-build.sh')
want_tests = get_option('tests')
@@ -1963,9 +1964,7 @@ endif
#####################################################################
if get_option('b_coverage')
userspace_c_args += ['-include', 'coverage.h']
endif
subdir('src/coverage')
#####################################################################
@@ -1980,7 +1979,7 @@ jinja2_cmdline = [meson_render_jinja2, config_h]
userspace = declare_dependency(
compile_args : userspace_c_args,
link_args : userspace_c_ld_args,
sources : version_h,
sources : userspace_sources,
)
man_page_depends = []

6
src/coverage/meson.build Normal file
View File

@@ -0,0 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
if get_option('b_coverage')
userspace_c_args += ['-include', meson.current_source_dir() / 'coverage.h']
userspace_sources += files('coverage.h')
endif

View File

@@ -13,3 +13,4 @@ version_h = custom_target('version',
vcs_tag ? '1' : '0',
])
version_include = include_directories('.')
userspace_sources += [version_h]