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

Use arm64 MSVC on arm64 Windows #285

Merged
merged 12 commits into from
Aug 27, 2024
29 changes: 19 additions & 10 deletions distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
LibError,
LinkError,
)
from .util import get_platform
from .util import get_host_platform, get_platform


def _find_vc2015():
Expand Down Expand Up @@ -178,15 +178,24 @@ def _find_exe(exe, paths=None):
return exe


# A map keyed by get_platform() return values to values accepted by
jaraco marked this conversation as resolved.
Show resolved Hide resolved
# 'vcvarsall.bat'. Always cross-compile from x86 to work with the
# lighter-weight MSVC installs that do not include native 64-bit tools.
PLAT_TO_VCVARS = {
'win32': 'x86',
'win-amd64': 'x86_amd64',
'win-arm32': 'x86_arm',
'win-arm64': 'x86_arm64',
}
if get_host_platform() == "win-arm64":
# Use the native MSVC host if the host platform would need expensive
# emulation for x86.
PLAT_TO_VCVARS = {
'win32': 'arm64_x86',
'win-amd64': 'arm64_amd64',
'win-arm32': 'arm64_arm',
'win-arm64': 'arm64',
}
else:
# Always cross-compile from x86 to work with the lighter-weight MSVC
# installs that do not include native 64-bit tools.
PLAT_TO_VCVARS = {
'win32': 'x86',
'win-amd64': 'x86_amd64',
'win-arm32': 'x86_arm',
'win-arm64': 'x86_arm64',
}


class MSVCCompiler(CCompiler):
Expand Down
Loading