diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2024-04-14 12:58:30 +0300 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-02-13 23:57:48 +0200 |
| commit | d37d649b08b832d52fa684bc0506829fb40d5261 (patch) | |
| tree | c66e1461e91d6349457b826978e866fdabb19de1 /test cases/unit | |
| parent | ea678ed82938ceac00682b2695b57193d36b71b4 (diff) | |
| download | meson-d37d649b08b832d52fa684bc0506829fb40d5261.tar.gz | |
Make all Meson level options overridable per subproject.
Diffstat (limited to 'test cases/unit')
9 files changed, 88 insertions, 0 deletions
diff --git a/test cases/unit/123 persp options/meson.build b/test cases/unit/123 persp options/meson.build new file mode 100644 index 000000000..2df4205e4 --- /dev/null +++ b/test cases/unit/123 persp options/meson.build @@ -0,0 +1,24 @@ +project('toplevel', 'c') + +round = get_option('round') +opt = get_option('optimization') +if round == 1 + assert(opt == '1') +elif round == 2 + assert(opt == '1') +elif round == 3 + assert(opt == '1') +elif round == 4 + assert(opt == '3') +elif round == 5 + assert(opt == '3') +elif round == 6 + assert(opt == '3', opt) +else + assert(false, 'Invalid round number') +endif + +executable('toplevel', 'toplevel.c') + +subproject('sub1') +subproject('sub2') diff --git a/test cases/unit/123 persp options/meson.options b/test cases/unit/123 persp options/meson.options new file mode 100644 index 000000000..2bfd08d36 --- /dev/null +++ b/test cases/unit/123 persp options/meson.options @@ -0,0 +1 @@ +option('round', type: 'integer', value: 1, description: 'The test round.') diff --git a/test cases/unit/123 persp options/subprojects/sub1/meson.build b/test cases/unit/123 persp options/subprojects/sub1/meson.build new file mode 100644 index 000000000..5b176189c --- /dev/null +++ b/test cases/unit/123 persp options/subprojects/sub1/meson.build @@ -0,0 +1,22 @@ +project('sub1', 'c') + +round = get_option('round') +opt = get_option('optimization') +if round == 1 + assert(opt == '1') +elif round == 2 + assert(opt == '1') +elif round == 3 + assert(opt == '1') +elif round == 4 + assert(opt == '1') +elif round == 5 + assert(opt == '1') +elif round == 6 + assert(opt == '2') +else + assert(false, 'Invalid round number') +endif + + +executable('sub1', 'sub1.c') diff --git a/test cases/unit/123 persp options/subprojects/sub1/meson.options b/test cases/unit/123 persp options/subprojects/sub1/meson.options new file mode 100644 index 000000000..ba5661a27 --- /dev/null +++ b/test cases/unit/123 persp options/subprojects/sub1/meson.options @@ -0,0 +1 @@ +option('round', type: 'integer', value: 1, description: 'The test round.', yield: true) diff --git a/test cases/unit/123 persp options/subprojects/sub1/sub1.c b/test cases/unit/123 persp options/subprojects/sub1/sub1.c new file mode 100644 index 000000000..4e4b87372 --- /dev/null +++ b/test cases/unit/123 persp options/subprojects/sub1/sub1.c @@ -0,0 +1,6 @@ +#include<stdio.h> + +int main(void) { + printf("This is subproject 1.\n"); + return 0; +} diff --git a/test cases/unit/123 persp options/subprojects/sub2/meson.build b/test cases/unit/123 persp options/subprojects/sub2/meson.build new file mode 100644 index 000000000..e8935bc52 --- /dev/null +++ b/test cases/unit/123 persp options/subprojects/sub2/meson.build @@ -0,0 +1,21 @@ +project('sub2', 'c') + +round = get_option('round') +opt = get_option('optimization') +if round == 1 + assert(opt == '1') +elif round == 2 + assert(opt == '3') +elif round == 3 + assert(opt == '2') +elif round == 4 + assert(opt == '2') +elif round == 5 + assert(opt == '1') +elif round == 6 + assert(opt == '2') +else + assert(false, 'Invalid round number') +endif + +executable('sub2', 'sub2.c') diff --git a/test cases/unit/123 persp options/subprojects/sub2/meson.options b/test cases/unit/123 persp options/subprojects/sub2/meson.options new file mode 100644 index 000000000..ba5661a27 --- /dev/null +++ b/test cases/unit/123 persp options/subprojects/sub2/meson.options @@ -0,0 +1 @@ +option('round', type: 'integer', value: 1, description: 'The test round.', yield: true) diff --git a/test cases/unit/123 persp options/subprojects/sub2/sub2.c b/test cases/unit/123 persp options/subprojects/sub2/sub2.c new file mode 100644 index 000000000..4e4b87372 --- /dev/null +++ b/test cases/unit/123 persp options/subprojects/sub2/sub2.c @@ -0,0 +1,6 @@ +#include<stdio.h> + +int main(void) { + printf("This is subproject 1.\n"); + return 0; +} diff --git a/test cases/unit/123 persp options/toplevel.c b/test cases/unit/123 persp options/toplevel.c new file mode 100644 index 000000000..5748d6b37 --- /dev/null +++ b/test cases/unit/123 persp options/toplevel.c @@ -0,0 +1,6 @@ +#include<stdio.h> + +int main(void) { + printf("This is the top level project.\n"); + return 0; +} |
