mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 02:16:19 +03:00
windows arm64 build fixes
This commit is contained in:
parent
da0b826e96
commit
af83f679e8
|
@ -118,6 +118,12 @@ DEPS = {
|
||||||
"(LEGAL ISSUES\n============\n\n.+?)\n\nREFERENCES\n=========="
|
"(LEGAL ISSUES\n============\n\n.+?)\n\nREFERENCES\n=========="
|
||||||
".+(libjpeg-turbo Licenses\n======================\n\n.+)$"
|
".+(libjpeg-turbo Licenses\n======================\n\n.+)$"
|
||||||
),
|
),
|
||||||
|
"patch": {
|
||||||
|
r"CMakeLists.txt": {
|
||||||
|
# libjpeg-turbo does not detect MSVC x86_arm64 cross-compiler correctly
|
||||||
|
'if(MSVC_IDE AND CMAKE_GENERATOR_PLATFORM MATCHES "arm64")': "if({architecture} STREQUAL ARM64)", # noqa: E501
|
||||||
|
},
|
||||||
|
},
|
||||||
"build": [
|
"build": [
|
||||||
*cmds_cmake(
|
*cmds_cmake(
|
||||||
("jpeg-static", "cjpeg-static", "djpeg-static"),
|
("jpeg-static", "cjpeg-static", "djpeg-static"),
|
||||||
|
@ -327,6 +333,8 @@ DEPS = {
|
||||||
"CMakeLists.txt": {
|
"CMakeLists.txt": {
|
||||||
"if(OPENMP_FOUND)": "if(false)",
|
"if(OPENMP_FOUND)": "if(false)",
|
||||||
"install": "#install",
|
"install": "#install",
|
||||||
|
# libimagequant does not detect MSVC x86_arm64 cross-compiler correctly
|
||||||
|
"if(${{CMAKE_SYSTEM_PROCESSOR}} STREQUAL ARM64)": "if({architecture} STREQUAL ARM64)", # noqa: E501
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"build": [
|
"build": [
|
||||||
|
@ -367,12 +375,17 @@ DEPS = {
|
||||||
|
|
||||||
|
|
||||||
# based on distutils._msvccompiler from CPython 3.7.4
|
# based on distutils._msvccompiler from CPython 3.7.4
|
||||||
def find_msvs() -> dict[str, str] | None:
|
def find_msvs(architecture) -> dict[str, str] | None:
|
||||||
root = os.environ.get("ProgramFiles(x86)") or os.environ.get("ProgramFiles")
|
root = os.environ.get("ProgramFiles(x86)") or os.environ.get("ProgramFiles")
|
||||||
if not root:
|
if not root:
|
||||||
print("Program Files not found")
|
print("Program Files not found")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if architecture == "ARM64":
|
||||||
|
tools = "Microsoft.VisualStudio.Component.VC.Tools.ARM64"
|
||||||
|
else:
|
||||||
|
tools = "Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vspath = (
|
vspath = (
|
||||||
subprocess.check_output(
|
subprocess.check_output(
|
||||||
|
@ -383,7 +396,7 @@ def find_msvs() -> dict[str, str] | None:
|
||||||
"-latest",
|
"-latest",
|
||||||
"-prerelease",
|
"-prerelease",
|
||||||
"-requires",
|
"-requires",
|
||||||
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
tools,
|
||||||
"-property",
|
"-property",
|
||||||
"installationPath",
|
"installationPath",
|
||||||
"-products",
|
"-products",
|
||||||
|
@ -654,7 +667,7 @@ if __name__ == "__main__":
|
||||||
arch_prefs = ARCHITECTURES[args.architecture]
|
arch_prefs = ARCHITECTURES[args.architecture]
|
||||||
print("Target architecture:", args.architecture)
|
print("Target architecture:", args.architecture)
|
||||||
|
|
||||||
msvs = find_msvs()
|
msvs = find_msvs(args.architecture)
|
||||||
if msvs is None:
|
if msvs is None:
|
||||||
msg = "Visual Studio not found. Please install Visual Studio 2017 or newer."
|
msg = "Visual Studio not found. Please install Visual Studio 2017 or newer."
|
||||||
raise RuntimeError(msg)
|
raise RuntimeError(msg)
|
||||||
|
@ -689,6 +702,11 @@ if __name__ == "__main__":
|
||||||
disabled += ["libimagequant"]
|
disabled += ["libimagequant"]
|
||||||
if args.no_fribidi:
|
if args.no_fribidi:
|
||||||
disabled += ["fribidi"]
|
disabled += ["fribidi"]
|
||||||
|
elif args.architecture == "ARM64" and platform.machine() != "ARM64":
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
warnings.warn("Cross-compiling FriBiDi is currently not supported, disabling")
|
||||||
|
disabled += ["fribidi"]
|
||||||
|
|
||||||
prefs = {
|
prefs = {
|
||||||
"architecture": args.architecture,
|
"architecture": args.architecture,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user