-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
62 lines (52 loc) · 1.7 KB
/
meson.build
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
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2023-2024 Ledger SAS
project(
'package-metadata',
'c',
meson_version: '>=1.3.0',
license: 'Apache-2.0',
license_files: [ 'LICENSE' ],
version: run_command('dunamai', 'from', 'git', '--style', 'semver', '--dirty', check: true).stdout().strip(),
)
# XXX
# This meson project is a helper project that aims to be used as subproject only
if not meson.is_subproject()
error('Use this as subproject only')
endif
# Note that this will fail if top level project does not use Kconfig nor DTS
# Use meson recipe only for meson top level package
# For other buildsystem, use the correct recipe (TBD).
if get_option('with_task_metadata')
kconfig_proj = subproject('kconfig')
kconfig_json = kconfig_proj.get_variable('kconfig_json')
# default dts fallback
dtsopt = []
metadata_input = [kconfig_json]
if get_option('with_dts')
devicetree_proj = subproject('devicetree')
dts = devicetree_proj.get_variable('devicetree_dtsd')
dtsopt += '--dts=@INPUT1@'
metadata_input += dts
endif
gen_package_metadata = find_program('scripts/gen-package-metadata.py')
package_metadata = custom_target(
input: metadata_input,
output: 'package-metadata.json',
command: [
gen_package_metadata,
'--build-root=@BUILD_ROOT@',
'--source-root=@SOURCE_ROOT@',
'--config=@INPUT0@',
dtsopt,
'@OUTPUT@'
],
)
package_metadata_link_args = ['-Xlinker', '@' + package_metadata.full_path()]
endif
if get_option('with_build_id')
package_metadata_link_args += ['-Xlinker', '--build-id' ]
endif
package_metadata_dep = declare_dependency(
link_args: package_metadata_link_args,
sources: package_metadata,
)