Last active
May 5, 2017 12:35
-
-
Save atinfinity/97f58b63683bac3fcb73da49b65a69ad to your computer and use it in GitHub Desktop.
OpenCV 3.2ビルド用バッチファイル(VS2015/64bit/WITH_CUDA)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: setting of the environment variables | |
set SOURCE_DIR=%~dp0 | |
set BUILD_DIR=%SOURCE_DIR%\build | |
set INSTALL_DIR=%BUILD_DIR%\install | |
set VC_VERSION_NUM=14 | |
set VCVARSALL_BAT="C:\Program Files (x86)\Microsoft Visual Studio %VC_VERSION_NUM%.0\VC\vcvarsall.bat" | |
set ARCH=amd64 | |
set GENERATOR_NAME=Visual Studio %VC_VERSION_NUM% Win64 | |
set TBB_ROOT=C:/dev/tbb2017_20170226oss | |
call %VCVARSALL_BAT% %ARCH% | |
mkdir build | |
cd build | |
:: runnig CMake | |
cmake.exe ^ | |
-G "%GENERATOR_NAME%" ^ | |
--build "%BUILD_DIR%" ^ | |
-D BUILD_CUDA_STUBS=OFF ^ | |
-D BUILD_DOCS=OFF ^ | |
-D BUILD_EXAMPLES=OFF ^ | |
-D BUILD_JASPER=ON ^ | |
-D BUILD_JPEG=ON ^ | |
-D BUILD_OPENEXR=ON ^ | |
-D BUILD_PACKAGE=ON ^ | |
-D BUILD_PERF_TESTS=OFF ^ | |
-D BUILD_PNG=ON ^ | |
-D BUILD_SHARED_LIBS=ON ^ | |
-D BUILD_TBB=OFF ^ | |
-D BUILD_TESTS=OFF ^ | |
-D BUILD_TIFF=ON ^ | |
-D BUILD_WITH_DEBUG_INFO=ON ^ | |
-D BUILD_WITH_STATIC_CRT=ON ^ | |
-D BUILD_ZLIB=ON ^ | |
-D BUILD_WEBP=ON ^ | |
-D BUILD_opencv_apps=ON ^ | |
-D BUILD_opencv_calib3d=ON ^ | |
-D BUILD_opencv_core=ON ^ | |
-D BUILD_opencv_cudaarithm=ON ^ | |
-D BUILD_opencv_cudabgsegm=ON ^ | |
-D BUILD_opencv_cudacodec=ON ^ | |
-D BUILD_opencv_cudafeatures2d=ON ^ | |
-D BUILD_opencv_cudafilters=ON ^ | |
-D BUILD_opencv_cudaimgproc=ON ^ | |
-D BUILD_opencv_cudalegacy=ON ^ | |
-D BUILD_opencv_cudaobjdetect=ON ^ | |
-D BUILD_opencv_cudaoptflow=ON ^ | |
-D BUILD_opencv_cudastereo=ON ^ | |
-D BUILD_opencv_cudawarping=ON ^ | |
-D BUILD_opencv_cudev=ON ^ | |
-D BUILD_opencv_features2d=ON ^ | |
-D BUILD_opencv_flann=ON ^ | |
-D BUILD_opencv_highgui=ON ^ | |
-D BUILD_opencv_imgcodecs=ON ^ | |
-D BUILD_opencv_imgproc=ON ^ | |
-D BUILD_opencv_java=OFF ^ | |
-D BUILD_opencv_ml=ON ^ | |
-D BUILD_opencv_objdetect=ON ^ | |
-D BUILD_opencv_photo=ON ^ | |
-D BUILD_opencv_python2=OFF ^ | |
-D BUILD_opencv_python3=OFF ^ | |
-D BUILD_opencv_shape=ON ^ | |
-D BUILD_opencv_stitching=ON ^ | |
-D BUILD_opencv_superres=ON ^ | |
-D BUILD_opencv_ts=ON ^ | |
-D BUILD_opencv_video=ON ^ | |
-D BUILD_opencv_videoio=ON ^ | |
-D BUILD_opencv_videostab=ON ^ | |
-D BUILD_opencv_viz=OFF ^ | |
-D BUILD_opencv_world=OFF ^ | |
-D CMAKE_CONFIGURATION_TYPES="Debug;Release" ^ | |
-D CMAKE_INSTALL_PREFIX="%INSTALL_DIR%" ^ | |
-D EIGEN_INCLUDE_PATH="C:/dev/eigen-3.3.3/build/install/include/eigen3" ^ | |
-D TBB_ENV_INCLUDE="%TBB_ROOT%/include" ^ | |
-D TBB_ENV_LIB="%TBB_ROOT%/lib/intel64/vc14/tbb.lib" ^ | |
-D TBB_ENV_LIB_DEBUG="%TBB_ROOT%/lib/intel64/vc14/tbb_debug.lib" ^ | |
-D CUDA_ARCH_BIN="6.1" ^ | |
-D CUDA_ARCH_PTX="" ^ | |
-D WITH_1394=OFF ^ | |
-D WITH_CUBLAS=ON ^ | |
-D WITH_CUDA=ON ^ | |
-D WITH_CUFFT=ON ^ | |
-D WITH_DIRECTX=ON ^ | |
-D WITH_DSHOW=ON ^ | |
-D WITH_EIGEN=ON ^ | |
-D WITH_FFMPEG=ON ^ | |
-D WITH_GDAL=OFF ^ | |
-D WITH_GIGEAPI=OFF ^ | |
-D WITH_INTELPERC=OFF ^ | |
-D WITH_IPP=ON ^ | |
-D WITH_IPP_A=OFF ^ | |
-D WITH_JASPER=ON ^ | |
-D WITH_JPEG=ON ^ | |
-D WITH_MSMF=ON ^ | |
-D WITH_NVCUVID=ON ^ | |
-D WITH_OPENCL=OFF ^ | |
-D WITH_OPENCLAMDBLAS=OFF ^ | |
-D WITH_OPENCLAMDFFT=OFF ^ | |
-D WITH_OPENCL_SVM=OFF ^ | |
-D WITH_OPENEXR=ON ^ | |
-D WITH_OPENGL=ON ^ | |
-D WITH_OPENMP=OFF ^ | |
-D WITH_OPENNI=OFF ^ | |
-D WITH_OPENNI2=OFF ^ | |
-D WITH_OPENVX=OFF ^ | |
-D WITH_PNG=ON ^ | |
-D WITH_PVAPI=OFF ^ | |
-D WITH_QT=OFF ^ | |
-D WITH_TBB=ON ^ | |
-D WITH_TIFF=ON ^ | |
-D WITH_VFW=OFF ^ | |
-D WITH_VTK=OFF ^ | |
-D WITH_WEBP=ON ^ | |
-D WITH_WIN32UI=ON ^ | |
-D WITH_XIMEA=OFF %SOURCE_DIR% | |
:: Building the OpenCV(Debug/Release) using Visual Studio | |
devenv /build "Debug|x64" /project "INSTALL" OpenCV.sln | |
devenv /build "Release|x64" /project "INSTALL" OpenCV.sln |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OpenCV 3.2ビルド用バッチファイル(VS2015/64bit/WITH_CUDA)
という手順でビルドを行うことができます(CMake GUIポチポチしたくない人向け).
設定やファイルパス等は適宜書き換えが必要です.
バッチファイルのカスタマイズ方法
Visual Studioバージョン
VC_VERSION_NUM
で指定している番号を必要に応じて編集してください.(
VC_VERSION_NUM=14
は「Visual Studio 2015」指定を表す)TBB
TBB_ROOT
を必要に応じて編集してください.Eigen
EIGEN_INCLUDE_PATH
を必要に応じて編集してください.CUDA
CUDA_ARCH_BIN
にNVIDIA GPUのCapability番号を指定します.※Capability番号はNVIDIAサイトから調べることができます.
筆者の環境の場合,GeForce GTX 1060(GPU Capability=6.1)を積んでいるため,
CUDA_ARCH_BIN="6.1"
と指定しています.このようにCapability番号を明示的に指定することで,動作させるGPU向けのみのコンパイルにとどめることができ,ビルド時間を大きく短縮することができます.参考URL