Debian Codegraph @

test cases/common/152 index customtarget/meson.build

raw
1 # Copyright © 2017 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 project('custom_target_index', 'c', default_options : 'c_std=c89')
16
17 py_mod = import('python3')
18 prog_python = py_mod.find_python()
19
20 gen = custom_target(
21 'gen.[ch]',
22 input : 'gen_sources.py',
23 output : ['gen.c', 'gen.h'],
24 command : [prog_python, '@INPUT@', '--header', '@OUTPUT1@', '--code', '@OUTPUT0@'],
25 )
26
27 has_not_changed = false
28 if is_disabler(gen)
29 has_not_changed = true
30 else
31 has_not_changed = true
32 endif
33
34 assert(has_not_changed, 'Custom target has changed.')
35
36 assert(not is_disabler(gen), 'Custom target is a disabler.')
37
38 lib = static_library(
39 'libfoo',
40 ['lib.c', gen[1]],
41 )
42
43 has_not_changed = false
44 if is_disabler(lib)
45 has_not_changed = true
46 else
47 has_not_changed = true
48 endif
49
50 assert(has_not_changed, 'Static library has changed.')
51
52 assert(not is_disabler(lib), 'Static library is a disabler.')
53
54 custom_target(
55 'foo',
56 input: gen[0],
57 output: 'foo',
58 command: [find_program('check_args.py'), '@INPUT@'],
59 )
60
61 subdir('subdir')
62
63 gen = disabler()
64
65 assert(is_disabler(gen), 'Generator is not a disabler.')
66
67 lib = static_library(
68 'libfoo',
69 ['lib.c', gen[1]],
70 )
71
72 assert(is_disabler(lib), 'Static library is not a disabler.')
73
74 if lib.found()
75 lib_disabled = false
76 else
77 lib_disabled = true
78 endif
79
80 assert(lib_disabled, 'Static library was not disabled.')