summaryrefslogtreecommitdiffstats
path: root/test cases/windows/7 dll versioning
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/windows/7 dll versioning
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/windows/7 dll versioning')
-rw-r--r--test cases/windows/7 dll versioning/copyfile.py6
-rw-r--r--test cases/windows/7 dll versioning/exe.orig.c8
-rw-r--r--test cases/windows/7 dll versioning/lib.c6
-rw-r--r--test cases/windows/7 dll versioning/meson.build54
-rw-r--r--test cases/windows/7 dll versioning/test.json34
5 files changed, 108 insertions, 0 deletions
diff --git a/test cases/windows/7 dll versioning/copyfile.py b/test cases/windows/7 dll versioning/copyfile.py
new file mode 100644
index 0000000..ff42ac3
--- /dev/null
+++ b/test cases/windows/7 dll versioning/copyfile.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import sys
+import shutil
+
+shutil.copyfile(sys.argv[1], sys.argv[2])
diff --git a/test cases/windows/7 dll versioning/exe.orig.c b/test cases/windows/7 dll versioning/exe.orig.c
new file mode 100644
index 0000000..1e8e90e
--- /dev/null
+++ b/test cases/windows/7 dll versioning/exe.orig.c
@@ -0,0 +1,8 @@
+int myFunc (void);
+
+int main(void)
+{
+ if (myFunc() == 55)
+ return 0;
+ return 1;
+}
diff --git a/test cases/windows/7 dll versioning/lib.c b/test cases/windows/7 dll versioning/lib.c
new file mode 100644
index 0000000..37e0d1d
--- /dev/null
+++ b/test cases/windows/7 dll versioning/lib.c
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int myFunc(void) {
+ return 55;
+}
diff --git a/test cases/windows/7 dll versioning/meson.build b/test cases/windows/7 dll versioning/meson.build
new file mode 100644
index 0000000..983c2c4
--- /dev/null
+++ b/test cases/windows/7 dll versioning/meson.build
@@ -0,0 +1,54 @@
+project('msvc dll versioning', 'c')
+
+cc = meson.get_compiler('c')
+
+# Test that we create correctly-named dll and import lib files,
+# and also install them in the right place
+some = shared_library('some', 'lib.c',
+ version : '1.2.3',
+ soversion : '0',
+ install : true)
+
+noversion = shared_library('noversion', 'lib.c',
+ install : true)
+
+onlyversion = shared_library('onlyversion', 'lib.c',
+ version : '1.4.5',
+ install : true)
+
+onlysoversion = shared_library('onlysoversion', 'lib.c',
+ # Also test that int soversion is acceptable
+ soversion : 5,
+ install : true)
+
+# Hack to make the executables below depend on the shared libraries above
+# without actually adding them as `link_with` dependencies since we want to try
+# linking to them with -lfoo linker arguments.
+cp = find_program('copyfile.py')
+out = custom_target('library-dependency-hack',
+ input : 'exe.orig.c',
+ output : 'exe.c',
+ depends : [some, noversion, onlyversion, onlysoversion],
+ command : [cp, '@INPUT@', '@OUTPUT@'])
+
+# Manually test if the linker can find the above libraries
+# i.e., whether they were generated with the right naming scheme
+test('manually linked 1', executable('manuallink1', out,
+ link_args : ['-L.', '-lsome']))
+
+test('manually linked 2', executable('manuallink2', out,
+ link_args : ['-L.', '-lnoversion']))
+
+test('manually linked 3', executable('manuallink3', out,
+ link_args : ['-L.', '-lonlyversion']))
+
+test('manually linked 4', executable('manuallink4', out,
+ link_args : ['-L.', '-lonlysoversion']))
+
+shared_library('customdir', 'lib.c',
+ install : true,
+ install_dir : get_option('libexecdir'))
+
+shared_module('module', 'lib.c',
+ install : true,
+ install_dir: join_paths(get_option('libdir'), 'modules'))
diff --git a/test cases/windows/7 dll versioning/test.json b/test cases/windows/7 dll versioning/test.json
new file mode 100644
index 0000000..1402925
--- /dev/null
+++ b/test cases/windows/7 dll versioning/test.json
@@ -0,0 +1,34 @@
+{
+ "installed": [
+ {"type": "file", "platform": "msvc", "file": "usr/bin/some-0.dll"},
+ {"type": "pdb", "file": "usr/bin/some-0"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/some.lib"},
+ {"type": "file", "platform": "msvc", "file": "usr/bin/noversion.dll"},
+ {"type": "pdb", "file": "usr/bin/noversion"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/noversion.lib"},
+ {"type": "file", "platform": "msvc", "file": "usr/bin/onlyversion-1.dll"},
+ {"type": "pdb", "file": "usr/bin/onlyversion-1"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/onlyversion.lib"},
+ {"type": "file", "platform": "msvc", "file": "usr/bin/onlysoversion-5.dll"},
+ {"type": "pdb", "file": "usr/bin/onlysoversion-5"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/onlysoversion.lib"},
+ {"type": "file", "platform": "msvc", "file": "usr/libexec/customdir.dll"},
+ {"type": "file", "platform": "msvc", "file": "usr/libexec/customdir.lib"},
+ {"type": "pdb", "file": "usr/libexec/customdir"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/modules/module.dll"},
+ {"type": "file", "platform": "msvc", "file": "usr/lib/modules/module.lib"},
+ {"type": "pdb", "file": "usr/lib/modules/module"},
+ {"type": "expr", "platform": "gcc", "file": "usr/bin/?libsome-0.dll"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/libsome.dll.a"},
+ {"type": "expr", "platform": "gcc", "file": "usr/bin/?libnoversion.dll"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/libnoversion.dll.a"},
+ {"type": "expr", "platform": "gcc", "file": "usr/bin/?libonlyversion-1.dll"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/libonlyversion.dll.a"},
+ {"type": "expr", "platform": "gcc", "file": "usr/bin/?libonlysoversion-5.dll"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/libonlysoversion.dll.a"},
+ {"type": "expr", "platform": "gcc", "file": "usr/libexec/?libcustomdir.dll"},
+ {"type": "file", "platform": "gcc", "file": "usr/libexec/libcustomdir.dll.a"},
+ {"type": "expr", "platform": "gcc", "file": "usr/lib/modules/?libmodule.dll"},
+ {"type": "file", "platform": "gcc", "file": "usr/lib/modules/libmodule.dll.a"}
+ ]
+}