Skip to content

Instantly share code, notes, and snippets.

@eruffaldi
Created June 20, 2021 03:14
Show Gist options
  • Save eruffaldi/a41bbe58951832c43977438080b52827 to your computer and use it in GitHub Desktop.
Save eruffaldi/a41bbe58951832c43977438080b52827 to your computer and use it in GitHub Desktop.
Compile NVIDIA Windows
% based on combination of online info
git clone https://github.com/opencv/opencv.git -b "4.5.2" --depth 1
git clone https://github.com/opencv/opencv_contrib.git -b "4.5.2" --depth 1
set "opencvSource=opencv-4.5.2"
set "opencvExtraModules=opencv_contrib-4.5.2/modules"
set "opencvBuild=%opencvSource%\build"
set "compiler=Visual Studio 16 2019"
set "buildType=Release"
set python3_executable
set python3_include_dir
set python3_library
set python3_numpy_include_dirs
set python3_packages_path
% RTX4000 is Turing7.5
cmake ^
-B"%opencvBuild%/" ^
-H"%opencvSource%/" ^
-G"%compiler%" ^
-Ax64 ^
-DCMAKE_BUILD_TYPE=%buildType% ^
-DBUILD_opencv_world=ON ^
-DINSTALL_TESTS=OFF ^
-DINSTALL_C_EXAMPLES=OFF ^
-DBUILD_EXAMPLES=OFF ^
-DOPENCV_EXTRA_MODULES_PATH="%opencvExtraModules%/" ^
-DBUILD_PROTOBUF=ON ^
-DBUILD_opencv_python_bindings_generator=ON ^
-DWITH_CUDA=ON ^
-DCUDA_FAST_MATH=ON ^
-DWITH_CUBLAS=ON ^
-DCUDA_ARCH_PTX=7.5 ^
-DBUILD_opencv_python3=ON ^
-DPYTHON3_EXECUTABLE="%python3_executable%" ^
-DOPENCV_PYTHON3_VERSION=3.7.3 ^
-DPYTHON3_INCLUDE_DIR="%python3_include_dir%" ^
-DPYTHON3_LIBRARY="%python3_library%" ^
-DPYTHON3_NUMPY_INCLUDE_DIRS="%python3_numpy_include_dirs%" ^
-DPYTHON3_PACKAGES_PATH="%python3_packages_path%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment