aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/common/79 same basename
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/common/79 same basename
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/79 same basename')
-rw-r--r--meson/test cases/common/79 same basename/exe1.c5
-rw-r--r--meson/test cases/common/79 same basename/exe2.c5
-rw-r--r--meson/test cases/common/79 same basename/lib.c23
-rw-r--r--meson/test cases/common/79 same basename/meson.build14
-rw-r--r--meson/test cases/common/79 same basename/sharedsub/meson.build1
-rw-r--r--meson/test cases/common/79 same basename/staticsub/meson.build3
6 files changed, 51 insertions, 0 deletions
diff --git a/meson/test cases/common/79 same basename/exe1.c b/meson/test cases/common/79 same basename/exe1.c
new file mode 100644
index 000000000..128f2bb15
--- /dev/null
+++ b/meson/test cases/common/79 same basename/exe1.c
@@ -0,0 +1,5 @@
+int func(void);
+
+int main(void) {
+ return func();
+}
diff --git a/meson/test cases/common/79 same basename/exe2.c b/meson/test cases/common/79 same basename/exe2.c
new file mode 100644
index 000000000..d2d89956d
--- /dev/null
+++ b/meson/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/meson/test cases/common/79 same basename/lib.c b/meson/test cases/common/79 same basename/lib.c
new file mode 100644
index 000000000..b3798e99e
--- /dev/null
+++ b/meson/test cases/common/79 same basename/lib.c
@@ -0,0 +1,23 @@
+#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/meson/test cases/common/79 same basename/meson.build b/meson/test cases/common/79 same basename/meson.build
new file mode 100644
index 000000000..856c536c0
--- /dev/null
+++ b/meson/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/meson/test cases/common/79 same basename/sharedsub/meson.build b/meson/test cases/common/79 same basename/sharedsub/meson.build
new file mode 100644
index 000000000..29654a94d
--- /dev/null
+++ b/meson/test cases/common/79 same basename/sharedsub/meson.build
@@ -0,0 +1 @@
+shlib = shared_library('name', '../lib.c', c_args : '-DSHAR')
diff --git a/meson/test cases/common/79 same basename/staticsub/meson.build b/meson/test cases/common/79 same basename/staticsub/meson.build
new file mode 100644
index 000000000..5e5242e06
--- /dev/null
+++ b/meson/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')