Skip to content

Commit c37e175

Browse files
committed
[build] Use static linking for CUDA build and allow dynamic AVX dispatch
1 parent 072bda8 commit c37e175

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/workflows/build-windows-cuda.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ jobs:
3232
- name: 🐍 Set up Python
3333
uses: actions/setup-python@v5
3434
with:
35-
python-version: '3.13'
35+
python-version: '3.12'
3636

3737
- name: 📦 Install Python Build Requirements
3838
run: |
3939
python -m pip install --upgrade pip
4040
pip install numpy wheel
4141
42+
- name: Setup MSBuild.exe
43+
uses: microsoft/[email protected]
44+
45+
- name: Setup NASM
46+
uses: ilammy/setup-nasm@v1
47+
4248
- name: 🔧 Install NVIDIA CUDA Toolkit
4349
run: |
4450
echo "Downloading CUDA Toolkit..."
@@ -63,17 +69,21 @@ jobs:
6369
- name: Clone opencv-python repository
6470
run: |
6571
git clone --depth 1 --recursive https://github.com/opencv/opencv-python.git
66-
pip install numpy packaging scikit-build
72+
pip install numpy packaging scikit-build cmake==3.24.2
6773
6874
# - CUDA_ARCH_BIN: Specifies the CUDA architectures to build for.
6975
# - CUDA_ARCH_PTX: Specifies the virtual architecture for forward compatibility.
7076
# TODO: Set correct PTX versions below.
7177
# TODO: Validate the built wheel can be installed and run.
78+
# TODO: Slim down the modules we build to only the ones that DVR-Scan needs to run:
79+
# https://docs.opencv.org/4.x/db/d05/tutorial_config_reference.html#tutorial_config_reference_general_modules
7280
- name: 🛠️ Build opencv-python with CUDA
7381
run: |
7482
cd opencv-python
75-
$CMAKE_ARGS = '-D CMAKE_BUILD_TYPE=RELEASE -D WITH_CUDA=ON -D CUDA_ARCH_BIN="6.0;6.1;7.0;7.5" -D CUDA_ARCH_PTX=7.5 -D OPENCV_ENABLE_NONFREE=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF'
83+
$CMAKE_ARGS = '-D CMAKE_BUILD_TYPE=RELEASE -D BUILD_SHARED_LIBS=OFF -D WITH_CUDA=ON -D CUDA_ARCH_BIN="6.0;6.1;7.0;7.5" -D CUDA_ARCH_PTX=7.5 -D OPENCV_ENABLE_NONFREE=ON -D ENABLE_LTO=ON -D CPU_DISPATCH="AVX,AVX2" -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D OPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules'
84+
$ENABLE_CONTRIB = 1
7685
pip wheel . --verbose
86+
shell: pwsh
7787

7888
- name: 📤 Upload Artifact
7989
uses: actions/[email protected]

0 commit comments

Comments
 (0)