summaryrefslogtreecommitdiffstats
path: root/test cases/common/79 same basename
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/common/79 same basename
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.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/common/79 same basename')
-rw-r--r--test cases/common/79 same basename/exe1.c5
-rw-r--r--test cases/common/79 same basename/exe2.c5
-rw-r--r--test cases/common/79 same basename/lib.c22
-rw-r--r--test cases/common/79 same basename/meson.build14
-rw-r--r--test cases/common/79 same basename/sharedsub/meson.build1
-rw-r--r--test cases/common/79 same basename/staticsub/meson.build3
6 files changed, 50 insertions, 0 deletions
diff --git a/test cases/common/79 same basename/exe1.c b/test cases/common/79 same basename/exe1.c
new file mode 100644
index 0000000..128f2bb
--- /dev/null
+++ b/test cases/common/79 same basename/exe1.c
@@ -0,0 +1,5 @@
+int func(void);
+
+int main(void) {
+ return func();
+}
diff --git a/test cases/common/79 same basename/exe2.c b/test cases/common/79 same basename/exe2.c
new file mode 100644
index 0000000..d2d8995
--- /dev/null
+++ b/test cases/common/79 same basename/exe2.c
@@ -0,0 +1,5 @@
+int func(void);
+
+int main(void) {
+ return func() == 1 ? 0 : 1;
+}
diff --git a/test cases/common/79 same basename/lib.c b/test cases/common/79 same basename/lib.c
new file mode 100644
index 0000000..5b9122b
--- /dev/null
+++ b/test cases/common/79 same basename/lib.c
@@ -0,0 +1,22 @@
+#if defined _WIN32 || defined __CYGWIN__
+#define DLL_PUBLIC __declspec(dllexport)
+#else
+ #if defined __GNUC__
+ #define DLL_PUBLIC __attribute__ ((visibility("default")))
+ #else
+ #pragma message ("Compiler does not support symbol visibility.")
+ #define DLL_PUBLIC
+ #endif
+#endif
+
+#if defined SHAR
+int DLL_PUBLIC func(void) {
+ return 1;
+}
+#elif defined STAT
+int func(void) {
+ return 0;
+}
+#else
+#error "Missing type definition."
+#endif
diff --git a/test cases/common/79 same basename/meson.build b/test cases/common/79 same basename/meson.build
new file mode 100644
index 0000000..856c536
--- /dev/null
+++ b/test cases/common/79 same basename/meson.build
@@ -0,0 +1,14 @@
+project('same basename', 'c')
+
+subdir('sharedsub')
+subdir('staticsub')
+
+# Use the same source file to check that each top level target
+# has its own unique working directory. If they don't
+# then the .o files will clobber each other.
+
+exe1 = executable('name', 'exe1.c', link_with : stlib)
+exe2 = executable('name2', 'exe2.c', link_with : shlib)
+
+test('static', exe1)
+test('shared', exe2)
diff --git a/test cases/common/79 same basename/sharedsub/meson.build b/test cases/common/79 same basename/sharedsub/meson.build
new file mode 100644
index 0000000..29654a9
--- /dev/null
+++ b/test cases/common/79 same basename/sharedsub/meson.build
@@ -0,0 +1 @@
+shlib = shared_library('name', '../lib.c', c_args : '-DSHAR')
diff --git a/test cases/common/79 same basename/staticsub/meson.build b/test cases/common/79 same basename/staticsub/meson.build
new file mode 100644
index 0000000..5e5242e
--- /dev/null
+++ b/test cases/common/79 same basename/staticsub/meson.build
@@ -0,0 +1,3 @@
+# On Windows a static lib is now libfoo.a, so it does not conflict with foo.lib
+# from the shared library above
+stlib = static_library('name', '../lib.c', c_args : '-DSTAT')