diff options
| author | Thibault Saunier <tsaunier@igalia.com> | 2018-07-13 13:29:41 -0400 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-08-27 21:37:18 +0300 |
| commit | 731906504efb57aa9ae86685501f1d3a0aa22121 (patch) | |
| tree | f85fe896a96cee352dae1d887f690eaabf8c761b /test cases | |
| parent | 899b0aae9f9afacccfd5963e84df6634e9835b5c (diff) | |
| download | meson-731906504efb57aa9ae86685501f1d3a0aa22121.tar.gz | |
Add a `required` argument to `subproject`
Allowing to use the new "feature" option type and allowing not to fail
on subproject if it is not necessary to fail.
By default subprojects are "required" so previous behaviour is not
changed.
Fixes #3880
Diffstat (limited to 'test cases')
12 files changed, 60 insertions, 0 deletions
diff --git a/test cases/common/206 subproject with features/meson.build b/test cases/common/206 subproject with features/meson.build new file mode 100644 index 000000000..5bdfefbc0 --- /dev/null +++ b/test cases/common/206 subproject with features/meson.build @@ -0,0 +1,17 @@ +project('proj', 'c') + +auto_subproj = subproject('sub', required: get_option('use-subproject')) +assert(auto_subproj.found(), 'Subproject should always be buildable and thus found') + +auto_dep = dependency('', fallback: ['sub', 'libSub'], required: true) +assert(auto_dep.found() == true, 'Subproject is required and foundable, dependency should be found.') + +disabled_subproj = subproject('disabled_sub', required: get_option('disabled-subproject')) +assert(disabled_subproj.found() == false, 'Disabled subproject should be NOT found') + +disabled_dep = dependency('', fallback: ['disabled_sub', 'libSub'], required: false) +assert(disabled_dep.found() == false, 'Subprojetc was disabled, it should never be built.') +nothing = executable('nothing', 'nothing.c', dependencies: [disabled_dep]) + +subproj_with_missing_dep = subproject('auto_sub_with_missing_dep', required: get_option('auto-sub-with-missing-dep')) +assert(subproj_with_missing_dep.found() == false, 'Subproject with required=auto and missing dependency should be NOT found') diff --git a/test cases/common/206 subproject with features/meson_options.txt b/test cases/common/206 subproject with features/meson_options.txt new file mode 100644 index 000000000..a46e5fbf5 --- /dev/null +++ b/test cases/common/206 subproject with features/meson_options.txt @@ -0,0 +1,3 @@ +option('use-subproject', type : 'feature', value : 'auto') +option('disabled-subproject', type : 'feature', value : 'disabled') +option('auto-sub-with-missing-dep', type : 'feature', value : 'auto') diff --git a/test cases/common/206 subproject with features/nothing.c b/test cases/common/206 subproject with features/nothing.c new file mode 100644 index 000000000..77750c217 --- /dev/null +++ b/test cases/common/206 subproject with features/nothing.c @@ -0,0 +1,4 @@ +int main(int argc, char const *argv[]) +{ + return 0; +}
\ No newline at end of file diff --git a/test cases/common/206 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build b/test cases/common/206 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build new file mode 100644 index 000000000..fa6b011ea --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/auto_sub_with_missing_dep/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') + +dependency('no_way_this_exists', required: true)
\ No newline at end of file diff --git a/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/meson.build b/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/meson.build new file mode 100644 index 000000000..933001aeb --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/meson.build @@ -0,0 +1,3 @@ +lib = static_library('sub', 'sub.c') + +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib)
\ No newline at end of file diff --git a/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/sub.c b/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/sub.c new file mode 100644 index 000000000..068a5b89c --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/sub.h b/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/sub.h new file mode 100644 index 000000000..f1ab0e19d --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/disabled_sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif diff --git a/test cases/common/206 subproject with features/subprojects/disabled_sub/meson.build b/test cases/common/206 subproject with features/subprojects/disabled_sub/meson.build new file mode 100644 index 000000000..65fef032b --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/disabled_sub/meson.build @@ -0,0 +1,3 @@ +project('disabled_sub', 'c') + +subdir('lib')
\ No newline at end of file diff --git a/test cases/common/206 subproject with features/subprojects/sub/lib/meson.build b/test cases/common/206 subproject with features/subprojects/sub/lib/meson.build new file mode 100644 index 000000000..731d22bfb --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/sub/lib/meson.build @@ -0,0 +1,2 @@ +lib = static_library('sub', 'sub.c') +libSub = declare_dependency(include_directories: include_directories('.'), link_with: lib) diff --git a/test cases/common/206 subproject with features/subprojects/sub/lib/sub.c b/test cases/common/206 subproject with features/subprojects/sub/lib/sub.c new file mode 100644 index 000000000..ed78306eb --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/sub/lib/sub.c @@ -0,0 +1,5 @@ +#include "sub.h" + +int sub() { + return 0; +} diff --git a/test cases/common/206 subproject with features/subprojects/sub/lib/sub.h b/test cases/common/206 subproject with features/subprojects/sub/lib/sub.h new file mode 100644 index 000000000..f1ab0e19d --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/sub/lib/sub.h @@ -0,0 +1,6 @@ +#ifndef SUB_H +#define SUB_H + +int sub(); + +#endif diff --git a/test cases/common/206 subproject with features/subprojects/sub/meson.build b/test cases/common/206 subproject with features/subprojects/sub/meson.build new file mode 100644 index 000000000..31882ac4c --- /dev/null +++ b/test cases/common/206 subproject with features/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub', 'c') + +subdir('lib')
\ No newline at end of file |
