Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --arch global option to support arm64 macOS via Rosetta2 #245

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mx.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ def __init__(self, parents=None):
"projects and store it in the given <file>. If <file> is 'default', the compilation database will "
"be stored in the parent directory of the repository containing the primary suite. This option "
"can also be configured using the MX_COMPDB environment variable. Use --compdb none to disable.")
self.add_argument('--arch', action='store', dest='arch', help='force use of the specified architecture')

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

system_arch = platform.uname()[4]
if opts.arch and opts.arch != system_arch:
warn('overriding detected architecture ({}) with {}'.format(system_arch, opts.arch))

else:
parser = ArgParser(parents=[self])
parser.add_argument('commandAndArgs', nargs=REMAINDER, metavar='command args...')
Expand Down Expand Up @@ -3835,6 +3840,9 @@ def _separatedCygpathW2U(p):
return os.pathsep.join(map(_cygpathW2U, p.split(';')))

def get_arch():
return _opts.arch if _opts.arch else _get_real_arch()

def _get_real_arch():
machine = platform.uname()[4]
if machine in ['aarch64']:
return 'aarch64'
Expand Down