Skip to content

Instantly share code, notes, and snippets.

@atinfinity
Last active May 5, 2017 12:32
Show Gist options
  • Save atinfinity/ca7c6890bb231124a37a771a8d62fe06 to your computer and use it in GitHub Desktop.
Save atinfinity/ca7c6890bb231124a37a771a8d62fe06 to your computer and use it in GitHub Desktop.
OpenCV 3.2ビルド用バッチファイル(VS2015/64bit)
:: 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=OFF ^
-D BUILD_opencv_cudabgsegm=OFF ^
-D BUILD_opencv_cudacodec=OFF ^
-D BUILD_opencv_cudafeatures2d=OFF ^
-D BUILD_opencv_cudafilters=OFF ^
-D BUILD_opencv_cudaimgproc=OFF ^
-D BUILD_opencv_cudalegacy=OFF ^
-D BUILD_opencv_cudaobjdetect=OFF ^
-D BUILD_opencv_cudaoptflow=OFF ^
-D BUILD_opencv_cudastereo=OFF ^
-D BUILD_opencv_cudawarping=OFF ^
-D BUILD_opencv_cudev=OFF ^
-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 WITH_1394=OFF ^
-D WITH_CUBLAS=OFF ^
-D WITH_CUDA=OFF ^
-D WITH_CUFFT=OFF ^
-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=OFF ^
-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
@atinfinity
Copy link
Author

OpenCV 3.2ビルド用バッチファイル(VS2015/64bit)

  1. OpenCV 3.2のルートディレクトリにopencv3.2_build_vs2015_x64.batをコピー
  2. VisualStudioコマンドプロンプトを起動
  3. VisualStudioコマンドプロンプトでOpenCV 3.2のルートディレクトリに移動
  4. opencv3.2_build_vs2015_x64.batを実行

という手順でビルドを行うことができます(CMake GUIポチポチしたくない人向け).
設定やファイルパス等は適宜書き換えが必要です.

バッチファイルのカスタマイズ方法

Visual Studioバージョン

VC_VERSION_NUMで指定している番号を必要に応じて編集してください.
VC_VERSION_NUM=14は「Visual Studio 2015」指定を表す)

TBB

TBB_ROOTを必要に応じて編集してください.

Eigen

EIGEN_INCLUDE_PATHを必要に応じて編集してください.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment