aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/common/145 recursive linking/3rdorderdeps
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/145 recursive linking/3rdorderdeps
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/common/145 recursive linking/3rdorderdeps')
-rw-r--r--meson/test cases/common/145 recursive linking/3rdorderdeps/lib.c.in8
-rw-r--r--meson/test cases/common/145 recursive linking/3rdorderdeps/main.c.in16
-rw-r--r--meson/test cases/common/145 recursive linking/3rdorderdeps/meson.build49
3 files changed, 73 insertions, 0 deletions
diff --git a/meson/test cases/common/145 recursive linking/3rdorderdeps/lib.c.in b/meson/test cases/common/145 recursive linking/3rdorderdeps/lib.c.in
new file mode 100644
index 000000000..461f85995
--- /dev/null
+++ b/meson/test cases/common/145 recursive linking/3rdorderdeps/lib.c.in
@@ -0,0 +1,8 @@
+#include "../lib.h"
+
+int get_@DEPENDENCY@dep_value (void);
+
+SYMBOL_EXPORT
+int get_@LIBTYPE@@DEPENDENCY@dep_value (void) {
+ return get_@DEPENDENCY@dep_value ();
+}
diff --git a/meson/test cases/common/145 recursive linking/3rdorderdeps/main.c.in b/meson/test cases/common/145 recursive linking/3rdorderdeps/main.c.in
new file mode 100644
index 000000000..643c24694
--- /dev/null
+++ b/meson/test cases/common/145 recursive linking/3rdorderdeps/main.c.in
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+#include "../lib.h"
+
+SYMBOL_IMPORT int get_@LIBTYPE@@DEPENDENCY@dep_value (void);
+
+int main(void) {
+ int val;
+
+ val = get_@LIBTYPE@@DEPENDENCY@dep_value ();
+ if (val != @VALUE@) {
+ printf("@LIBTYPE@@DEPENDENCY@ was %i instead of @VALUE@\n", val);
+ return -1;
+ }
+ return 0;
+}
diff --git a/meson/test cases/common/145 recursive linking/3rdorderdeps/meson.build b/meson/test cases/common/145 recursive linking/3rdorderdeps/meson.build
new file mode 100644
index 000000000..4c5ac7307
--- /dev/null
+++ b/meson/test cases/common/145 recursive linking/3rdorderdeps/meson.build
@@ -0,0 +1,49 @@
+dep3_libs = []
+
+# Permutate all combinations of shared and static libraries up to three levels
+# executable -> shared -> static -> shared (etc)
+foreach dep2 : ['sh', 'st']
+ foreach dep1 : ['sh', 'st']
+ foreach libtype : ['sh', 'st']
+ name = libtype + dep1 + dep2
+ if dep2 == 'sh'
+ libret = 1
+ elif dep2 == 'st'
+ libret = 2
+ else
+ error('Unknown dep2 "@0@"'.format(dep2))
+ endif
+
+ if libtype == 'sh'
+ target = 'shared_library'
+ build_args = []
+ elif libtype == 'st'
+ target = 'static_library'
+ build_args = ['-DMESON_STATIC_BUILD']
+ else
+ error('Unknown libtype "@0@"'.format(libtype))
+ endif
+
+ cdata = configuration_data()
+ cdata.set('DEPENDENCY', dep1 + dep2)
+ cdata.set('LIBTYPE', libtype)
+ cdata.set('VALUE', libret)
+
+ lib_c = configure_file(input : 'lib.c.in',
+ output : name + '-lib.c',
+ configuration : cdata)
+ dep = get_variable(dep1 + dep2 + 'dep')
+ dep3_lib = build_target(name, lib_c, link_with : dep,
+ target_type : target,
+ c_args : build_args)
+ dep3_libs += [dep3_lib]
+
+ main_c = configure_file(input : 'main.c.in',
+ output : name + '-main.c',
+ configuration : cdata)
+ dep3_bin = executable(name + '_test', main_c, link_with : dep3_lib,
+ c_args : build_args)
+ test(name + 'test', dep3_bin)
+ endforeach
+ endforeach
+endforeach