Building on Windows with CMake and VS 2019 - missing modules

Hi,
I downloaded the latest version (4.5.2) source code, as well as Opencv Contrib 4.5.2 source files.
I ran CMake-GUI, configured and generated a VS solution. But when I open up the solution with VS 2019, the only modules that appear are opencv_img_hash and opencv_world. Please see a screen shot from the VS solution:
image
I will paste down bellow CMake output and you can see that a lot of modules are missing (such as core, calib3d an so on):

> Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
> Detected processor: AMD64
> libjpeg-turbo: VERSION = 2.0.6, BUILD = opencv-4.5.2-libjpeg-turbo
> Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
> OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.5.2-openjp2-2.4.0
> OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
> found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
> at: C:/Workspace/opencv-4.5.2/build/3rdparty/ippicv/ippicv_win/icv
> found Intel IPP Integration Wrappers sources: 2020.0.0
> at: C:/Workspace/opencv-4.5.2/build/3rdparty/ippicv/ippicv_win/iw
> Could NOT find CUDNN (missing: CUDNN_LIBRARY CUDNN_INCLUDE_DIR) (Required is at least version "7.5")
> CUDA detected: 11.2
> CUDA: Using CUDA_ARCH_BIN=3.5;3.7;5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6
> CUDA NVCC target flags: -gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-D_FORCE_INLINES
> CUDA: MSVS generator is detected. Disabling CMake re-run checks (CMAKE_SUPPRESS_REGENERATION=ON). You need to run CMake manually if updates are required.
> Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
> Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
> Could NOT find BLAS (missing: BLAS_LIBRARIES) 
> Could NOT find LAPACK (missing: LAPACK_LIBRARIES) 
>     Reason given by package: LAPACK could not be found because dependency BLAS could not be found.
> 
> VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
> OpenCV Python: during development append to PYTHONPATH: C:/Workspace/opencv-4.5.2/build/python_loader
> Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
> Module opencv_alphamat disabled because the following dependencies are not found: Eigen
> Caffe:   NO
> Protobuf:   NO
> Glog:   NO
> freetype2:   NO
> harfbuzz:    NO
> Julia not found. Not compiling Julia Bindings. 
> Module opencv_ovis disabled because OGRE3D was not found
> No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
> Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
> Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
> Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
> Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
> Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
> Tesseract:   NO
> Processing WORLD modules...
>     module opencv_cudev...
>     module opencv_core...
> Allocator metrics storage type: 'long long'
>     module opencv_cudaarithm...
>     module opencv_flann...
>     module opencv_imgproc...
>     module opencv_intensity_transform...
>     module opencv_ml...
>     module opencv_phase_unwrapping...
>     module opencv_plot...
>     module opencv_quality...
>     module opencv_reg...
>     module opencv_surface_matching...
>     module opencv_cudafilters...
>     module opencv_cudaimgproc...
>     module opencv_cudawarping...
>     module opencv_dnn...
> Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': C:/Workspace/opencv-4.5.2/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
> opencv_dnn: filter out cuda4dnn source code
>     module opencv_dnn_superres...
>     module opencv_features2d...
>     module opencv_fuzzy...
>     module opencv_hfs...
>     module opencv_imgcodecs...
>     module opencv_line_descriptor...
>     module opencv_photo...
>     module opencv_saliency...
>     module opencv_text...
>     module opencv_videoio...
>     module opencv_wechat_qrcode...
>     module opencv_xphoto...
>     module opencv_calib3d...
>     module opencv_cudacodec...
>     module opencv_cudafeatures2d...
>     module opencv_cudastereo...
>     module opencv_datasets...
>     module opencv_highgui...
>     module opencv_mcc...
>     module opencv_objdetect...
>     module opencv_rapid...
>     module opencv_rgbd...
> rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
>     module opencv_shape...
>     module opencv_structured_light...
>     module opencv_video...
>     module opencv_xfeatures2d...
>     module opencv_ximgproc...
>     module opencv_xobjdetect...
>     module opencv_aruco...
>     module opencv_bgsegm...
>     module opencv_bioinspired...
>     module opencv_ccalib...
>     module opencv_cudabgsegm...
>     module opencv_cudalegacy...
>     module opencv_cudaobjdetect...
>     module opencv_dnn_objdetect...
>     module opencv_dpm...
>     module opencv_face...
>     module opencv_gapi...
>     module opencv_optflow...
>     module opencv_stitching...
>     module opencv_tracking...
>     module opencv_cudaoptflow...
> Building with NVIDIA Optical Flow API 2.0
>     module opencv_stereo...
>     module opencv_superres...
>     module opencv_videostab...
> Processing WORLD modules... DONE
> CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
>   CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
>   directory
> Call Stack (most recent call first):
>   CMakeLists.txt:1010 (include)
> 
> 
> 
> General configuration for OpenCV 4.5.2 =====================================
>   Version control:               unknown
> 
>   Extra modules:
>     Location (extra):            C:/Workspace/opencv_contrib-4.5.2/modules
>     Version control (extra):     unknown
> 
>   Platform:
>     Timestamp:                   2021-04-21T12:57:56Z
>     Host:                        Windows 10.0.19042 AMD64
>     CMake:                       3.19.2
>     CMake generator:             Visual Studio 16 2019
>     CMake build tool:            C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin/MSBuild.exe
>     MSVC:                        1928
>     Configuration:               Debug Release
> 
>   CPU/HW features:
>     Baseline:                    SSE SSE2 SSE3
>       requested:                 SSE3
>     Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
>       requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
>       SSE4_1 (15 files):         + SSSE3 SSE4_1
>       SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
>       FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
>       AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
>       AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
>       AVX512_SKX (4 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
> 
>   C/C++:
>     Built as dynamic libs?:      YES
>     C++ standard:                11
>     C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe  (ver 19.28.29913.0)
>     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  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /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  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MDd /Zi /Ob0 /Od /RTC1 
>     C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/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  /fp:precise     /MP   /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  /fp:precise     /MP /MDd /Zi /Ob0 /Od /RTC1 
>     Linker flags (Release):      /machine:x64  /INCREMENTAL:NO 
>     Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
>     ccache:                      NO
>     Precompiled headers:         NO
>     Extra dependencies:          cudart_static.lib nppc.lib nppial.lib nppicc.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/v11.2/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 dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab wechat_qrcode world xfeatures2d ximgproc xobjdetect xphoto
>     Disabled:                    python3 python_bindings_generator python_tests ts
>     Disabled by dependency:      -
>     Unavailable:                 alphamat cnn_3dobj cvv freetype hdf java julia matlab ovis python2 python2 sfm viz
>     Applications:                -
>     Documentation:               NO
>     Non-free algorithms:         NO
> 
>   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 2.0.6-62)
>     WEBP:                        build (ver encoder: 0x020f)
>     PNG:                         build (ver 1.6.37)
>     TIFF:                        build (ver 42 - 4.2.0)
>     JPEG 2000:                   build (ver 2.4.0)
>     OpenEXR:                     build (ver 2.3.0)
>     HDR:                         YES
>     SUNRASTER:                   YES
>     PXM:                         YES
>     PFM:                         YES
> 
>   Video I/O:
>     DC1394:                      NO
>     FFMPEG:                      YES (prebuilt binaries)
>       avcodec:                   YES (58.91.100)
>       avformat:                  YES (58.45.100)
>       avutil:                    YES (56.51.100)
>       swscale:                   YES (5.7.100)
>       avresample:                YES (4.0.0)
>     GStreamer:                   NO
>     DirectShow:                  YES
>     Media Foundation:            YES
>       DXVA:                      YES
> 
>   Parallel framework:            Concurrency
> 
>   Trace:                         YES (with Intel ITT)
> 
>   Other third-party libraries:
>     Intel IPP:                   2020.0.0 Gold [2020.0.0]
>            at:                   C:/Workspace/opencv-4.5.2/build/3rdparty/ippicv/ippicv_win/icv
>     Intel IPP IW:                sources (2020.0.0)
>               at:                C:/Workspace/opencv-4.5.2/build/3rdparty/ippicv/ippicv_win/iw
>     Lapack:                      NO
>     Eigen:                       NO
>     Custom HAL:                  NO
>     Protobuf:                    build (3.5.1)
> 
>   NVIDIA CUDA:                   YES (ver 11.2, CUFFT CUBLAS)
>     NVIDIA GPU arch:             35 37 50 52 60 61 70 75 80 86
>     NVIDIA PTX archs:
> 
>   cuDNN:                         NO
> 
>   OpenCL:                        YES (NVD3D11)
>     Include path:                C:/Workspace/opencv-4.5.2/3rdparty/include/opencl/1.2
>     Link libraries:              Dynamic load
> 
>   Python (for build):            C:/Python27/python.exe
> 
>   Java:                          
>     ant:                         NO
>     JNI:                         C:/Program Files/Java/jdk-15.0.1/include C:/Program Files/Java/jdk-15.0.1/include/win32 C:/Program Files/Java/jdk-15.0.1/include
>     Java wrappers:               NO
>     Java tests:                  NO
> 
>   Install to:                    C:/Workspace/opencv-4.5.2/build/install
> -----------------------------------------------------------------
> 
> Configuring done
> Generating done

What am I missing?
Thanks

Expand opencv_world, all the modules should be contained within it.

1 Like

if this puzzles you, you can disable “world” from cmake-gui.

normally, each module gets its own library file, so you’d have to link to opencv_core452, opencv_highgui452, … and each module gets its own project in a VS solution.

“world” is a choice and means that all the modules are bundled into one “world” module, so you only have to link against opencv_world452

to answer your question: you aren’t missing anything.

Great, got it. Thanks!