Skip to content

build(opencv): build CUDA as a first-class language - #67

Merged
ajakhotia merged 1 commit into
mainfrom
ajakhotia/opencv-first-class-cuda
Aug 22, 2026
Merged

ajakhotia merged 1 commit into
mainfrom
ajakhotia/opencv-first-class-cuda

Conversation

@ajakhotia

Copy link
Copy Markdown
Owner

Follow-up to #66. OpenCV's legacy FindCUDA path probes nvcc itself and ignores the toolchain's CMAKE_CUDA_* settings, which forced three workarounds there:

  • a hand-fed CUDA_ARCH_BIN=7.5,8.0 (the arch autodetection came back empty on GPU-less runners with clang 22 as host compiler),
  • -allow-unsupported-compiler passed twice through legacy variables,
  • skipping the python bindings in static builds, where the legacy path's bare linker names (cublas, cudnn) reached ninja as file dependencies and broke the cv2 module link.

With ENABLE_CUDA_FIRST_CLASS_LANGUAGE=ON the toolchain files supply the architectures, the host compiler, and the override through the standard CMAKE_CUDA_* machinery, and all three workarounds retire. The flag had been OFF only because the recipe froze OpenCV's then-default when its option surface was first enumerated, not from any adverse experience with the first-class path.

The legacy FindCUDA path probes nvcc itself, ignoring the toolchain's CMAKE_CUDA_*
settings, which forced three workarounds: a hand-fed CUDA_ARCH_BIN, the
-allow-unsupported-compiler override passed twice, and skipping the python bindings in
static builds where the legacy path's bare linker names (cublas, cudnn) broke the cv2
module link. With ENABLE_CUDA_FIRST_CLASS_LANGUAGE the toolchain files supply the
architectures, the host compiler, and the override through the standard machinery, and all
three workarounds retire.
@ajakhotia
ajakhotia merged commit 8eca35b into main Aug 22, 2026
42 checks passed
@ajakhotia
ajakhotia deleted the ajakhotia/opencv-first-class-cuda branch August 22, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant