aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-02-26 21:07:09 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-07-17 19:20:00 +0300
commitf78cf53141a1da1a35fb02324a154f371c488141 (patch)
treea10a2b6f0d9bffe5765c0b7f146ba0af26868a42
parent6119beed4db77529830e466f581591c86e32e0d0 (diff)
downloadmeson-f78cf53141a1da1a35fb02324a154f371c488141.zip
meson-f78cf53141a1da1a35fb02324a154f371c488141.tar.gz
meson-f78cf53141a1da1a35fb02324a154f371c488141.tar.bz2
Created merge_from method for ConfigurationData.
-rw-r--r--mesonbuild/interpreter.py11
-rw-r--r--test cases/common/139 simd/meson.build5
2 files changed, 14 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 63cdf9e..43ddd72 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -161,6 +161,7 @@ class ConfigurationDataHolder(MutableInterpreterObject):
'set_quoted': self.set_quoted_method,
'has': self.has_method,
'get': self.get_method,
+ 'merge_from': self.merge_from_method,
})
def is_used(self):
@@ -221,6 +222,16 @@ class ConfigurationDataHolder(MutableInterpreterObject):
def keys(self):
return self.held_object.values.keys()
+ def merge_from_method(self, args, kwargs):
+ if len(args) != 1:
+ raise InterpreterException('Merge_from takes one positional argument.')
+ from_object = args[0]
+ if not isinstance(from_object, ConfigurationDataHolder):
+ raise InterpreterException('Merge_from argument must be a configuration data object.')
+ from_object = from_object.held_object
+ for k, v in from_object.values.items():
+ self.held_object.values[k] = v
+
# Interpreter objects can not be pickled so we must have
# these wrappers.
diff --git a/test cases/common/139 simd/meson.build b/test cases/common/139 simd/meson.build
index 2b7d722..d84b722 100644
--- a/test cases/common/139 simd/meson.build
+++ b/test cases/common/139 simd/meson.build
@@ -4,6 +4,8 @@ simd = import('simd')
cc = meson.get_compiler('c')
+cdata = configuration_data()
+
if not meson.is_cross_build() and host_machine.cpu_family() == 'arm' and cc.get_id() == 'clang'
message('Adding -march=armv7 because assuming that this build happens on Raspbian.')
message('Its Clang seems to be misconfigured and does not support NEON by default.')
@@ -29,8 +31,7 @@ rval = simd.check('mysimds',
compiler : cc)
simdlibs = rval[0]
-# FIXME add cdata1.merge_from(cdata2)
-cdata = rval[1]
+cdata.merge_from(rval[1])
configure_file(output : 'simdconfig.h',
configuration : cdata)