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
|
# SPDX-License-Identifier: Apache-2.0
# Copyright © 2022 Intel Corporation
dep_zlib = dependency('zlib', required : false, disabler : true)
external_dep_rs = rust.bindgen(
input : 'external_dep.h',
output : 'external_dep.rs',
dependencies : dep_zlib
)
external_dep = static_library(
'external_dep',
[external_dep_rs],
dependencies : dep_zlib.partial_dependency(links : true),
)
rust.test('external dep', external_dep)
int_dep = declare_dependency(
sources : [gen_h, gen2_h],
include_directories : include_directories('..'),
)
internal_dep_rs = rust.bindgen(
input : 'internal_dep.h',
output : 'internal_dep.rs',
dependencies : int_dep,
)
c_lib2 = static_library(
'clib2',
'clib2.c',
dependencies : int_dep,
)
rust_bin_int_dep = executable(
'rust_bin_int_dep',
structured_sources(['internal_main.rs', internal_dep_rs]),
link_with : [c_lib, c_lib2],
)
test('generated header dependency', rust_bin_int_dep)
|