Skip to content

Commit

Permalink
Allow cross-compiling for Windows ARM64 (GH-343)
Browse files Browse the repository at this point in the history
Also, use the setuptools build_ext command: this allows proper handling of cross-compilation added to setuptools but not to [deprecated] distutils.
  • Loading branch information
zooba committed May 17, 2022
1 parent bd60508 commit dcab105
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion buildlibxml.py
Expand Up @@ -38,7 +38,9 @@ def download_and_extract_windows_binaries(destdir):
if release_path in filename
]

if platform.machine() == 'ARM64':
# Check for native ARM64 build or the environment variable that is set by
# Visual Studio for cross-compilation (same variable as setuptools uses)
if platform.machine() == 'ARM64' or os.getenv('VSCMD_ARG_TGT_ARCH') == 'arm64':
arch = "win-arm64"
elif sys.maxsize > 2**32:
arch = "win64"
Expand Down
3 changes: 2 additions & 1 deletion setupinfo.py
Expand Up @@ -3,9 +3,10 @@
import os
import os.path
import subprocess

from setuptools.command.build_ext import build_ext as _build_ext
from distutils.core import Extension
from distutils.errors import CompileError, DistutilsOptionError
from distutils.command.build_ext import build_ext as _build_ext
from versioninfo import get_base_dir

try:
Expand Down

0 comments on commit dcab105

Please sign in to comment.