Fixing missing OpenCV 4.13.0 files in windows builds

This commit is contained in:
Jonathan Thomas
2026-05-14 19:53:11 -05:00
parent f84ac9deca
commit 3f01149919
2 changed files with 25 additions and 8 deletions
+4 -2
View File
@@ -120,8 +120,9 @@ win-x64:
- Copy-Item "$CI_PROJECT_DIR/build/install-x64/python/*" -Destination "$CI_PROJECT_DIR"
- $env:MSYSTEM = "MINGW64"
- $env:OPENCV_ROOT = "C:\msys64\mingw64\opencv-4.13.0"
- $env:OPENCV_DLL_DIR = "$env:OPENCV_ROOT\x64\mingw\bin"
- $originalPath = $env:Path
- $NewPath = "$env:OPENCV_ROOT\bin;$CI_PROJECT_DIR\build\install-x64\bin;$CI_PROJECT_DIR\build\install-x64\python;C:\msys64\mingw64\bin;"
- $NewPath = "$env:OPENCV_DLL_DIR;$CI_PROJECT_DIR\build\install-x64\bin;$CI_PROJECT_DIR\build\install-x64\python;C:\msys64\mingw64\bin;"
- $env:Path = $NewPath + $env:Path
- $PY_ABI = (python3 -c "import sysconfig; print(sysconfig.get_config_var('py_version_short'))")
- $NewPath = $NewPath + "C:\msys64\mingw64\lib\python" + $PY_ABI + "\;C:\msys64\mingw64\lib\python" + $PY_ABI + "\site-packages\;C:\msys64\mingw64\lib\python" + $PY_ABI + "\site-packages\PyQt5;";
@@ -164,8 +165,9 @@ win-x86:
- Copy-Item "$CI_PROJECT_DIR/build/install-x86/python/*" -Destination "$CI_PROJECT_DIR"
- $env:MSYSTEM = "MINGW32"
- $env:OPENCV_ROOT = "C:\msys64\mingw32\opencv-4.13.0"
- $env:OPENCV_DLL_DIR = "$env:OPENCV_ROOT\x64\mingw\bin"
- $originalPath = $env:Path
- $NewPath = "$env:OPENCV_ROOT\bin;$CI_PROJECT_DIR\build\install-x86\bin;$CI_PROJECT_DIR\build\install-x86\python;C:\msys64\mingw32\bin;"
- $NewPath = "$env:OPENCV_DLL_DIR;$CI_PROJECT_DIR\build\install-x86\bin;$CI_PROJECT_DIR\build\install-x86\python;C:\msys64\mingw32\bin;"
- $env:Path = $NewPath + $env:Path
- $PY_ABI = (python3 -c "import sysconfig; print(sysconfig.get_config_var('py_version_short'))")
- $NewPath = $NewPath + "C:\msys64\mingw32\lib\python" + $PY_ABI + "\;C:\msys64\mingw32\lib\python" + $PY_ABI + "\site-packages\;C:\msys64\mingw32\lib\python" + $PY_ABI+ "\site-packages\PyQt5;";
+21 -6
View File
@@ -296,18 +296,33 @@ if sys.platform == "win32":
log.warning("Missing optional Windows imageformat runtime DLL: %s", dll_path)
# libopenshot's Python extension links directly to the OpenCV runtime DLLs.
# Copy them from the explicit CI/toolchain OpenCV root so we don't package
# Copy them from the explicit CI/toolchain OpenCV path so we don't package
# stale pacman DLLs when a source-built OpenCV is installed side-by-side.
opencv_root = os.getenv("OPENCV_ROOT")
if opencv_root:
opencv_bin_path = os.path.join(opencv_root, "bin")
opencv_runtime_dlls = list(find_files(opencv_bin_path, ["*.dll"]))
opencv_dll_dir = os.getenv("OPENCV_DLL_DIR")
if opencv_root or opencv_dll_dir:
opencv_bin_paths = []
if opencv_dll_dir:
opencv_bin_paths.append(opencv_dll_dir)
if opencv_root:
opencv_bin_paths.extend([
os.path.join(opencv_root, "bin"),
os.path.join(opencv_root, "x64", "mingw", "bin"),
])
opencv_runtime_dlls = []
for opencv_bin_path in opencv_bin_paths:
opencv_runtime_dlls.extend(find_files(opencv_bin_path, ["*opencv*.dll"]))
if not opencv_runtime_dlls:
log.warning("No Windows OpenCV runtime DLLs found in known bin paths: %s", opencv_bin_paths)
if opencv_root:
log.info("Searching Windows OpenCV prefix for runtime DLLs: %s", opencv_root)
opencv_runtime_dlls = list(find_files(opencv_root, ["*opencv*.dll"]))
if opencv_runtime_dlls:
for dll_path in opencv_runtime_dlls:
for dll_path in sorted(set(opencv_runtime_dlls)):
log.info("Adding Windows OpenCV runtime DLL: %s", dll_path)
src_files.append((dll_path, os.path.basename(dll_path)))
else:
log.warning("No Windows OpenCV runtime DLLs found in: %s", opencv_bin_path)
log.warning("No Windows OpenCV runtime DLLs found for OpenCV root: %s", opencv_root)
else:
log.warning("OPENCV_ROOT is not set; Windows OpenCV runtime DLLs will rely on cx_Freeze detection.")