- まさかの3.0リリース前に2.4.10がリリースされた
- ターゲットはWindows 7 (64bit)
- OpenCVのバージョンは2.4.10
- ビルド環境はVS2012
- CMakeのバージョンは3.0.1
- 今回はGitでソースコードを取ってくる
ソースコードのダウンロード†
ビルド前準備†
- リポジトリは予め適当な場所に移動させる
- cmakeでソリューションファイルを作成する
- cmake(GUI版を起動する)
- Sourceの場所を指定する
- Buildの場所を指定する
- 今回は D:\OpenCV2410\build を指定する。
- Configureボタンを押す
- D:\OpenCV2410\build が無いと文句を言われるので、ディレクトリの作成に同意する
- コンパイラのバージョンを聞かれるので、Visual Studio 2012を指定する
- 違うコンパイラを指定する場合はここでターゲットを変更する
- Visual Studio 2010→VS10
- Visual Studio 2012→VS11
- Visual Studio 2013→VS12
- と、微妙に表記と数字がずれるので注意
- Configureボタンを押す
- 今回は、WITH_CUDA、WITH_TBBでビルドした
- 適当なライブラリをWITHオプションで組み込む様にすると、ライブラリの場所を聞かれる
- TBBの場合はincludeディレクトリの場所を指定したら、ライブラリが置かれているディレクトリは自動的に見つけてくれた
- CMake様の恩恵です。
- Generateボタンを押す
- D:\OpenCV2410\build\OpenCV.sln が作成される。
ソースコードのビルド†
- 前のステップまでで生成されたOpenCV.sln を Visual Studio 2012で開く
- 大量にプロジェクトが読み込まれるので、バッチビルドする。
- ビルド(B)→バッチビルド(T)でバッチビルド画面を出す
- バッチビルドでALL_BUILDのdebug/release両方を選択する
- さっくりビルドが終わった。
- 5時間20分ぐらいかかった。
インストール†
- INSTALLプロジェクトをビルドするとインストールされる
- 詳細は割愛
OpenCVビルド時のコンフィグなど†
cvconfig.h†
/* OpenCV compiled as static or dynamic libs */
#define BUILD_SHARED_LIBS
/* Compile for 'real' NVIDIA GPU architectures */
#define CUDA_ARCH_BIN " 11 12 13 20 21 30 35"
/* Create PTX or BIN for 1.0 compute capability */
/* #undef CUDA_ARCH_BIN_OR_PTX_10 */
/* NVIDIA GPU features are used */
#define CUDA_ARCH_FEATURES " 11 12 13 20 20 30 35 30"
/* Compile for 'virtual' NVIDIA PTX architectures */
#define CUDA_ARCH_PTX " 30"
/* AVFoundation video libraries */
/* #undef HAVE_AVFOUNDATION */
/* V4L capturing support */
/* #undef HAVE_CAMV4L */
/* V4L2 capturing support */
/* #undef HAVE_CAMV4L2 */
/* Carbon windowing environment */
/* #undef HAVE_CARBON */
/* AMD's Basic Linear Algebra Subprograms Library*/
/* #undef HAVE_CLAMDBLAS */
/* AMD's OpenCL Fast Fourier Transform Library*/
/* #undef HAVE_CLAMDFFT */
/* Cocoa API */
/* #undef HAVE_COCOA */
/* C= */
/* #undef HAVE_CSTRIPES */
/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
/* #undef HAVE_CUBLAS */
/* NVidia Cuda Runtime API*/
#define HAVE_CUDA
/* NVidia Cuda Fast Fourier Transform (FFT) API*/
#define HAVE_CUFFT
/* IEEE1394 capturing support */
/* #undef HAVE_DC1394 */
/* IEEE1394 capturing support - libdc1394 v2.x */
/* #undef HAVE_DC1394_2 */
/* DirectShow Video Capture library */
#define HAVE_DSHOW
/* Eigen Matrix & Linear Algebra Library */
/* #undef HAVE_EIGEN */
/* FFMpeg video library */
#define HAVE_FFMPEG
/* ffmpeg's libswscale */
#define HAVE_FFMPEG_SWSCALE
/* ffmpeg in Gentoo */
#define HAVE_GENTOO_FFMPEG
/* GStreamer multimedia framework */
/* #undef HAVE_GSTREAMER */
/* GTK+ 2.0 Thread support */
/* #undef HAVE_GTHREAD */
/* Windows Runtime support */
/* #undef HAVE_WINRT */
/* Win32 UI */
#define HAVE_WIN32UI
/* GTK+ 2.x toolkit */
/* #undef HAVE_GTK */
/* Apple ImageIO Framework */
/* #undef HAVE_IMAGEIO */
/* Intel Perceptual Computing SDK library */
/* #undef HAVE_INTELPERC */
/* Intel Integrated Performance Primitives */
/* #undef HAVE_IPP */
/* JPEG-2000 codec */
#define HAVE_JASPER
/* IJG JPEG codec */
#define HAVE_JPEG
/* libpng/png.h needs to be included */
/* #undef HAVE_LIBPNG_PNG_H */
/* V4L/V4L2 capturing support via libv4l */
/* #undef HAVE_LIBV4L */
/* Microsoft Media Foundation Capture library */
/* #undef HAVE_MSMF */
/* NVidia Video Decoding API*/
/* #undef HAVE_NVCUVID */
/* OpenCL Support */
#define HAVE_OPENCL
/* #undef HAVE_OPENCL_STATIC */
/* OpenEXR codec */
#define HAVE_OPENEXR
/* OpenGL support*/
/* #undef HAVE_OPENGL */
/* OpenNI library */
/* #undef HAVE_OPENNI */
/* PNG codec */
#define HAVE_PNG
/* Qt support */
/* #undef HAVE_QT */
/* Qt OpenGL support */
/* #undef HAVE_QT_OPENGL */
/* QuickTime video libraries */
/* #undef HAVE_QUICKTIME */
/* QTKit video libraries */
/* #undef HAVE_QTKIT */
/* Intel Threading Building Blocks */
/* #undef HAVE_TBB */
/* TIFF codec */
#define HAVE_TIFF
/* Unicap video capture library */
/* #undef HAVE_UNICAP */
/* Video for Windows support */
#define HAVE_VFW
/* V4L2 capturing support in videoio.h */
/* #undef HAVE_VIDEOIO */
/* Win32 UI */
#define HAVE_WIN32UI
/* XIMEA camera support */
/* #undef HAVE_XIMEA */
/* Xine video library */
/* #undef HAVE_XINE */
/* Define if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
version_string.inc†
General configuration for OpenCV 2.4.10 =====================================
Version control: 2.4.10
Platform:
Host: Windows 6.1 AMD64
CMake: 3.0.1
CMake generator: Visual Studio 11 2012
CMake build tool: C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe
MSVC: 1700
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/cl.exe (ver 17.0.61030.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /MD /O2 /Ob2 /D NDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /wd4251 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /MD /O2 /Ob2 /D NDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /arch:SSE2 /Oi /fp:fast /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:X86 /INCREMENTAL:NO /debug
Linker flags (Debug): /machine:X86 /debug /INCREMENTAL
Precompiled headers: YES
OpenCV modules:
To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
Disabled: world
Disabled by dependency: -
Unavailable: androidcamera dynamicuda java python viz
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.7)
JPEG: build (ver 62)
PNG: build (ver 1.5.12)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 55.18.102)
format: YES (ver 55.12.100)
util: YES (ver 52.38.100)
swscale: YES (ver 2.3.100)
gentoo-style: YES
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Other third-party libraries:
Use IPP: NO
Use Eigen: NO
Use TBB: NO
Use OpenMP: NO
Use GCD NO
Use Concurrency YES
Use C=: NO
Use Cuda: YES (ver 5.5)
Use OpenCL: YES
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: NO
USE NVCUVID: NO
NVIDIA GPU arch: 11 12 13 20 21 30 35
NVIDIA PTX archs: 30
Use fast math: NO
OpenCL:
Version: dynamic
Include path: D:/OepnCV2410/3rdparty/include/opencl/1.2
Use AMD FFT: NO
Use AMD BLAS: NO
Python:
Interpreter: NO
Java:
ant: NO
JNI: C:/Program Files (x86)/Java/jdk1.7.0_07/include C:/Program Files (x86)/Java/jdk1.7.0_07/include/win32 C:/Program Files (x86)/Java/jdk1.7.0_07/include
Java tests: NO
Documentation:
Build Documentation: NO
Sphinx: NO
PdfLaTeX compiler: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: D:/OepnCV2410/build/install
cvconfig.h is in: D:/OepnCV2410/build
-----------------------------------------------------------------