From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- .../linuxlike/12 subprojects in subprojects/main.c | 9 +++++++++ .../linuxlike/12 subprojects in subprojects/meson.build | 9 +++++++++ .../12 subprojects in subprojects/subprojects/a/a.c | 5 +++++ .../12 subprojects in subprojects/subprojects/a/a.h | 1 + .../subprojects/a/meson.build | 11 +++++++++++ .../12 subprojects in subprojects/subprojects/b/b.c | 11 +++++++++++ .../12 subprojects in subprojects/subprojects/b/b.h | 1 + .../subprojects/b/meson.build | 17 +++++++++++++++++ .../12 subprojects in subprojects/subprojects/c/c.h | 3 +++ .../subprojects/c/meson.build | 5 +++++ 10 files changed, 72 insertions(+) create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/main.c create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/meson.build create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h create mode 100644 meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build (limited to 'meson/test cases/linuxlike/12 subprojects in subprojects') diff --git a/meson/test cases/linuxlike/12 subprojects in subprojects/main.c b/meson/test cases/linuxlike/12 subprojects in subprojects/main.c new file mode 100644 index 000000000..74523173d --- /dev/null +++ b/meson/test cases/linuxlike/12 subprojects in subprojects/main.c @@ -0,0 +1,9 @@ +#include +#include "a.h" +#include "b.h" + +int main(void) { + int life = a_fun() + b_fun(); + printf("%d\n", life); + return 0; +} diff --git a/meson/test cases/linuxlike/12 subprojects in subprojects/meson.build b/meson/test cases/linuxlike/12 subprojects in subprojects/meson.build new file mode 100644 index 000000000..40141494e --- /dev/null +++ b/meson/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/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c new file mode 100644 index 000000000..f7dd126fe --- /dev/null +++ b/meson/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/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h new file mode 100644 index 000000000..9de0deb2c --- /dev/null +++ b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h @@ -0,0 +1 @@ +int a_fun(void); diff --git a/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build new file mode 100644 index 000000000..5f579a372 --- /dev/null +++ b/meson/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/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c new file mode 100644 index 000000000..45c9348f7 --- /dev/null +++ b/meson/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/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h new file mode 100644 index 000000000..47b84d412 --- /dev/null +++ b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h @@ -0,0 +1 @@ +int b_fun(void); diff --git a/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build new file mode 100644 index 000000000..80903f3b1 --- /dev/null +++ b/meson/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/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h new file mode 100644 index 000000000..b2e3f9b21 --- /dev/null +++ b/meson/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/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build b/meson/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build new file mode 100644 index 000000000..7184933b2 --- /dev/null +++ b/meson/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('.') +) -- cgit 1.2.3-korg