diff --git a/build.py b/build.py index de85259f..5dd0e09a 100755 --- a/build.py +++ b/build.py @@ -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))) diff --git a/buildtools/config.py b/buildtools/config.py index 2f828c83..5b5997bb 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -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() diff --git a/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/msvcp140.dll b/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/msvcp140.dll new file mode 100644 index 00000000..7e2a5742 Binary files /dev/null and b/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/msvcp140.dll differ diff --git a/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/vcruntime140.dll b/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/vcruntime140.dll new file mode 100644 index 00000000..9716764b Binary files /dev/null and b/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/vcruntime140.dll differ diff --git a/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/vcruntime140_1.dll b/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/vcruntime140_1.dll new file mode 100644 index 00000000..651baf17 Binary files /dev/null and b/packaging/msw-vcredist/arm64/Microsoft.VC140.CRT/vcruntime140_1.dll differ diff --git a/packaging/msw-webview2/arm64/WebView2Loader.dll b/packaging/msw-webview2/arm64/WebView2Loader.dll new file mode 100644 index 00000000..224eb10c Binary files /dev/null and b/packaging/msw-webview2/arm64/WebView2Loader.dll differ diff --git a/wscript b/wscript index aab8a29d..e4f982e4 100644 --- a/wscript +++ b/wscript @@ -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.')