VS:使用一个pros文件在Debug和Release下配置opencv

目录

1.背景

2.目的

3.方法

4.配置

4.1. OpenCV 4.4.0:

4.2. OpenCV3.4.6

4.3. Opencv2.4.13

4.4 添加该.pros文件


 

1.背景

某个偶然的机会,看到有些VS工程只配置一个pros文件即可满足opencv在Debug和Release模式下的运行。

2.目的

实现一个pros统领opencv在Debug和Release下的运行,但不限于配置opencv。

3.方法

在标签头中加入Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" 或者Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" 即可实现在同一配置文件(.pros)中实现不同平台的配置。

4.配置

pros文件如下:给出OpenCV4、OpenCV3、OpenCV2某一版本的模板。一下结果均配置为x64

创建后缀为.pros文件,或者在如下图vs里Add New Project Property Sheet,然后根据按照opencv版本选择4.1-4.3以本文编辑方式填写.pros文件。

VS:使用一个pros文件在Debug和Release下配置opencv_第1张图片

4.1. OpenCV 4.4.0:

中在对应输入头文件目录和库文件目录

PS:若Debug和Release下文件路径不同,则,例: 改写为 等。



  
  
  
  
    F:\opencv4\build\include;F:\opencv4\build\include\opencv2
    F:\opencv4\build\x64\vc14\lib;$(LibraryPath)
  
  
    
      opencv_world440d.lib;%(AdditionalDependencies)
    
  
  
    
      opencv_world440.lib;%(AdditionalDependencies)
    
  
  

4.2. OpenCV3.4.6



  
  
  
  
    F:\opencv3\build\include;F:\opencv3\build\include\opencv2
    F:\opencv3\build\x64\vc14\lib;$(LibraryPath)
  
  
    
      opencv_world346d.lib;%(AdditionalDependencies)
    
  
  
    
      opencv_world346.lib;%(AdditionalDependencies)
    
  
  

4.3. Opencv2.4.13



  
  
  
  
    F:\opencv2\build\include;F:\opencv2\build\include\opencv2
    F:\opencv2\build\x64\vc14\lib;$(LibraryPath)
  
  
    
      opencv_ml2413d.lib;opencv_calib3d2413d.lib;opencv_contrib2413d.lib;opencv_core2413d.lib;opencv_features2d2413d.lib;opencv_flann2413d.lib;opencv_gpu2413d.lib;opencv_highgui2413d.lib;opencv_imgproc2413d.lib;opencv_legacy2413d.lib;opencv_objdetect2413d.lib;opencv_ts2413d.lib;opencv_video2413d.lib;opencv_nonfree2413d.lib;opencv_ocl2413d.lib;opencv_photo2413d.lib;opencv_stitching2413d.lib;opencv_superres2413d.lib;opencv_videostab2413d.lib;%(AdditionalDependencies)
    
  
  
    
      opencv_ml2413.lib;opencv_calib3d2413.lib;opencv_contrib2413.lib;opencv_core2413.lib;opencv_features2d2413.lib;opencv_flann2413.lib;opencv_gpu2413.lib;opencv_highgui2413.lib;opencv_imgproc2413.lib;opencv_legacy2413.lib;opencv_objdetect2413.lib;opencv_ts2413.lib;opencv_video2413.lib;opencv_nonfree2413.lib;opencv_ocl2413.lib;opencv_photo2413d.lib;opencv_stitching2413.lib;opencv_superres2413.lib;opencv_videostab2413.lib;%(AdditionalDependencies)
    
  

4.4 添加该.pros文件

Debug和Release下都添加该.pros文件,结果如下:

VS:使用一个pros文件在Debug和Release下配置opencv_第2张图片

Debug:

VS:使用一个pros文件在Debug和Release下配置opencv_第3张图片

Release:

VS:使用一个pros文件在Debug和Release下配置opencv_第4张图片

最终一个pros即可实现opencv在Debug和Release下的配置,无需配置两个.pros两件。(该方法不限于配置opencv)。

你可能感兴趣的:(程序,笔记)