diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-26 16:52:13 +0300 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-26 23:39:15 +0100 |
| commit | e75e3976facda7de244fbb9a02eebf0d043ea1c8 (patch) | |
| tree | dab22f95b5c837a70b1b4164d97ff351a49ffd81 /test cases/common/178 bothlibraries | |
| parent | 53fe7c2f0a51697cd57628753852dd3f8711becf (diff) | |
| download | meson-e75e3976facda7de244fbb9a02eebf0d043ea1c8.tar.gz | |
Condense test directory names.
Diffstat (limited to 'test cases/common/178 bothlibraries')
| -rw-r--r-- | test cases/common/178 bothlibraries/libfile.c | 7 | ||||
| -rw-r--r-- | test cases/common/178 bothlibraries/main.c | 8 | ||||
| -rw-r--r-- | test cases/common/178 bothlibraries/meson.build | 25 | ||||
| -rw-r--r-- | test cases/common/178 bothlibraries/mylib.h | 13 |
4 files changed, 53 insertions, 0 deletions
diff --git a/test cases/common/178 bothlibraries/libfile.c b/test cases/common/178 bothlibraries/libfile.c new file mode 100644 index 000000000..f5e228ec1 --- /dev/null +++ b/test cases/common/178 bothlibraries/libfile.c @@ -0,0 +1,7 @@ +#include "mylib.h" + +DO_EXPORT int retval = 42; + +DO_EXPORT int func(void) { + return retval; +} diff --git a/test cases/common/178 bothlibraries/main.c b/test cases/common/178 bothlibraries/main.c new file mode 100644 index 000000000..8237bae0a --- /dev/null +++ b/test cases/common/178 bothlibraries/main.c @@ -0,0 +1,8 @@ +#include "mylib.h" + +DO_IMPORT int func(void); +DO_IMPORT int retval; + +int main(void) { + return func() == retval ? 0 : 1; +} diff --git a/test cases/common/178 bothlibraries/meson.build b/test cases/common/178 bothlibraries/meson.build new file mode 100644 index 000000000..0bfba76ed --- /dev/null +++ b/test cases/common/178 bothlibraries/meson.build @@ -0,0 +1,25 @@ +project('both libraries linking test', 'c') + +both_libs = both_libraries('mylib', 'libfile.c') +exe_shared = executable('prog-shared', 'main.c', link_with : both_libs.get_shared_lib()) +exe_static = executable('prog-static', 'main.c', + c_args : ['-DSTATIC_COMPILATION'], + link_with : both_libs.get_static_lib()) +exe_both = executable('prog-both', 'main.c', link_with : both_libs) + +test('runtest-shared', exe_shared) +test('runtest-static', exe_static) +test('runtest-both', exe_both) + +# Same as above, but using build_target() +both_libs2 = build_target('mylib2', 'libfile.c', target_type: 'both_libraries') +exe_shared2 = executable('prog-shared2', 'main.c', + link_with : both_libs2.get_shared_lib()) +exe_static2 = executable('prog-static2', 'main.c', + c_args : ['-DSTATIC_COMPILATION'], + link_with : both_libs2.get_static_lib()) +exe_both2 = executable('prog-both2', 'main.c', link_with : both_libs2) + +test('runtest-shared-2', exe_shared2) +test('runtest-static-2', exe_static2) +test('runtest-both-2', exe_both2) diff --git a/test cases/common/178 bothlibraries/mylib.h b/test cases/common/178 bothlibraries/mylib.h new file mode 100644 index 000000000..1038a0142 --- /dev/null +++ b/test cases/common/178 bothlibraries/mylib.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef _WIN32 + #ifdef STATIC_COMPILATION + #define DO_IMPORT extern + #else + #define DO_IMPORT __declspec(dllimport) + #endif + #define DO_EXPORT __declspec(dllexport) +#else + #define DO_IMPORT extern + #define DO_EXPORT +#endif |
