| 1 |
project('can-this-find-an-external-library', 'c') |
| 2 |
|
| 3 |
cc = meson.get_compiler('c') |
| 4 |
|
| 5 |
if cc.get_argument_syntax() != 'msvc' |
| 6 |
error('MESON_SKIP_TEST: test is only relevant for msvc and clang-cl') |
| 7 |
endif |
| 8 |
|
| 9 |
# We need to conjure a static library for the current architecture |
| 10 |
# Generate an object file manually. |
| 11 |
run_command( |
| 12 |
[ |
| 13 |
meson.get_compiler('c').cmd_array().get(-1), |
| 14 |
'/nologo', |
| 15 |
'/MDd', |
| 16 |
'/Fo@0@'.format(meson.current_source_dir() / 'lib' / 'source.obj'), |
| 17 |
'/c', |
| 18 |
files('source.c'), |
| 19 |
], |
| 20 |
check: true |
| 21 |
) |
| 22 |
# Turn it into a library. |
| 23 |
run_command( |
| 24 |
[ |
| 25 |
find_program('LIB'), |
| 26 |
'/OUT:@0@'.format(meson.current_source_dir() / 'lib' / 'conjured.lib'), |
| 27 |
meson.current_source_dir() / 'lib' / 'source.obj', |
| 28 |
], |
| 29 |
check: true |
| 30 |
) |
| 31 |
|
| 32 |
# Ensure this library can be found |
| 33 |
dep = cc.find_library('conjured', required: true) |