简体   繁体   English

为所有项目配置OpenCV Visual Studio 2010

[英]configuring OpenCV for all projects Visual studio 2010

I'm working with OpenCV on Visual Studio 2010, it works fine, but I'm wondring if it's possible to make a configuration that will be valid for all projects in windows . 我正在Visual Studio 2010上使用OpenCV,它工作正常,但是我想知道是否有可能进行对Windows中所有项目均有效的配置。 instead of configuring every project. 而不是配置每个项目。

thanks in advance 提前致谢

Yes it is. 是的。 You need to use CMake . 您需要使用CMake Make a folder that contains all the projects of OpenCV in different subfolders. 创建一个文件夹,其中包含不同子文件夹中的OpenCV的所有项目。 You will need a cmakelists.txt file in the top folder that includes all the subfolders. 您将需要在顶部文件夹中包含所有子文件夹的cmakelists.txt文件。 On each subfolder you will need to have your source codes in src folder and your headers in a include folder. 在每个子文件夹上,您都需要将源代码保存在src文件夹中,并将标头保存在一个include文件夹中。 CMake will create a VS studio project for all your opencv different projects and will find authomatically the libs and link them. CMake将为您的所有opencv不同项目创建一个VS studio项目,并以合法方式找到这些库并将其链接。

Now, how to create the cmakelists.txt of each OpenCV project? 现在,如何创建每个OpenCV项目的cmakelists.txt? Something like this: 像这样:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT( project_name )

FIND_PACKAGE( OpenCV REQUIRED )

TARGET_LINK_LIBRARIES( ${PROJECT_NAME} {OpenCV_LIBS} )

Also check this links to set your cmake opencv projects. 还要检查此链接以设置您的cmake opencv项目。 It is a pain the first time, but believe me that then is realy easy to create your projects, it is automatic. 第一次很痛苦,但是请相信我,然后创建您的项目真的很容易,它是自动的。

To specify a per-user directory list 指定每个用户的目录列表

1.On the View menu, click Property Manager. 1.在“视图”菜单上,单击“属性管理器”。

2.In Property Manager, click a configuration-and-platform node; 2.在Property Manager中,单击一个配置平台节点; for example, Debug | 例如,调试| Win32. Win32的。

The node expands and displays a user property sheet such as Microsoft.Cpp.%platform%user, where %platform% is a system-defined value such as Win32 or X64. 节点将展开并显示用户属性表,例如Microsoft.Cpp。%platform%user,其中%platform%是系统定义的值,例如Win32或X64。 The %platform% value and the platform for the project must be the same. %platform%值和项目的平台必须相同。

3. Either double-click the user property sheet, or click the user property sheet and then click Properties in the shortcut menu. 3.双击用户属性表,或者单击用户属性表,然后在快捷菜单中单击属性。

The %user Property Sheet%Property Pages dialog box is displayed, and the VC++ Directories node is highlighted. 显示“%user Property Sheet%Property Pages”对话框,并突出显示“ VC ++目录”节点。

4. Edit the directory lists, as described earlier in step 3 of "To specify a project directory list". 4.编辑目录列表,如前面“指定项目目录列表”的步骤3中所述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM