Skip to content

Configuration

CMake configuration options for Mini-OpenCV.

Build Types

TypeDescription
ReleaseOptimized build (default)
DebugDebug symbols, no optimization
RelWithDebInfoRelease with debug info
bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

CMake Options

Build Options

OptionDefaultDescription
BUILD_EXAMPLESONBuild example programs
BUILD_TESTSONBuild GoogleTest suite
BUILD_BENCHMARKSOFFBuild performance benchmarks
BUILD_SHARED_LIBSOFFBuild as shared library

CUDA Options

OptionDefaultDescription
CUDA_ARCHautoGPU architectures (e.g., "80;86;89")
CUDA_FAST_MATHONFast math mode
CUDA_VERBOSE_PTXASOFFVerbose PTX assembly

Advanced Options

OptionDefaultDescription
ENABLE_CUDA_ERROR_CHECKONRuntime error checking
ENABLE_MEMORY_TRACKINGOFFTrack GPU memory usage

GPU Architecture

Auto Detection

By default, CMake detects installed GPU:

bash
cmake -S . -B build  # Auto-detect

Manual Specification

bash
# Single architecture
cmake -S . -B build -DCUDA_ARCH=89

# Multiple architectures
cmake -S . -B build -DCUDA_ARCH="75;80;86;89"

Architecture Reference

ArchitectureComputeGPUs
Turing75RTX 20xx, T4
Ampere80A100
Ampere86RTX 30xx
Ada89RTX 40xx, L4
Hopper90H100

Example Configurations

Development

bash
cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=Debug \
    -DBUILD_EXAMPLES=ON \
    -DBUILD_TESTS=ON \
    -DENABLE_CUDA_ERROR_CHECK=ON

Production

bash
cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_TESTS=OFF \
    -DENABLE_CUDA_ERROR_CHECK=OFF

Benchmarking

bash
cmake -S . -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_BENCHMARKS=ON \
    -DCUDA_ARCH=89

Next Steps

Released under the MIT License.