#contents

*概要 [#o5a90694]
-2018-09-20(日本時間)にOpenCV 4.0-alphaが[[Releaseされた>https://github.com/opencv/opencv/releases/tag/4.0.0-alpha]]
-Windows で OpenCV 4.0 alpha をビルドする
-ターゲットはWindows 10 (64bit)
-ビルドはx64ビルド
-CMake のバージョンは3.11.0
-Visual Studio 2015と2017 でビルド
-CUDA は10.0 (これも2018-09-20Releaseされた)
-opencv_contribを使ってビルドしてみる
-Gitでソースコードを取ってくる

**ソースコードのダウンロード [#t65295b8]
-[[OpenCV3.2のビルド]]と同じなので割愛
-同様に、https://github.com/opencv/opencv_contrib を C:\work\opencv_contribにcloneする
-4.0-alphaをOpenCV本体、OpenCV_contrib両方でチェックアウトする

**ビルド前準備 [#uf68d232]
-cmakeでソリューションファイルを作成する
-cmake(GUI版を起動する)
-Sourceの場所を指定する
--今回はc:\work\opencv-fork
-Buildの場所を指定する
--今回は c:\work\opencv-fork\build (2015用) と C:\work\opencv-fork\build2017 を指定する。
-Configureボタンを押す
-c:\work\opencv-fork\build が無いと文句を言われるので、ディレクトリの作成に同意する
-コンパイラのバージョンを聞かれるので、Visual Studio 14 2015 Win64とVisual Studio 15 2017 Win64を指定する&note{build-x64:要は64bit版ビルド};
--違うコンパイラを指定する場合はここでターゲットを変更する
--Visual Studio 2015 は VS14、Visual Studio 2017 は VS15なので注意
-Configureボタンを押す
-ガリガリCMakeが動いて、オプション一覧及び有効/無効が表示される
-WITH_CUDAにチェックを入れる
-OPENCV_EXTRA_MODULES_PATHにC:/work/opencv_contrib/modules
-自分のGPUに合わせて適切なCUDA_ARCHを設定する(私の場合は6.1)
-Generateボタンを押す
-指定したディレクトリ内に OpenCV.sln ができている

**ソースコードのビルド [#d6ae03d7]
-とりあえずDebug版だけ2015/2017同時にビルドしてみた
-CUDAとopencv_contribこみで2時間50分ほど

*OpenCVビルド時のコンフィグなど [#q611db8c]
**cvconfig.h [#g8246fd7]
#geshi(c++){{
#ifndef OPENCV_CVCONFIG_H_INCLUDED
#define OPENCV_CVCONFIG_H_INCLUDED

/* OpenCV compiled as static or dynamic libs */
#define BUILD_SHARED_LIBS

/* OpenCV intrinsics optimized code */
#define CV_ENABLE_INTRINSICS

/* OpenCV additional optimized code */
/* #undef CV_DISABLE_OPTIMIZATION */

/* Compile for 'real' NVIDIA GPU architectures */
#define CUDA_ARCH_BIN " 61"

/* 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 " 61"

/* 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 */

/* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/
#define 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 */

/* Halide support */
/* #undef HAVE_HALIDE */

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Intel Perceptual Computing SDK library */
/* #undef HAVE_INTELPERC */

/* Intel Integrated Performance Primitives */
#define HAVE_IPP
#define HAVE_IPP_ICV
#define HAVE_IPP_IW

/* 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 */
#define 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 */

/* librealsense library */
/* #undef HAVE_LIBREALSENSE */

/* PNG codec */
#define HAVE_PNG

/* Posix threads (pthreads) */
/* #undef HAVE_PTHREAD */

/* 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 */

/* Ste||ar Group High Performance ParallelX */
/* #undef HAVE_HPX */

/* 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 */

/* Intel Media SDK */
/* #undef HAVE_MFX */

/* Lapack */
/* #undef HAVE_LAPACK */

/* Library was compiled with functions instrumentation */
/* #undef ENABLE_INSTRUMENTATION */

/* OpenVX */
/* #undef HAVE_OPENVX */

#if defined(HAVE_XINE)         || \
    defined(HAVE_GSTREAMER)    || \
    defined(HAVE_QUICKTIME)    || \
    defined(HAVE_QTKIT)        || \
    defined(HAVE_AVFOUNDATION) || \
    /*defined(HAVE_OPENNI)     || too specialized */ \
    defined(HAVE_FFMPEG)       || \
    defined(HAVE_MSMF)
#define HAVE_VIDEO_INPUT
#endif

#if /*defined(HAVE_XINE)       || */\
    defined(HAVE_GSTREAMER)    || \
    defined(HAVE_QUICKTIME)    || \
    defined(HAVE_QTKIT)        || \
    defined(HAVE_AVFOUNDATION) || \
    defined(HAVE_FFMPEG)       || \
    defined(HAVE_MSMF)
#define HAVE_VIDEO_OUTPUT
#endif

/* OpenCV trace utilities */
#define OPENCV_TRACE


#endif // OPENCV_CVCONFIG_H_INCLUDED
}}

**opencv_version_win32.exe [#l3fc018f]
-Windows用にビルド詳細を吐き出す実行プログラムopencv_version_win32.exeが追加された
 
 General configuration for OpenCV 4.0.0-alpha =====================================
   Version control:               4.0.0-alpha
 
   Extra modules:
     Location (extra):            C:/work/opencv_contrib/modules
     Version control (extra):     4.0.0-alpha
 
   Platform:
     Timestamp:                   2018-09-21T08:57:23Z
     Host:                        Windows 10.0.17134 AMD64
     CMake:                       3.11.0
     CMake generator:             Visual Studio 14 2015 Win64
     CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
     MSVC:                        1900
 
   CPU/HW features:
     Baseline:                    SSE SSE2 SSE3
       requested:                 SSE3
     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2
       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
       SSE4_1 (4 files):          + SSSE3 SSE4_1
       SSE4_2 (2 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
       FP16 (1 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
       AVX (6 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
       AVX2 (10 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
 
   C/C++:
     Built as dynamic libs?:      YES
     C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.24215.1)
     C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi      /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP8   /MD /O2 /Ob2 /DNDEBUG
     C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi      /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP8   /MDd /Zi /Ob0 /Od /RTC1
     C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.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
     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  /MDd /Zi /Ob0 /Od /RTC1
     Linker flags (Release):      /machine:x64  /INCREMENTAL:NO
     Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL
     ccache:                      NO
     Precompiled headers:         YES
     Extra dependencies:          cudart.lib nppc.lib nppial.lib nppicc.lib nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64
     3rdparty dependencies:
 
   OpenCV modules:
     To be built:                 aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dpm face features2d flann fuzzy hfs highgui img_hash imgcodecs imgproc java_bindings_generator line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
     Disabled:                    js world
     Disabled by dependency:      -
     Unavailable:                 cnn_3dobj cvv freetype hdf java matlab ovis python2 python3 sfm viz
     Applications:                tests perf_tests apps
     Documentation:               NO
     Non-free algorithms:         YES
 
   Windows RT support:            NO
 
   GUI:
     Win32 UI:                    YES
     VTK support:                 NO
 
   Media I/O:
     ZLib:                        build (ver 1.2.11)
     JPEG:                        build-libjpeg-turbo (ver 1.5.3-62)
     WEBP:                        build (ver encoder: 0x020e)
     PNG:                         build (ver 1.6.34)
     TIFF:                        build (ver 42 - 4.0.9)
     JPEG 2000:                   build (ver 1.900.1)
     OpenEXR:                     build (ver 1.7.1)
     HDR:                         YES
     SUNRASTER:                   YES
     PXM:                         YES
     PFM:                         YES
 
   Video I/O:
     Video for Windows:           YES
     DC1394:                      NO
     FFMPEG:                      YES (prebuilt binaries)
       avcodec:                   YES (ver 58.18.100)
       avformat:                  YES (ver 58.12.100)
       avutil:                    YES (ver 56.14.100)
       swscale:                   YES (ver 5.1.100)
       avresample:                YES (ver 4.0.0)
     GStreamer:                   NO
     DirectShow:                  YES
     Media Foundation:            YES
 
   Parallel framework:            Concurrency
 
   Trace:                         YES (with Intel ITT)
 
   Other third-party libraries:
     Intel IPP:                   2017.0.3 [2017.0.3]
            at:                   C:/work/opencv-fork/build/3rdparty/ippicv/ippicv_win
     Intel IPP IW:                sources (2017.0.3)
               at:                C:/work/opencv-fork/build/3rdparty/ippicv/ippiw_win
     Lapack:                      NO
     Eigen:                       NO
     Custom HAL:                  NO
     Protobuf:                    build (3.5.1)
 
   NVIDIA CUDA:                   YES (ver 10.0, CUFFT CUBLAS)
     NVIDIA GPU arch:             61
     NVIDIA PTX archs:
 
   OpenCL:                        YES (no extra features)
     Include path:                C:/work/opencv-fork/3rdparty/include/opencl/1.2
     Link libraries:              Dynamic load
 
   Python (for build):            C:/Users/tomoaki/AppData/Local/Programs/Python/Python36/python.exe
 
   Java:
     ant:                         NO
     JNI:                         NO
     Java wrappers:               NO
     Java tests:                  NO
 
   Install to:                    C:/work/opencv-fork/build/install
 -----------------------------------------------------------------
 
 
 [ INFO:0] Initialize OpenCL runtime...
 OpenCL Platforms:
     Intel(R) OpenCL
         iGPU: Intel(R) UHD Graphics 620 (OpenCL 2.1 )
         CPU: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (OpenCL 2.1 (Build 10))
 Current OpenCL device:
     Type = iGPU
     Name = Intel(R) UHD Graphics 620
     Version = OpenCL 2.1
     Driver version = 22.20.16.4840
     Address bits = 64
     Compute units = 24
     Max work group size = 256
     Local memory size = 64 KB
     Max memory allocation size = 1 GB 1023 MB 1023 KB 1023 B
     Double support = Yes
     Host unified memory = Yes
     Device extensions:
         cl_intel_accelerator
         cl_intel_advanced_motion_estimation
         cl_intel_d3d11_nv12_media_sharing
         cl_intel_device_side_avc_motion_estimation
         cl_intel_driver_diagnostics
         cl_intel_dx9_media_sharing
         cl_intel_media_block_io
         cl_intel_motion_estimation
         cl_intel_planar_yuv
         cl_intel_packed_yuv
         cl_intel_required_subgroup_size
         cl_intel_simultaneous_sharing
         cl_intel_subgroups
         cl_intel_subgroups_short
         cl_khr_3d_image_writes
         cl_khr_byte_addressable_store
         cl_khr_d3d10_sharing
         cl_khr_d3d11_sharing
         cl_khr_depth_images
         cl_khr_dx9_media_sharing
         cl_khr_fp16
         cl_khr_fp64
         cl_khr_gl_depth_images
         cl_khr_gl_event
         cl_khr_gl_msaa_sharing
         cl_khr_global_int32_base_atomics
         cl_khr_global_int32_extended_atomics
         cl_khr_gl_sharing
         cl_khr_icd
         cl_khr_image2d_from_buffer
         cl_khr_local_int32_base_atomics
         cl_khr_local_int32_extended_atomics
         cl_khr_mipmap_image
         cl_khr_mipmap_image_writes
         cl_khr_spir
         cl_khr_subgroups
         cl_khr_throttle_hints
     Has AMD Blas = No
     Has AMD Fft = No
     Preferred vector width char = 16
     Preferred vector width short = 8
     Preferred vector width int = 4
     Preferred vector width long = 1
     Preferred vector width float = 1
     Preferred vector width double = 1
 OpenCV's HW features list:
     ID=  1 (MMX) -> ON
     ID=  2 (SSE) -> ON
     ID=  3 (SSE2) -> ON
     ID=  4 (SSE3) -> ON
     ID=  5 (SSSE3) -> ON
     ID=  6 (SSE4.1) -> ON
     ID=  7 (SSE4.2) -> ON
     ID=  8 (POPCNT) -> ON
     ID=  9 (FP16) -> ON
     ID= 10 (AVX) -> ON
     ID= 11 (AVX2) -> ON
     ID= 12 (FMA3) -> ON
 Total available: 12
 

*ビルドに要した時間Top10 [#n38f32a0]
TBW
*関連ページ [#uefab68d]
-[[:OpenCV 4.0]]
-[[:OpenCV]]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS