@@ -60,7 +60,7 @@ def main():
60
60
)
61
61
62
62
# https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode
63
- x64 = sys .maxsize > 2 ** 32
63
+ is64 = sys .maxsize > 2 ** 32
64
64
65
65
package_name = "opencv-python"
66
66
@@ -88,7 +88,7 @@ def main():
88
88
# Path regexes with forward slashes relative to CMake install dir.
89
89
rearrange_cmake_output_data = {
90
90
"cv2" : (
91
- [r"bin/opencv_ffmpeg\d{3,4}%s\.dll" % ("_64" if x64 else "" )]
91
+ [r"bin/opencv_ffmpeg\d{3,4}%s\.dll" % ("_64" if is64 else "" )]
92
92
if os .name == "nt"
93
93
else []
94
94
)
@@ -118,7 +118,7 @@ def main():
118
118
files_outside_package_dir = {"cv2" : ["LICENSE.txt" , "LICENSE-3RD-PARTY.txt" ]}
119
119
120
120
ci_cmake_generator = (
121
- ["-G" , "Visual Studio 14" + (" Win64" if x64 else "" )]
121
+ ["-G" , "Visual Studio 14" + (" Win64" if is64 else "" )]
122
122
if os .name == "nt"
123
123
else ["-G" , "Unix Makefiles" ]
124
124
)
@@ -152,9 +152,15 @@ def main():
152
152
"-DBUILD_PNG=ON" ,
153
153
]
154
154
+ (
155
+ # CMake flags for windows/arm64 build
156
+ ["-DCMAKE_GENERATOR_PLATFORM=ARM64" ,
157
+ # Emulated cmake requires following flags to correctly detect
158
+ # target architecture for windows/arm64 build
159
+ "-DOPENCV_WORKAROUND_CMAKE_20989=ON" ,
160
+ "-DCMAKE_SYSTEM_PROCESSOR=ARM64" ]
161
+ if platform .machine () == "ARM64" and sys .platform == "win32"
155
162
# If it is not defined 'linker flags: /machine:X86' on Windows x64
156
- ["-DCMAKE_GENERATOR_PLATFORM=x64" ]
157
- if x64 and sys .platform == "win32"
163
+ else ["-DCMAKE_GENERATOR_PLATFORM=x64" ] if is64 and sys .platform == "win32"
158
164
else []
159
165
)
160
166
+ (
@@ -174,7 +180,7 @@ def main():
174
180
"-DWITH_MSMF=OFF"
175
181
) # see: https://github.com/skvark/opencv-python/issues/263
176
182
177
- if sys .platform .startswith ("linux" ) and not x64 and "bdist_wheel" in sys .argv :
183
+ if sys .platform .startswith ("linux" ) and not is64 and "bdist_wheel" in sys .argv :
178
184
subprocess .check_call ("patch -p0 < patches/patchOpenEXR" , shell = True )
179
185
180
186
# OS-specific components during CI builds
0 commit comments