diff --git a/test cases/windows/22 msvc library argument order/lib/.gitignore b/test cases/windows/22 msvc library argument order/lib/.gitignore new file mode 100644 index 000000000..b072cc190 --- /dev/null +++ b/test cases/windows/22 msvc library argument order/lib/.gitignore @@ -0,0 +1,2 @@ +*.obj +*.lib diff --git a/test cases/windows/22 msvc library argument order/meson.build b/test cases/windows/22 msvc library argument order/meson.build new file mode 100644 index 000000000..39a6efe7b --- /dev/null +++ b/test cases/windows/22 msvc library argument order/meson.build @@ -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) diff --git a/test cases/windows/22 msvc library argument order/nativefile.ini.in b/test cases/windows/22 msvc library argument order/nativefile.ini.in new file mode 100644 index 000000000..2beab5148 --- /dev/null +++ b/test cases/windows/22 msvc library argument order/nativefile.ini.in @@ -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 diff --git a/test cases/windows/22 msvc library argument order/source.c b/test cases/windows/22 msvc library argument order/source.c new file mode 100644 index 000000000..1dc08e168 --- /dev/null +++ b/test cases/windows/22 msvc library argument order/source.c @@ -0,0 +1,3 @@ +int func1_in_obj(void) { + return 0; +}