Skip to content

Commit 5601e19

Browse files
authored
Update setup.py
1 parent d728c91 commit 5601e19

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

setup.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,26 @@ def main():
160160
# Raw paths relative to sourcetree root.
161161
files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
162162

163-
ci_cmake_generator = (
164-
["-G", "Visual Studio 14" + (" Win64" if is64 else "")]
165-
if os.name == "nt"
166-
else ["-G", "Unix Makefiles"]
167-
)
163+
def get_windows_version():
164+
try:
165+
release_str = platform.release()
166+
if release_str == "2025":
167+
return 2025
168+
else:
169+
return int(release_str)
170+
except Exception:
171+
return None
172+
173+
windows_version = get_windows_version()
174+
175+
if os.name == "nt":
176+
if windows_version == 2025:
177+
generator_name = "Visual Studio 17"
178+
else:
179+
generator_name = "Visual Studio 14"
180+
ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]
181+
else:
182+
ci_cmake_generator = ["-G", "Unix Makefiles"]
168183

169184
cmake_args = (
170185
(ci_cmake_generator if is_CI_build else [])

0 commit comments

Comments
 (0)