mirror of
https://github.com/mesonbuild/meson.git
synced 2026-11-06 05:16:42 +00:00
Added cpu family property to system information.
This commit is contained in:
1 parent
1c186d4a30
commit
572ce0f451
6 files changed
+20
-7
No files matched your search
@@ -21,6 +21,7 @@ has_function_hfkerhisadf = false
|
||||
|
||||
[host_machine]
|
||||
system = 'ios'
|
||||
cpu_family = 'arm'
|
||||
cpu = 'armv7'
|
||||
endian = 'little'
|
||||
|
||||
@@ -15,5 +15,6 @@ has_function_hfkerhisadf = false
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu = 'arm'
|
||||
cpu_family = 'arm'
|
||||
cpu = 'armv7' # Not sure if correct.
|
||||
endian = 'little'
|
||||
@@ -8,5 +8,6 @@
|
||||
|
||||
[target_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'mips'
|
||||
cpu = 'mips'
|
||||
endian = 'little'
|
||||
@@ -13,10 +13,12 @@ root = '/usr/i686-w64-mingw32'
|
||||
|
||||
[host_machine]
|
||||
system = 'windows'
|
||||
cpu = 'x86'
|
||||
cpu_family = 'x86'
|
||||
cpu = 'i686'
|
||||
endian = 'little'
|
||||
|
||||
[target_machine]
|
||||
system = 'darwin'
|
||||
cpu = 'arm'
|
||||
cpu_family = 'arm'
|
||||
cpu = 'armv7h' # Don't know if this is correct.
|
||||
endian = 'little'
|
||||
+9
-4
@@ -308,6 +308,7 @@ class BuildMachine(InterpreterObject):
|
||||
def __init__(self):
|
||||
InterpreterObject.__init__(self)
|
||||
self.methods.update({'system' : self.system_method,
|
||||
'cpu_family' : self.cpu_family_method,
|
||||
'cpu' : self.cpu_method,
|
||||
'endian' : self.endian_method,
|
||||
})
|
||||
@@ -316,18 +317,18 @@ class BuildMachine(InterpreterObject):
|
||||
# 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):
|
||||
def cpu_family_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 cpu_method(self, args, kwargs):
|
||||
return platform.machine().lower()
|
||||
|
||||
def system_method(self, args, kwargs):
|
||||
return platform.system().lower()
|
||||
|
||||
@@ -342,6 +343,7 @@ class CrossMachineInfo(InterpreterObject):
|
||||
self.info = cross_info
|
||||
self.methods.update({'system' : self.system_method,
|
||||
'cpu' : self.cpu_method,
|
||||
'cpu_family' : self.cpu_family_method,
|
||||
'endian' : self.endian_method,
|
||||
})
|
||||
|
||||
@@ -351,6 +353,9 @@ class CrossMachineInfo(InterpreterObject):
|
||||
def cpu_method(self, args, kwargs):
|
||||
return self.info['cpu']
|
||||
|
||||
def cpu_family_method(self, args, kwargs):
|
||||
return self.info['cpu_family']
|
||||
|
||||
def endian_method(self, args, kwargs):
|
||||
return self.info['endian']
|
||||
|
||||
|
||||
@@ -158,8 +158,11 @@ itself as required.'''
|
||||
|
||||
intr = interpreter.Interpreter(b, g)
|
||||
if env.is_cross_build():
|
||||
mlog.log('Host machine cpu family:', mlog.bold(intr.builtin['host_machine'].cpu_family_method([], {})))
|
||||
mlog.log('Host machine cpu:', mlog.bold(intr.builtin['host_machine'].cpu_method([], {})))
|
||||
mlog.log('Target machine cpu family:', mlog.bold(intr.builtin['target_machine'].cpu_family_method([], {})))
|
||||
mlog.log('Target machine cpu:', mlog.bold(intr.builtin['target_machine'].cpu_method([], {})))
|
||||
mlog.log('Build machine cpu family:', mlog.bold(intr.builtin['build_machine'].cpu_family_method([], {})))
|
||||
mlog.log('Build machine cpu:', mlog.bold(intr.builtin['build_machine'].cpu_method([], {})))
|
||||
intr.run()
|
||||
g.generate(intr)
|
||||
|
||||
Reference in new issue
Block a user