Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d7828f3

Browse filesBrowse files
authored
Merge pull request #22429 from nsait-linaro/windows-arm64
BLD: Enable windows/arm64 platform
2 parents 32fff69 + 4e05fa3 commit d7828f3
Copy full SHA for d7828f3

File tree

Expand file treeCollapse file tree

2 files changed

+48
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+48
-7
lines changed
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Windows on Arm Support
2+
----------------------
3+
4+
Preliminary support for windows on arm64 target added.
5+
6+
Matplotlib for windows/arm64 requires FreeType 2.11 or above.
7+
8+
No binary wheels are available yet but can be built from source.

‎setupext.py

Copy file name to clipboardExpand all lines: setupext.py
+40-7Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import tarfile
1515
import textwrap
1616
import urllib.request
17+
from packaging import version
1718

1819
from setuptools import Distribution, Extension
1920

@@ -167,12 +168,21 @@ def get_and_extract_tarball(urls, sha, dirname):
167168
'955e17244e9b38adb0c98df66abb50467312e6bb70eac07e49ce6bd1a20e809a',
168169
'2.10.1':
169170
'3a60d391fd579440561bf0e7f31af2222bc610ad6ce4d9d7bd2165bca8669110',
171+
'2.11.1':
172+
'f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b'
170173
}
171174
# This is the version of FreeType to use when building a local version. It
172175
# must match the value in lib/matplotlib.__init__.py and also needs to be
173176
# changed below in the embedded windows build script (grep for "REMINDER" in
174177
# this file). Also update the cache path in `.circleci/config.yml`.
175-
LOCAL_FREETYPE_VERSION = '2.6.1'
178+
TESTING_VERSION_OF_FREETYPE = '2.6.1'
179+
if sys.platform.startswith('win') and platform.machine() == 'ARM64':
180+
# older versions of freetype are not supported for win/arm64
181+
# Matplotlib tests will not pass
182+
LOCAL_FREETYPE_VERSION = '2.11.1'
183+
else:
184+
LOCAL_FREETYPE_VERSION = TESTING_VERSION_OF_FREETYPE
185+
176186
LOCAL_FREETYPE_HASH = _freetype_hashes.get(LOCAL_FREETYPE_VERSION, 'unknown')
177187

178188
# Also update the cache path in `.circleci/config.yml`.
@@ -646,9 +656,16 @@ def do_custom_build(self, env):
646656
subprocess.check_call([make], env=env, cwd=src_path)
647657
else: # compilation on windows
648658
shutil.rmtree(src_path / "objs", ignore_errors=True)
649-
msbuild_platform = (
650-
'x64' if platform.architecture()[0] == '64bit' else 'Win32')
651-
base_path = Path("build/freetype-2.6.1/builds/windows")
659+
is_x64 = platform.architecture()[0] == '64bit'
660+
if platform.machine() == 'ARM64':
661+
msbuild_platform = 'ARM64'
662+
elif is_x64:
663+
msbuild_platform = 'x64'
664+
else:
665+
msbuild_platform = 'Win32'
666+
base_path = Path(
667+
f"build/freetype-{LOCAL_FREETYPE_VERSION}/builds/windows"
668+
)
652669
vc = 'vc2010'
653670
sln_path = base_path / vc / "freetype.sln"
654671
# https://developercommunity.visualstudio.com/comments/190992/view.html
@@ -679,14 +696,30 @@ def do_custom_build(self, env):
679696

680697
cc = get_ccompiler()
681698
cc.initialize() # Get msbuild in the %PATH% of cc.spawn.
699+
# Freetype 2.10.0+ support static builds.
700+
msbuild_config = (
701+
"Release Static"
702+
if version.parse(LOCAL_FREETYPE_VERSION) >=
703+
version.parse("2.10.0")
704+
else "Release"
705+
)
706+
682707
cc.spawn(["msbuild", str(sln_path),
683708
"/t:Clean;Build",
684-
f"/p:Configuration=Release;Platform={msbuild_platform}"])
709+
f"/p:Configuration={msbuild_config};"
710+
f"Platform={msbuild_platform}"])
685711
# Move to the corresponding Unix build path.
686712
(src_path / "objs" / ".libs").mkdir()
687713
# Be robust against change of FreeType version.
688-
lib_path, = (src_path / "objs" / vc / msbuild_platform).glob(
689-
"freetype*.lib")
714+
lib_paths = Path(src_path / "objs").rglob('freetype*.lib')
715+
# Select FreeType library for required platform
716+
lib_path, = [
717+
p for p in lib_paths
718+
if msbuild_platform in p.resolve().as_uri()
719+
]
720+
print(
721+
f"Copying {lib_path} to {src_path}/objs/.libs/libfreetype.lib"
722+
)
690723
shutil.copy2(lib_path, src_path / "objs/.libs/libfreetype.lib")
691724

692725

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.