| 1 |
dep3_libs = [] |
| 2 |
|
| 3 |
# Permutate all combinations of shared and static libraries up to three levels |
| 4 |
# executable -> shared -> static -> shared (etc) |
| 5 |
foreach dep2 : ['sh', 'st'] |
| 6 |
foreach dep1 : ['sh', 'st'] |
| 7 |
foreach libtype : ['sh', 'st'] |
| 8 |
name = libtype + dep1 + dep2 |
| 9 |
if dep2 == 'sh' |
| 10 |
libret = 1 |
| 11 |
elif dep2 == 'st' |
| 12 |
libret = 2 |
| 13 |
else |
| 14 |
error('Unknown dep2 "@0@"'.format(dep2)) |
| 15 |
endif |
| 16 |
|
| 17 |
if libtype == 'sh' |
| 18 |
target = 'shared_library' |
| 19 |
build_args = [] |
| 20 |
elif libtype == 'st' |
| 21 |
target = 'static_library' |
| 22 |
build_args = ['-DMESON_STATIC_BUILD'] |
| 23 |
else |
| 24 |
error('Unknown libtype "@0@"'.format(libtype)) |
| 25 |
endif |
| 26 |
|
| 27 |
cdata = configuration_data() |
| 28 |
cdata.set('DEPENDENCY', dep1 + dep2) |
| 29 |
cdata.set('LIBTYPE', libtype) |
| 30 |
cdata.set('VALUE', libret) |
| 31 |
|
| 32 |
lib_c = configure_file(input : 'lib.c.in', |
| 33 |
output : name + '-lib.c', |
| 34 |
configuration : cdata) |
| 35 |
dep = get_variable(dep1 + dep2 + 'dep') |
| 36 |
dep3_lib = build_target(name, lib_c, link_with : dep, |
| 37 |
target_type : target, |
| 38 |
c_args : build_args) |
| 39 |
dep3_libs += [dep3_lib] |
| 40 |
|
| 41 |
main_c = configure_file(input : 'main.c.in', |
| 42 |
output : name + '-main.c', |
| 43 |
configuration : cdata) |
| 44 |
dep3_bin = executable(name + '_test', main_c, link_with : dep3_lib, |
| 45 |
c_args : build_args) |
| 46 |
test(name + 'test', dep3_bin) |
| 47 |
endforeach |
| 48 |
endforeach |
| 49 |
endforeach |