Skip to content

Commit

Permalink
Windows: Enable win-arm64 for MSVC
Browse files Browse the repository at this point in the history
This patch enabled win-arm64 as a new platform for Windows.
Platform query and documentation is updated accordingly.
  • Loading branch information
gaborkertesz-linaro committed Nov 4, 2021
1 parent fcb87ec commit 3c24aa3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions winbuild/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Download and install:
* `CMake 3.12 or newer <https://cmake.org/download/>`_
(also available as Visual Studio component C++ CMake tools for Windows)

* `NASM <https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D>`_
* x86/x64: `NASM <https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D>`_

Any version of Visual Studio 2017 or newer should be supported,
including Visual Studio 2017 Community, or Build Tools for Visual Studio 2019.
Expand All @@ -42,8 +42,8 @@ behaviour of ``build_prepare.py``:
If ``PYTHON`` is unset, the version of Python used to run
``build_prepare.py`` will be used. If only ``PYTHON`` is set,
``EXECUTABLE`` defaults to ``python.exe``.
* ``ARCHITECTURE`` is used to select a ``x86`` or ``x64`` build. By default,
uses same architecture as the version of Python used to run ``build_prepare.py``.
* ``ARCHITECTURE`` is used to select a ``x86``, ``x64`` or ``x86_arm64`` (for win-arm64) build.
By default, uses same architecture as the version of Python used to run ``build_prepare.py``.
is used.
* ``PILLOW_BUILD`` can be used to override the ``winbuild\build`` directory
path, used to store generated build scripts and compiled libraries.
Expand Down
7 changes: 6 additions & 1 deletion winbuild/build_prepare.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import shutil
import struct
import subprocess
Expand Down Expand Up @@ -93,6 +94,7 @@ def cmd_msbuild(
architectures = {
"x86": {"vcvars_arch": "x86", "msbuild_arch": "Win32"},
"x64": {"vcvars_arch": "x86_amd64", "msbuild_arch": "x64"},
"x86_arm64": {"vcvars_arch": "x86_arm64", "msbuild_arch": "ARM64"},
}

header = [
Expand Down Expand Up @@ -492,7 +494,10 @@ def build_pillow():
python_dir = os.environ.get("PYTHON")
python_exe = os.environ.get("EXECUTABLE", "python.exe")
architecture = os.environ.get(
"ARCHITECTURE", "x86" if struct.calcsize("P") == 4 else "x64"
"ARCHITECTURE",
"x86_arm64"
if platform.machine() == "ARM64"
else ("x86" if struct.calcsize("P") == 4 else "x64"),
)
build_dir = os.environ.get("PILLOW_BUILD", os.path.join(winbuild_dir, "build"))
sources_dir = ""
Expand Down

0 comments on commit 3c24aa3

Please sign in to comment.