Add support for building on Windows ARM64
Some checks failed
ci-build / build-source-dist (push) Has been cancelled
ci-build / Build wxPython documentation (push) Has been cancelled
ci-build / build-wheels (arm64, macos-14, 3.10) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-14, 3.11) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-14, 3.12) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-14, 3.13) (push) Has been cancelled
ci-build / build-wheels (arm64, macos-14, 3.9) (push) Has been cancelled
ci-build / build-wheels (x64, macos-13, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, macos-13, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, macos-13, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, macos-13, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, macos-13, 3.9) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-22.04, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-22.04, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-22.04, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-22.04, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, ubuntu-22.04, 3.9) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2022, 3.10) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2022, 3.11) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2022, 3.12) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2022, 3.13) (push) Has been cancelled
ci-build / build-wheels (x64, windows-2022, 3.9) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2022, 3.10) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2022, 3.11) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2022, 3.12) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2022, 3.13) (push) Has been cancelled
ci-build / build-wheels (x86, windows-2022, 3.9) (push) Has been cancelled
ci-build / Publish Python distribution to PyPI (push) Has been cancelled
ci-build / Create GitHub Release and upload source (push) Has been cancelled
ci-build / Upload wheels to snapshot-builds on wxpython.org (push) Has been cancelled

This commit is contained in:
Scott Talbert
2025-01-02 20:04:16 -05:00
parent 98065e7e21
commit c9f0e39100
7 changed files with 29 additions and 14 deletions

View File

@@ -57,6 +57,8 @@ PYVER = '3.9'
PYSHORTVER = '39'
PYTHON = None # it will be set later
PYTHON_ARCH = 'UNKNOWN'
PYTHON_MACHINE = None
MSVC_ARCH = None
# convenience access to the wxPython version digits
version2 = "%d.%d" % (version.VER_MAJOR, version.VER_MINOR)
@@ -223,6 +225,8 @@ def setPythonVersion(args):
global PYSHORTVER
global PYTHON
global PYTHON_ARCH
global PYTHON_MACHINE
global MSVC_ARCH
havePyVer = False
havePyPath = False
@@ -305,13 +309,26 @@ def setPythonVersion(args):
PYTHON_ARCH = runcmd(
[PYTHON, '-c', 'import platform; print(platform.architecture()[0])'],
True, False)
if isWindows:
PYTHON_MACHINE = runcmd(
[PYTHON, '-c', 'import platform; print(platform.machine())'],
True, False)
if PYTHON_MACHINE == 'ARM64':
MSVC_ARCH = 'arm64'
elif PYTHON_ARCH == '64bit':
MSVC_ARCH = 'x64'
else:
MSVC_ARCH = 'x86'
msg('Python\'s architecture is %s' % PYTHON_ARCH)
os.environ['PYTHON'] = PYTHON
if PYTHON_ARCH == '64bit':
# Make sure this is set in case it wasn't above.
os.environ['CPU'] = 'X64'
if isWindows and PYTHON_MACHINE == 'ARM64':
os.environ['CPU'] = 'ARM64'
else:
os.environ['CPU'] = 'X64'
@@ -379,8 +396,9 @@ def getMSWSettings(options):
pass
msw = MSWsettings()
msw.CPU = os.environ.get('CPU')
if msw.CPU in ['AMD64', 'X64'] or PYTHON_ARCH == '64bit':
msw.dllDir = posixjoin(wxDir(), "lib", "vc%s_x64_dll" % getVisCVersion())
if msw.CPU in ['AMD64', 'X64', 'ARM64'] or PYTHON_ARCH == '64bit':
msw.dllArch = 'arm64' if msw.CPU == 'ARM64' else 'x64'
msw.dllDir = posixjoin(wxDir(), "lib", "vc%s_%s_dll" % (getVisCVersion(), msw.dllArch))
else:
msw.dllDir = posixjoin(wxDir(), "lib", "vc%s_dll" % getVisCVersion())
msw.buildDir = posixjoin(wxDir(), "build", "msw")
@@ -807,8 +825,7 @@ def checkCompiler(quiet=False):
# needed info, so the target python shoudl have a recent version of
# setuptools installed.
arch = 'x64' if PYTHON_ARCH == '64bit' else 'x86'
info = getMSVCInfo(PYTHON, arch, set_env=True)
info = getMSVCInfo(PYTHON, MSVC_ARCH, set_env=True)
# # Just needed for debugging
# if not quiet:
@@ -1626,7 +1643,7 @@ def copyWxDlls(options):
cfg = Config()
ver = wxversion3_nodot if unstable_series else wxversion2_nodot
arch = 'x64' if PYTHON_ARCH == '64bit' else 'x86'
arch = msw.dllArch if PYTHON_ARCH == '64bit' else 'x86'
dlls = list()
if not options.debug or options.both:
dlls += sorted(glob.glob(os.path.join(msw.dllDir, "wx*%su_*.dll" % ver)))
@@ -1739,10 +1756,7 @@ def cmd_build_py(options, args):
if isDarwin and options.mac_arch:
build_options.append("--mac_arch=%s" % options.mac_arch)
if isWindows:
if PYTHON_ARCH == '64bit':
build_options.append('--msvc_arch=x64')
else:
build_options.append('--msvc_arch=x86')
build_options.append('--msvc_arch=%s' % MSVC_ARCH)
if not isWindows:
build_options.append('--wx_config=%s' % WX_CONFIG)
if options.jobs:
@@ -2021,7 +2035,7 @@ def cmd_clean_wx(options, args):
delFiles(sorted(glob.glob(opj(msw.dllDir, 'wx*%s%s*' % (wxversion2_nodot, msw.dll_type)))))
delFiles(sorted(glob.glob(opj(msw.dllDir, 'wx*%s%s*' % (wxversion3_nodot, msw.dll_type)))))
if PYTHON_ARCH == '64bit':
deleteIfExists(opj(msw.buildDir, 'vc%s_x64_msw%sdll' % (getVisCVersion(), msw.dll_type)))
deleteIfExists(opj(msw.buildDir, 'vc%s_%s_msw%sdll' % (getVisCVersion(), msw.dllArch, msw.dll_type)))
else:
deleteIfExists(opj(msw.buildDir, 'vc%s_msw%sdll' % (getVisCVersion(), msw.dll_type)))

View File

@@ -161,8 +161,9 @@ class Configuration(object):
# will probably vary...
self.WXPLAT = '__WXMSW__'
if os.environ.get('CPU', None) in ['AMD64', 'X64']:
self.VCDLL = 'vc%s_x64_dll' % getVisCVersion()
if os.environ.get('CPU', None) in ['AMD64', 'X64', 'ARM64']:
arch_str = 'arm64' if os.environ['CPU'] == 'ARM64' else 'x64'
self.VCDLL = 'vc%s_%s_dll' % (getVisCVersion(), arch_str)
else:
self.VCDLL = 'vc%s_dll' % getVisCVersion()

Binary file not shown.

View File

@@ -56,7 +56,7 @@ def options(opt):
help='Set to use a MinGW toolchain')
opt.add_option('--msvc_arch', dest='msvc_arch', default='x86', action='store',
help='The architecture to target for MSVC builds. Supported values '
'are: "x86" or "x64"')
'are: "x86", "x64", or "arm64"')
opt.add_option('--msvc_relwithdebug', dest='msvc_relwithdebug', action='store_true', default=False,
help='Turn on debug info for release builds for MSVC builds.')