parent
8239912379
commit
d86fce9594
4 changed files with 47 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||||||
|
*.obj |
||||||
|
*.lib |
@ -0,0 +1,33 @@ |
|||||||
|
project('can-this-find-an-external-library', 'c') |
||||||
|
|
||||||
|
cc = meson.get_compiler('c') |
||||||
|
|
||||||
|
if cc.get_argument_syntax() != 'msvc' |
||||||
|
error('MESON_SKIP_TEST: test is only relevant for msvc and clang-cl') |
||||||
|
endif |
||||||
|
|
||||||
|
# We need to conjure a static library for the current architecture |
||||||
|
# Generate an object file manually. |
||||||
|
run_command( |
||||||
|
[ |
||||||
|
meson.get_compiler('c').cmd_array().get(-1), |
||||||
|
'/nologo', |
||||||
|
'/MDd', |
||||||
|
'/Fo@0@'.format(meson.current_source_dir() / 'lib' / 'source.obj'), |
||||||
|
'/c', |
||||||
|
files('source.c'), |
||||||
|
], |
||||||
|
check: true |
||||||
|
) |
||||||
|
# Turn it into a library. |
||||||
|
run_command( |
||||||
|
[ |
||||||
|
find_program('LIB'), |
||||||
|
'/OUT:@0@'.format(meson.current_source_dir() / 'lib' / 'conjured.lib'), |
||||||
|
meson.current_source_dir() / 'lib' / 'source.obj', |
||||||
|
], |
||||||
|
check: true |
||||||
|
) |
||||||
|
|
||||||
|
# Ensure this library can be found |
||||||
|
dep = cc.find_library('conjured', required: true) |
@ -0,0 +1,9 @@ |
|||||||
|
[constants] |
||||||
|
common_args = ['-I@MESON_TEST_ROOT@/include'] |
||||||
|
common_link_args = ['-LIBPATH:@MESON_TEST_ROOT@/lib'] |
||||||
|
|
||||||
|
[properties] |
||||||
|
c_args = common_args |
||||||
|
cpp_args = common_args |
||||||
|
c_link_args = common_link_args |
||||||
|
cpp_link_args = common_link_args |
@ -0,0 +1,3 @@ |
|||||||
|
int func1_in_obj(void) { |
||||||
|
return 0; |
||||||
|
} |
Loading…
Reference in new issue