#contents
#stub
#TBW
*概要 [#x8656b47]
-2016-12-20(日本時間)にOpenCV 3.2 のRCが[[Releaseされた>https://github.com/opencv/opencv/releases/tag/3.2.0-rc]]¬e{opencv-3-1-has-been-release:[[Release 3.2.0-rc · opencv/opencv>https://github.com/opencv/opencv/releases/tag/3.2.0-rc]], 2016-12-20公開, 2016-12-20閲覧, Ver 3.2 RC};
-Windows で OpenCV 3.2 をビルドする
-ターゲットはWindows 7 (64bit)
-ビルドはx64ビルド
-CMake のバージョンは3.6.1
-Visual Studio 2012 でビルド
-CUDA は8.0
-Gitでソースコードを取ってくる
**ソースコードのダウンロード [#f6c10a35]
-git でリポジトリをクローンしてくる。URL は git://github.com/opencv/opencv.git
git.exe clone --progress -v "git://github.com/opencv/opencv.git" "C:\work\opencv-fork"
-OpenCV3.1がリリースされた後、IntelによるItseezの買収があったので、URLが変わった
-今回は予めclone してあったので、fetchしてcheckoutする
-取得したリポジトリから、Tagの3.2RCにスイッチする
-今回はWindowsのTortoiseGitを使ったので、添付図の様に、TortoiseGit→Switch/Checkoutを選択
#ref(OpenCV2.4.10のビルド/switch_checkout_git.png)
-Switch To で Tag から3.2.0-rcを選択する
#ref(OpenCV2.4.10のビルド/003checkout.png)
-Switchされるのを待つ
#ref(OpenCV2.4.10のビルド/004checkout.png)
**ビルド前準備 [#x8161a3b]
-cmakeでソリューションファイルを作成する
-cmake(GUI版を起動する)
-Sourceの場所を指定する
--今回はc:\work\opencv-fork
-Buildの場所を指定する
--今回は c:\work\opencv-fork\build を指定する。
-Configureボタンを押す
-c:\work\opencv-fork\build が無いと文句を言われるので、ディレクトリの作成に同意する
#ref(005cmake-notify.png)
-コンパイラのバージョンを聞かれるので、Visual Studio 2012 Win64を指定する¬e{build-x64:要は64bit版ビルド。CUDA7.5では6.0と違い、nppc、nppi、nppsなどのライブラリが64bit版しか同梱されておらず、32bit版には含まれていないため};
--違うコンパイラを指定する場合はここでターゲットを変更する
--Visual Studio 2012 は VS11なので注意
#ref(005-cmake-compiler-20160728.png)
-Configureボタンを押す
-ガリガリCMakeが動いて、オプション一覧及び有効/無効が表示される
#ref(005cmake-20160728.png)
-3.1.0以前のときと違い、どうも自動で適切なCUDA_ARCHを検出しているっぽい
#ref(008cmake-configure-20160728.png)
-Generateボタンを押す
#ref(009cmake-generate-20160728.png)
-指定したディレクトリ内に OpenCV.sln ができている
#ref(010cmake-solution.png)
**ソースコードのビルド [#q37b6cf7]
-前のステップまでで生成されたOpenCV.sln を Visual Studio 2012で開く
-大量にプロジェクトが読み込まれるので、バッチビルドする。
-ビルド(B)→バッチビルド(T)でバッチビルド画面を出す
-バッチビルドでALL_BUILDのdebug/release両方を選択する
#ref(011vs-batch-build.png)
-約2時間7分でDebug/Release両ビルド修了
**OpenCVビルド時のコンフィグなど [#z39733da]
***cvconfig.h [#b0946492]
#geshi(c++){{
/* OpenCV compiled as static or dynamic libs */
#define BUILD_SHARED_LIBS
/* Compile for 'real' NVIDIA GPU architectures */
#define CUDA_ARCH_BIN " 30"
/* 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 " 30"
/* Compile for 'virtual' NVIDIA PTX architectures */
#define CUDA_ARCH_PTX ""
/* 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 */
/* Clp support */
/* #undef HAVE_CLP */
/* 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 */
/* DirectX */
#define HAVE_DIRECTX
#define HAVE_DIRECTX_NV12
#define HAVE_D3D11
#define HAVE_D3D10
#define HAVE_D3D9
/* DirectShow Video Capture library */
#define HAVE_DSHOW
/* Eigen Matrix & Linear Algebra Library */
/* #undef HAVE_EIGEN */
/* FFMpeg video library */
#define HAVE_FFMPEG
/* Geospatial Data Abstraction Library */
/* #undef HAVE_GDAL */
/* GStreamer multimedia framework */
/* #undef HAVE_GSTREAMER */
/* GTK+ 2.0 Thread support */
/* #undef HAVE_GTHREAD */
/* GTK+ 2.x toolkit */
/* #undef HAVE_GTK */
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
/* Intel Perceptual Computing SDK library */
/* #undef HAVE_INTELPERC */
/* Intel Integrated Performance Primitives */
#define HAVE_IPP
#define HAVE_IPP_ICV_ONLY
/* Intel IPP Async */
/* #undef HAVE_IPP_A */
/* JPEG-2000 codec */
#define HAVE_JASPER
/* IJG JPEG codec */
#define HAVE_JPEG
/* libpng/png.h needs to be included */
/* #undef HAVE_LIBPNG_PNG_H */
/* GDCM DICOM codec */
/* #undef HAVE_GDCM */
/* V4L/V4L2 capturing support via libv4l */
/* #undef HAVE_LIBV4L */
/* Microsoft Media Foundation Capture library */
/* #undef HAVE_MSMF */
/* NVidia Video Decoding API*/
/* #undef HAVE_NVCUVID */
/* NVidia Video Encoding API*/
/* #undef HAVE_NVCUVENC */
/* OpenCL Support */
#define HAVE_OPENCL
/* #undef HAVE_OPENCL_STATIC */
/* #undef HAVE_OPENCL_SVM */
/* OpenEXR codec */
#define HAVE_OPENEXR
/* OpenGL support*/
/* #undef HAVE_OPENGL */
/* OpenNI library */
/* #undef HAVE_OPENNI */
/* OpenNI library */
/* #undef HAVE_OPENNI2 */
/* PNG codec */
#define HAVE_PNG
/* Posix threads (pthreads) */
/* #undef HAVE_PTHREADS */
/* parallel_for with pthreads */
/* #undef HAVE_PTHREADS_PF */
/* 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 */
/* gPhoto2 library */
/* #undef HAVE_GPHOTO2 */
/* VA library (libva) */
/* #undef HAVE_VA */
/* Intel VA-API/OpenCL */
/* #undef HAVE_VA_INTEL */
/* Lapack */
/* #undef HAVE_LAPACK */
/* Lapack Generic */
/* #undef HAVE_LAPACK_GENERIC */
/* Lapack MKL */
/* #undef HAVE_LAPACK_MKL */
/* FP16 */
#define HAVE_FP16
/* Library was compiled with functions instrumentation */
/* #undef ENABLE_INSTRUMENTATION */
/* OpenVX */
/* #undef HAVE_OPENVX */
}}
-無事、私が書いたFP16関連の機能が日の目を見ることに。(HAVE_FP16はFP16のHW命令対応のコンパイルを行うということ)
***version_string.inc [#reeea974]
General configuration for OpenCV 3.2.0-rc =====================================
Version control: 3.2.0-rc
Platform:
Timestamp: 2016-12-20T09:03:17Z
Host: Windows 6.1.7601 AMD64
CMake: 3.6.1
CMake generator: Visual Studio 11 2012 Win64
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/x86_amd64/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 /Oi /wd4127 /wd4251 /wd4324 /wd4275 /wd4589 /MP8 /MD /O2 /Ob2 /DNDEBUG /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 /Oi /wd4127 /wd4251 /wd4324 /wd4275 /wd4589 /MP8 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin/x86_amd64/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 /Oi /MP8 /MD /O2 /Ob2 /DNDEBUG /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 /Oi /MP8 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO /debug
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
ccache: NO
Precompiled headers: YES
Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32 cudart nppc nppi npps cufft -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64
3rdparty dependencies: zlib libjpeg libwebp libpng libtiff libjasper IlmImf
OpenCV modules:
To be built: cudev core cudaarithm flann imgproc ml video cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab
Disabled: world
Disabled by dependency: -
Unavailable: java python2 python3 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.8)
JPEG: build (ver 90)
WEBP: build (ver 0.3.1)
PNG: build (ver 1.6.24)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (ver 57.64.101)
avformat: YES (ver 57.56.100)
avutil: YES (ver 55.34.100)
swscale: YES (ver 4.2.100)
avresample: YES (ver 3.1.0)
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Parallel framework: Concurrency
Other third-party libraries:
Use IPP: 9.0.1 [9.0.1]
at: C:/work/opencv-fork/build/3rdparty/ippicv/ippicv_win
Use IPP Async: NO
Use Lapack: NO
Use Eigen: NO
Use Cuda: YES (ver 8.0)
Use OpenCL: YES
Use OpenVX: NO
Use custom HAL: NO
NVIDIA CUDA
Use CUFFT: YES
Use CUBLAS: NO
USE NVCUVID: NO
NVIDIA GPU arch: 30
NVIDIA PTX archs:
Use fast math: NO
OpenCL: <Dynamic loading of OpenCL library>
Include path: C:/work/opencv-fork/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: NO
Python 3:
Interpreter: NO
Python (for build): NO
Java:
ant: NO
JNI: NO
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Documentation:
Doxygen: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: C:/work/opencv-fork/build/install
cvconfig.h is in: C:/work/opencv-fork/build
-----------------------------------------------------------------
**ビルドに要した時間Top10 [#o8e3e117]
** Releaseのdll [#d626d2a3]
|opencv_cudafilters320.dll|15m51s|
|opencv_cudaarithm320.dll|08m03s|
|opencv_cudaoptflow320.dll|04m49s|
|opencv_cudaimgproc320.dll|03m28s|
|opencv_cudafeatures2d320.dll|03m17s|
|opencv_cudaobjdetect320.dll|02m21s|
|opencv_cudalegacy320.dll|02m04s|
|opencv_photo320.dll|02m03s|
|opencv_cudawarping320.dll|01m56s|
|opencv_cudabgsegm320.dll|01m55s|
** Debugのdll [#v884b6d3]
|opencv_cudafilters320d.dll|14m59s|
|opencv_cudaarithm320d.dll|07m44s|
|opencv_cudaoptflow320d.dll|04m19s|
|opencv_cudaimgproc320d.dll|02m52s|
|opencv_cudalegacy320d.dll|01m41s|
|opencv_cudafeatures2d320d.dll|01m34s|
|opencv_cudawarping320d.dll|01m25s|
|opencv_photo320d.dll|01m05s|
|opencv_superres320d.dll|01m02s|
** Releaaseのexe [#k5ca0510]
|opencv_test_cudev.exe|04m28s|
|opencv_test_imgproc.exe|01m09s|
|opencv_perf_core.exe|00m38s|
|opencv_perf_imgproc.exe|00m38s|
|opencv_test_core.exe|00m30s|
|opencv_test_video.exe|00m21s|
|opencv_test_cudaarithm.exe|00m20s|
|opencv_test_photo.exe|00m19s|
|opencv_test_cudaoptflow.exe|00m19s|
|opencv_perf_cudaarithm.exe|00m19s|
** Debugのexe [#dd361ba3]
|opencv_test_cudevd.exe|04m20s|
|opencv_test_stitchingd.exe|00m57s|
|opencv_test_imgprocd.exe|00m56s|
|opencv_perf_cored.exe|00m32s|
|opencv_perf_imgprocd.exe|00m31s|
|opencv_test_videod.exe|00m20s|
|opencv_test_cudaoptflowd.exe|00m19s|
|opencv_test_cored.exe|00m18s|
|opencv_test_cudaarithmd.exe|00m18s|
|opencv_test_photod.exe|00m17s|
*OpenCVのVersion [#k9594d9f]
$ ./Release/opencv_version.exe
3.2.0-rc
*関連ページ [#k528afe0]
-[[OpenCV3.1のビルド]]
-[[OpenCV3.0.0のビルド]]
-[[OpenCV3.0.0-betaのビルド]]
-[[OpenCV3.0.0-alphaのビルド]]
-[[OpenCV2.4.10.1のビルド]]
-[[OpenCV2.4.10のビルド]]
-[[OpenCV2.4.9のビルド]]
-[[OpenCV2.4.8のビルド]]
-[[OpenCV2.1と2.2に見るビルド方法の違い]]
-[[:OpenCV 3.0]]
-[[:OpenCV 3.2]]
-[[:OpenCV]]