Debian Codegraph @

test cases/unit/56 introspection/meson.build

raw
1 project('introspection', ['c', 'cpp'], version: '1.2.3', default_options: ['cpp_std=c++11', 'buildtype=debug'])
2
3 dep1 = dependency('threads')
4 dep2 = dependency('zlib', required: false)
5 dep3 = dependency('bugDep1', required: get_option('test_opt1'))
6
7 b1 = get_option('test_opt1')
8 b2 = get_option('test_opt2')
9 test_bool = b1 or b2
10 test_bool = b1 and b2
11 test_bool = not test_bool
12
13 set_variable('list_test_plusassign', [])
14 list_test_plusassign += ['bugs everywhere']
15 dict_test = {list_test_plusassign[0]: 'even more bugs'}
16
17 if not true
18 vers_str = '<=99.9.9'
19 dependency('somethingthatdoesnotexist', required: true, version: '>=1.2.3')
20 dependency('look_i_have_a_fallback', version: ['>=1.0.0', vers_str], fallback: ['oh_no', 'the_subproject_does_not_exist'])
21 endif
22
23 subdir('sharedlib')
24 subdir('staticlib')
25
26 var1 = '1'
27 var2 = 2.to_string()
28 var3 = 'test3'
29
30 var4 = f'test @var1@ string' # TODO: Actually implement fstrings
31
32 cus1 = custom_target('custom target test 1', output: 'file2', input: 'cp.py',
33 command: [find_program('cp.py'), '@INPUT@', '@OUTPUT@'])
34 cus2 = custom_target('custom target test 2', output: 'file3', input: cus1,
35 command: [find_program('cp.py'), '@INPUT@', '@OUTPUT@'])
36
37 t1 = executable('test' + var1, ['t1.cpp'], link_with: [sharedlib], install: not false, build_by_default: get_option('test_opt2'))
38 t2 = executable('test@0@'.format('@0@'.format(var2)), sources: ['t2.cpp'], link_with: [staticlib])
39 t3 = executable(var3, 't3.cpp', link_with: [sharedlib, staticlib], dependencies: [dep1])
40
41 cus3 = custom_target('custom target test 3', output: 'file4', input: t3,
42 command: [find_program('cp.py'), '@INPUT@', '@OUTPUT@'])
43
44 ### BEGIN: Test inspired by taisei: https://github.com/taisei-project/taisei/blob/master/meson.build#L293
45 systype = '@0@'.format(host_machine.system())
46 systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machine.cpu())
47 message(systype)
48 ### END: Test inspired by taisei
49
50 # Minimal code version to produce bug #5376
51 # Code inspired by https://github.com/mesa3d/mesa/blob/974c4d679c23373dbed386c696e3e3bc1bfa23ae/meson.build#L1341-L1347
52 osmesa_lib_name = 'OSMesa'
53 osmesa_bits = '8'
54 osmesa_lib_name = osmesa_lib_name + osmesa_bits
55 message(osmesa_lib_name) # Infinite recursion gets triggered here when the parameter osmesa_lib_name is resolved
56
57 test('test case 1', t1)
58 test('test case 2', t2, depends: t3)
59 benchmark('benchmark 1', t3, args: [cus1, cus2, cus3])
60
61 ### BEGIN: Stuff to test the handling of `UnknownValue`
62 var_1 = 1
63 var_2 = 2
64 unknown_var = 'var_1'
65 if host_machine.system() == 'windows'
66 unknown_var = 'var_2'
67 endif
68 # The IntrospectionInterpreter can't know the value of unknown_var and use the `UnknownValue` class.
69
70 message(get_variable(unknown_var))
71
72 dependency(unknown_var, version: [unknown_var], required: false)
73 dependency(unknown_var, version: unknown_var, required: false)
74 ### END: Stuff to test the handling of `UnknownValue`
75
76 ### Stuff to test the AST JSON printer
77 foreach x : ['a', 'b', 'c']
78 if x == 'a'
79 message('a')
80 elif x == 'b'
81 message('a')
82 else
83 continue
84 endif
85 break
86 continue
87 endforeach