Get build machine's CPU info too.

pull/214/head
Jussi Pakkanen 10 years ago
parent 463d08d545
commit 37b2a195bd
  1. 20
      interpreter.py
  2. 1
      meson.py

@ -302,13 +302,29 @@ class GeneratedListHolder(InterpreterObject):
def add_file(self, a):
self.held_object.add_file(a)
class Build(InterpreterObject):
class BuildMachine(InterpreterObject):
def __init__(self):
InterpreterObject.__init__(self)
self.methods.update({'name' : self.name_method,
'endian' : self.endian_method,
})
# Python is inconsistent in its platform module.
# It returns different values for the same cpu.
# For x86 it might return 'x86', 'i686' or somesuch.
# Do some canonicalization.
def cpu_method(self, args, kwargs):
trial = platform.machine().lower()
if trial.startswith('i') and trial.endswith('86'):
return 'x86'
# This might be wrong. Maybe we should return the more
# specific string such as 'armv7l'. Need to get user
# feedback first.
if trial.startswith('arm'):
return 'arm'
# Add fixes here as bugs are reported.
return trial
def name_method(self, args, kwargs):
return platform.system().lower()
@ -803,7 +819,7 @@ class Interpreter():
self.sanity_check_ast()
self.variables = {}
self.builtin = {}
self.builtin['build_machine'] = Build()
self.builtin['build_machine'] = BuildMachine()
if not self.build.environment.is_cross_build():
self.builtin['host_machine'] = self.builtin['build_machine']
self.builtin['target_machine'] = self.builtin['build_machine']

@ -126,6 +126,7 @@ itself as required.'''
mlog.log('Build type:', mlog.bold('native build'))
b = build.Build(env)
intr = interpreter.Interpreter(b)
mlog.log('Build machine cpu:', mlog.bold(intr.builtin['build_machine'].cpu_method([], {})))
if env.is_cross_build():
mlog.log('Host machine cpu:', mlog.bold(intr.builtin['host_machine'].info['cpu']))
mlog.log('Target machine cpu:', mlog.bold(intr.builtin['target_machine'].info['cpu']))

Loading…
Cancel
Save