summaryrefslogtreecommitdiffstats
path: root/test cases/linuxlike/12 subprojects in subprojects
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/linuxlike/12 subprojects in subprojects
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/linuxlike/12 subprojects in subprojects')
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/main.c9
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/meson.build9
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c5
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h1
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build11
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c11
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h1
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build17
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h3
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build5
10 files changed, 72 insertions, 0 deletions
diff --git a/test cases/linuxlike/12 subprojects in subprojects/main.c b/test cases/linuxlike/12 subprojects in subprojects/main.c
new file mode 100644
index 0000000..7452317
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include "a.h"
+#include "b.h"
+
+int main(void) {
+ int life = a_fun() + b_fun();
+ printf("%d\n", life);
+ return 0;
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/meson.build b/test cases/linuxlike/12 subprojects in subprojects/meson.build
new file mode 100644
index 0000000..4014149
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/meson.build
@@ -0,0 +1,9 @@
+project('super', 'c')
+
+# A will use version 1 of C
+a_dep = dependency('a', fallback: ['a', 'a_dep'])
+
+# B has an optional dependency on C version 2 and will therefore work
+b_dep = dependency('b', fallback: ['b', 'b_dep'])
+
+main = executable('main', files('main.c'), dependencies: [a_dep, b_dep])
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c
new file mode 100644
index 0000000..f7dd126
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c
@@ -0,0 +1,5 @@
+#include "c.h"
+
+int a_fun(void) {
+ return c_fun();
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h
new file mode 100644
index 0000000..9de0deb
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h
@@ -0,0 +1 @@
+int a_fun(void);
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build
new file mode 100644
index 0000000..5f579a3
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build
@@ -0,0 +1,11 @@
+project('a', 'c', version:'1.0')
+
+c_dep = dependency('c', version:'1', fallback: ['c', 'c_dep'])
+
+alib = library('a', 'a.c',
+ dependencies: c_dep)
+
+a_dep = declare_dependency(
+ link_with: alib,
+ include_directories: include_directories('.'),
+)
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c
new file mode 100644
index 0000000..45c9348
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c
@@ -0,0 +1,11 @@
+#if defined(WITH_C)
+#include "c.h"
+#endif
+
+int b_fun(void){
+#if defined(WITH_C)
+return c_fun();
+#else
+return 0;
+#endif
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h
new file mode 100644
index 0000000..47b84d4
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h
@@ -0,0 +1 @@
+int b_fun(void);
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build
new file mode 100644
index 0000000..80903f3
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build
@@ -0,0 +1,17 @@
+project('b', 'c')
+
+c_dep = dependency('c', version:'2', fallback: ['c', 'c_dep'], required: false)
+
+assert(c_dep.found() == false, 'C project has the wrong version and should not be found')
+
+if c_dep.found()
+ add_global_arguments('-DWITH_C', language: 'c')
+endif
+
+blib = library('b', 'b.c',
+ dependencies: c_dep)
+
+b_dep = declare_dependency(
+ link_with: blib,
+ include_directories: include_directories('.'),
+)
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h
new file mode 100644
index 0000000..b2e3f9b
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h
@@ -0,0 +1,3 @@
+static int c_fun(void){
+ return 3;
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build
new file mode 100644
index 0000000..7184933
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build
@@ -0,0 +1,5 @@
+project('c', 'c', version:'1')
+
+c_dep = declare_dependency(
+ include_directories: include_directories('.')
+)