| 1 |
# Copyright © 2018-2024 Intel Corporation |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
# you may not use this file except in compliance with the License. |
| 5 |
# You may obtain a copy of the License at |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 9 |
# Unless required by applicable law or agreed to in writing, software |
| 10 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
# See the License for the specific language governing permissions and |
| 13 |
# limitations under the License. |
| 14 |
|
| 15 |
dec_sub_dep = declare_dependency( |
| 16 |
include_directories : include_directories('headers'), |
| 17 |
) |
| 18 |
|
| 19 |
dec_dep = declare_dependency( |
| 20 |
sources : files('headers/foo.c'), |
| 21 |
dependencies : dec_sub_dep, |
| 22 |
) |
| 23 |
|
| 24 |
sub_dep = dec_dep.partial_dependency(includes : true) |
| 25 |
|
| 26 |
dec_exe = executable( |
| 27 |
'declare_dep', |
| 28 |
files('main.c', 'other.c'), |
| 29 |
dependencies : sub_dep, |
| 30 |
) |
| 31 |
|
| 32 |
# Ensure that two partial dependencies of the same dependency are applied, as |
| 33 |
# they may provide different values. |
| 34 |
dec2_exe = executable( |
| 35 |
'declare_dep2', |
| 36 |
files('main.c', 'other.c'), |
| 37 |
dependencies : [sub_dep.partial_dependency(), sub_dep], |
| 38 |
) |
| 39 |
|
| 40 |
test('Declare Dependency', dec_exe) |