Skip to content

Commit cdc91e8

Browse files
committed
Add global option --arch
Allows to specify a custom architecture target. Useful for arm64-based Apple computers, until all used native libraries are released for arm64. Example usage: mx --arch amd64 ...
1 parent 535c60b commit cdc91e8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mx.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ def __init__(self, parents=None):
581581
"projects and store it in the given <file>. If <file> is 'default', the compilation database will "
582582
"be stored in the parent directory of the repository containing the primary suite. This option "
583583
"can also be configured using the MX_COMPDB environment variable. Use --compdb none to disable.")
584+
self.add_argument('--arch', action='store', dest='arch', help='force use of the specified architecture')
584585

585586
if not is_windows():
586587
# Time outs are (currently) implemented with Unix specific functionality
@@ -679,6 +680,10 @@ def _parse_cmd_line(self, opts, firstParse):
679680
except IOError as e:
680681
abort('Error opening {} specified by --exec-log: {}'.format(opts.exec_log, e))
681682

683+
system_arch = platform.uname()[4]
684+
if opts.arch and opts.arch != system_arch:
685+
warn('overriding detected architecture ({}) with {}'.format(system_arch, opts.arch))
686+
682687
else:
683688
parser = ArgParser(parents=[self])
684689
parser.add_argument('commandAndArgs', nargs=REMAINDER, metavar='command args...')
@@ -3835,6 +3840,9 @@ def _separatedCygpathW2U(p):
38353840
return os.pathsep.join(map(_cygpathW2U, p.split(';')))
38363841

38373842
def get_arch():
3843+
return _opts.arch if _opts.arch else _get_real_arch()
3844+
3845+
def _get_real_arch():
38383846
machine = platform.uname()[4]
38393847
if machine in ['aarch64']:
38403848
return 'aarch64'

0 commit comments

Comments
 (0)