提交 7419f582 编写于 作者: N Niyas Sait

add support for building windows/arm64 package

上级 0eb6c12b
...@@ -60,7 +60,7 @@ def main(): ...@@ -60,7 +60,7 @@ def main():
) )
# https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode
x64 = sys.maxsize > 2 ** 32 is64 = sys.maxsize > 2 ** 32
package_name = "opencv-python" package_name = "opencv-python"
...@@ -88,7 +88,7 @@ def main(): ...@@ -88,7 +88,7 @@ def main():
# Path regexes with forward slashes relative to CMake install dir. # Path regexes with forward slashes relative to CMake install dir.
rearrange_cmake_output_data = { rearrange_cmake_output_data = {
"cv2": ( "cv2": (
[r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if x64 else "")] [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if is64 else "")]
if os.name == "nt" if os.name == "nt"
else [] else []
) )
...@@ -130,7 +130,7 @@ def main(): ...@@ -130,7 +130,7 @@ def main():
files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]} files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
ci_cmake_generator = ( ci_cmake_generator = (
["-G", "Visual Studio 14" + (" Win64" if x64 else "")] ["-G", "Visual Studio 14" + (" Win64" if is64 else "")]
if os.name == "nt" if os.name == "nt"
else ["-G", "Unix Makefiles"] else ["-G", "Unix Makefiles"]
) )
...@@ -164,9 +164,15 @@ def main(): ...@@ -164,9 +164,15 @@ def main():
"-DBUILD_PNG=ON", "-DBUILD_PNG=ON",
] ]
+ ( + (
# CMake flags for windows/arm64 build
["-DCMAKE_GENERATOR_PLATFORM=ARM64",
# Emulated cmake requires following flags to correctly detect
# target architecture for windows/arm64 build
"-DOPENCV_WORKAROUND_CMAKE_20989=ON",
"-DCMAKE_SYSTEM_PROCESSOR=ARM64"]
if platform.machine() == "ARM64" and sys.platform == "win32"
# If it is not defined 'linker flags: /machine:X86' on Windows x64 # If it is not defined 'linker flags: /machine:X86' on Windows x64
["-DCMAKE_GENERATOR_PLATFORM=x64"] else ["-DCMAKE_GENERATOR_PLATFORM=x64"] if is64 and sys.platform == "win32"
if x64 and sys.platform == "win32"
else [] else []
) )
+ ( + (
...@@ -186,7 +192,7 @@ def main(): ...@@ -186,7 +192,7 @@ def main():
"-DWITH_MSMF=OFF" "-DWITH_MSMF=OFF"
) # see: https://github.com/skvark/opencv-python/issues/263 ) # see: https://github.com/skvark/opencv-python/issues/263
if sys.platform.startswith("linux") and not x64 and "bdist_wheel" in sys.argv: if sys.platform.startswith("linux") and not is64 and "bdist_wheel" in sys.argv:
subprocess.check_call("patch -p0 < patches/patchOpenEXR", shell=True) subprocess.check_call("patch -p0 < patches/patchOpenEXR", shell=True)
# OS-specific components during CI builds # OS-specific components during CI builds
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册