Skip to content

Commit e8031df

Browse files
committed
[actions] Include DLLs required to run package
1 parent 1193231 commit e8031df

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.github/workflows/build_wheels_windows.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ jobs:
7777
echo "Adding CUDA to PATH..."
7878
$CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4"
7979
echo "CUDA_PATH=$CUDA_PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
80+
Copy-Item -Path "$CUDA_PATH/bin/*" -Destination . -Include "*.dll"
8081
shell: pwsh
81-
#$arguments = "-s cublas_12.4 cublas_dev_12.4 cudart_12.4 cufft_12.4 cufft_dev_12.4 npp_12.4 npp_dev_12.4 nvcc_12.4"
82-
#echo "$CUDA_PATH\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
83-
#echo "$CUDA_PATH\lib\x64" | Out-File -FilePath $env:GITHUB_PATH -Append
84-
#echo "$CUDA_PATH"
8582
- name: Cache CuDNN Installer
8683
id: cache-cudnn-installer
8784
uses: actions/cache@v3
@@ -104,8 +101,16 @@ jobs:
104101
$CUDNN_PATH = "D:/a/opencv-python-cuda/opencv-python-cuda/cudnn-windows-x86_64-8.9.7.29_cuda12-archive"
105102
echo "CUDNN_LIBRARY=$CUDNN_PATH/lib/x64/cudnn.lib" | Out-File -FilePath $env:GITHUB_ENV -Append
106103
echo "CUDNN_INCLUDE_DIR=$CUDNN_PATH/include" | Out-File -FilePath $env:GITHUB_ENV -Append
104+
Copy-Item -Path "$CUDNN_PATH/bin/*" -Destination . -Include "*.dll"
107105
shell: pwsh
108106

107+
- name: Cache build artifacts
108+
uses: actions/cache@v3
109+
with:
110+
path: _skbuild
111+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/CMakeLists.txt') }}
112+
restore-keys: |
113+
${{ runner.os }}-${{ matrix.python-version }}-
109114
- name: Build a package
110115
# CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version
111116
run: |
@@ -114,8 +119,12 @@ jobs:
114119
python -m pip install --upgrade setuptools
115120
python -m pip install cmake==3.24.2
116121
python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
117-
set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
118-
shell: cmd
122+
$CI_BUILD = 1
123+
if (Test-Path _skbuild) {
124+
$SKIP_CMAKE = "--skip-cmake"
125+
}
126+
python setup.py $SKIP_CMAKE bdist_wheel --py-limited-api=cp37 --dist-dir="$PWD\wheelhouse" -v
127+
shell: pwsh
119128
- name: Saving all wheels
120129
uses: actions/upload-artifact@v4
121130
with:

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ include find_version.py
55
include setup.py
66
include pyproject.toml
77
include _build_backend/backend.py
8+
include *.dll
89
recursive-include cv2 *
910
recursive-include docker *
1011
recursive-include opencv *

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import glob
12
import io
23
import os
34
import os.path
@@ -140,7 +141,7 @@ def main():
140141

141142
# Files in sourcetree outside package dir that should be copied to package.
142143
# Raw paths relative to sourcetree root.
143-
files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
144+
files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt","*.dll"]}
144145

145146
ci_cmake_generator = (
146147
["-G", "Visual Studio 17 2022"]
@@ -453,7 +454,10 @@ def _classify_installed_files_override(
453454

454455
for package_name, paths in cls.files_outside_package.items():
455456
package_dest_reldir = package_name.replace(".", os.path.sep)
457+
expanded_paths = []
456458
for path in paths:
459+
expanded_paths += [path] if '*' not in path else glob.glob(path)
460+
for path in expanded_paths:
457461
new_install_relpath = os.path.join(
458462
package_dest_reldir,
459463
# Don't yet have a need to copy

0 commit comments

Comments
 (0)