Repository navigation
Add Windows ARM64 support for 5.x #1282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Prasadayus
wants to merge
1
commit into
opencv:5.x
Choose a base branch
from
Prasadayus:arm64-windows-5x
base: 5.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,10 +101,11 @@ def main(): | |
|
|
||
| # Files from CMake output to copy to package. | ||
| # Path regexes with forward slashes relative to CMake install dir. | ||
| # Note: FFMPEG dlls are not yet provided for Windows ARM64 | ||
| rearrange_cmake_output_data = { | ||
| "cv2": ( | ||
| [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if is64 else "")] | ||
| if os.name == "nt" | ||
| if os.name == "nt" and not (platform.machine() == "ARM64" and sys.platform == "win32") | ||
| else [] | ||
| ) | ||
| + | ||
|
|
@@ -157,9 +158,13 @@ def main(): | |
|
|
||
| # HACK: Disabled generic assembler for now. | ||
| # Windows 2025 CI environment does not provide suitable assembler or build is broken in OpenCV MLAS. | ||
| # On ARM64, NOTFOUND also avoids a MinGW toolchain on PATH being misdetected by CMake's ASM probe. | ||
| ci_cmake_generator = ( | ||
| ["-G", "Visual Studio 17 2022", | ||
| "-DCMAKE_ASM_COMPILER="] | ||
| ["-G", "Visual Studio 18 2026", | ||
| "-DCMAKE_ASM_COMPILER=CMAKE_ASM_COMPILER-NOTFOUND"] | ||
| if os.name == "nt" and platform.machine() == "ARM64" | ||
| else ["-G", "Visual Studio 17 2022", | ||
| "-DCMAKE_ASM_COMPILER="] | ||
| if os.name == "nt" | ||
| else ["-G", "Unix Makefiles"] | ||
| ) | ||
|
|
@@ -198,7 +203,8 @@ def main(): | |
| # Emulated cmake requires following flags to correctly detect | ||
| # target architecture for windows/arm64 build | ||
| "-DOPENCV_WORKAROUND_CMAKE_20989=ON", | ||
| "-DCMAKE_SYSTEM_PROCESSOR=ARM64"] | ||
| "-DCMAKE_SYSTEM_PROCESSOR=ARM64", | ||
| "-DWITH_OPENCL=OFF"] | ||
| if platform.machine() == "ARM64" and sys.platform == "win32" | ||
| # If it is not defined 'linker flags: /machine:X86' on Windows x64 | ||
| else ["-DCMAKE_GENERATOR_PLATFORM=x64"] if is64 and sys.platform == "win32" | ||
|
|
@@ -264,6 +270,11 @@ def main(): | |
| cmake_args.append("-DWITH_LAPACK=ON") | ||
| cmake_args.append("-DENABLE_PRECOMPILED_HEADERS=OFF") | ||
|
|
||
| if sys.platform.startswith('win') and platform.machine().lower() in ("arm64", "aarch64"): | ||
| # MSVC does not support OpenCV dispatch features such as NEON_FP16, NEON_BF16 and NEON_DOTPROD. So use NEON as both baseline and dispatch units | ||
| cmake_args.append("-DCPU_BASELINE=NEON") | ||
| cmake_args.append("-DCPU_DISPATCH=NEON") | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's redundant. Current OpenCV CMake already defines NEON as baseline. Main OpenCV CI: https://github.com/opencv/opencv/actions/runs/42283223084/job/128327194332?pr=30704 |
||
| # works via side effect | ||
| RearrangeCMakeOutput( | ||
| rearrange_cmake_output_data, files_outside_package_dir, package_data.keys() | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is OpenCV disabled? OpenCV dynamically check OpenCL availability in runtime. The option looks redundant for me.