aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-07-24 18:46:13 +0400
committerJussi Pakkanen <jpakkane@gmail.com>2019-08-04 21:44:52 +0300
commit8ba14057421928b15a485214ac7023d246bfab7c (patch)
tree108c5faf51aa12b29c9a285e60e7a8ff13d57d3d /test cases
parent940ebd658b9e7bf1679bd8fbfbcb6b429d80424a (diff)
downloadmeson-8ba14057421928b15a485214ac7023d246bfab7c.zip
meson-8ba14057421928b15a485214ac7023d246bfab7c.tar.gz
meson-8ba14057421928b15a485214ac7023d246bfab7c.tar.bz2
sourceset: add all_dependencies() method
'if_true' sources should be built with their dependencies, as illustrated by test case change. Ideally, I think we would want only the files with the dependencies to be built with the flags, but that would probably change the way sourceset are used.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/222 source set realistic example/meson.build8
-rw-r--r--test cases/common/222 source set realistic example/zlib.cc6
2 files changed, 9 insertions, 5 deletions
diff --git a/test cases/common/222 source set realistic example/meson.build b/test cases/common/222 source set realistic example/meson.build
index 2a9475a..ea91e29 100644
--- a/test cases/common/222 source set realistic example/meson.build
+++ b/test cases/common/222 source set realistic example/meson.build
@@ -11,14 +11,15 @@ endif
ss = import('sourceset')
kconfig = import('unstable-kconfig')
-zlib = dependency('zlib', version : '>=1.2.8', required: false)
+zlib = declare_dependency(compile_args: '-DZLIB=1')
+another = declare_dependency(compile_args: '-DANOTHER=1')
not_found = dependency('not-found', required: false)
common = ss.source_set()
specific = ss.source_set()
common.add(files('main.cc'))
-common.add(when: zlib, if_true: files('zlib.cc'))
+common.add(when: [zlib, another], if_true: files('zlib.cc'))
common.add(when: not_found,
if_true: files('was-found.cc'),
if_false: files('not-found.cc'))
@@ -31,7 +32,8 @@ if meson.is_unity()
common = ss.source_set()
endif
-common_lib = static_library('common', common.all_sources())
+common_lib = static_library('common', common.all_sources(),
+ dependencies: common.all_dependencies())
targets = [ 'arm', 'aarch64', 'x86' ]
target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' }
diff --git a/test cases/common/222 source set realistic example/zlib.cc b/test cases/common/222 source set realistic example/zlib.cc
index 909d744..434e0b7 100644
--- a/test cases/common/222 source set realistic example/zlib.cc
+++ b/test cases/common/222 source set realistic example/zlib.cc
@@ -6,8 +6,10 @@ struct ZLibDependency : Dependency {
};
void ZLibDependency::initialize() {
- std::cout << ANSI_START << "hello from zlib"
- << ANSI_END << std::endl;
+ if (ZLIB && ANOTHER) {
+ std::cout << ANSI_START << "hello from zlib"
+ << ANSI_END << std::endl;
+ }
}
ZLibDependency zlib;