Created merge_from method for ConfigurationData.

pull/1374/head
Jussi Pakkanen 8 years ago
parent 6119beed4d
commit f78cf53141
  1. 11
      mesonbuild/interpreter.py
  2. 5
      test cases/common/139 simd/meson.build

@ -161,6 +161,7 @@ class ConfigurationDataHolder(MutableInterpreterObject):
'set_quoted': self.set_quoted_method, 'set_quoted': self.set_quoted_method,
'has': self.has_method, 'has': self.has_method,
'get': self.get_method, 'get': self.get_method,
'merge_from': self.merge_from_method,
}) })
def is_used(self): def is_used(self):
@ -221,6 +222,16 @@ class ConfigurationDataHolder(MutableInterpreterObject):
def keys(self): def keys(self):
return self.held_object.values.keys() 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 # Interpreter objects can not be pickled so we must have
# these wrappers. # these wrappers.

@ -4,6 +4,8 @@ simd = import('simd')
cc = meson.get_compiler('c') 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' 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('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.') message('Its Clang seems to be misconfigured and does not support NEON by default.')
@ -29,8 +31,7 @@ rval = simd.check('mysimds',
compiler : cc) compiler : cc)
simdlibs = rval[0] simdlibs = rval[0]
# FIXME add cdata1.merge_from(cdata2) cdata.merge_from(rval[1])
cdata = rval[1]
configure_file(output : 'simdconfig.h', configure_file(output : 'simdconfig.h',
configuration : cdata) configuration : cdata)

Loading…
Cancel
Save