团队合作时如何同步 Visual Studio 项目?
我们有一个问题,我们确信它已经解决了。我们大学的研究团队正在使用 Visual Studio 2010 开发一个软件。我们开发的软件基于不同的开源工具,这些工具在每台不同的计算机上都有自己的路径中的库。
开源包是用CMake编译的。我们单独成功地安装了它们并开始开发我们的软件。但问题是,由于路径设置的差异,我们单独编写的代码无法在彼此的计算机上运行。我们如何为我们的代码提供通用功能?我们也应该使用 CMake 吗?我们正在使用一个存储库,hg Mercurial。我们是否应该避免将项目文件提交到存储库而只提交头文件或源文件?我们是否应该对源代码进行修改,之后每次进行更改时都会由 CMake 配置该源代码?
谢谢。
We have a problem that we're sure that it's already solved. Our research team in the university is developing a software using Visual Studio 2010. The software we develop is based on different open source tools, which have their own libraries in their own paths at each different computer.
The open source packages are compiled with CMake. We, individually, have managed to install them and started to develop our software. But the thing is that our individually written codes don't work at each others' computers due to the differences in the path settings. How can we provide a general functionality for our codes? Should we also use CMake? We're using a repository, hg mercurial. Should we avoid committing project files to the repository and only commit header or source files? Should we perform modifications on the source which would later be configured by CMake everytime we make a change?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用 CMake 生成 Visual Studio 项目文件。仅提交源代码、标头和 CMakeLists.txt。
使用单独的构建路径。例如,如果您的项目结构类似于
创建一个构建文件夹
,并将 VS-Solution 和项目文件生成到此文件夹中。 CMake 将(希望:))找到所有库并为 VS 设置正确的包含和库路径。仅当将新源文件添加到项目中时,才会生成 VS 项目文件。 CMake 将自动检测到这一点并提示您是否要重新生成项目文件。
这就是我们的工作方式,而且我们做得非常好。 :)
You should use CMake to generate Visual Studio project files. Commit only source, header, and the CMakeLists.txt.
Work with a seperate build path. For example, if your Project structure is like
create a build folder like
and generate the VS-Solution and Project files into this folder. CMake will (hopefully :) ) find all the libraries and set the correct include and library paths for VS. The VS project files are only generated if new source files are added to the project. CMake will detect this automatically and prompt if you want to re-generate the project files.
This is how we work and we're doing really fine. :)
您应该在所有计算机上设置所有库路径,这样无论库放置在何处,只要它们位于某处并且编译器可以找到,它都可以工作。
You should set all library paths on all computers, so it'll work regardless of where the libraries are placed, as long as they're somewhere and can be found by the compiler.
您应该在项目设置(
Alt+F7< /code>)而不是绝对路径(例如:
C:\Include
或D:\Libs
等)另外,你们之间还要就项目文件的通用文件夹结构达成一致。
You should use relative paths (Eg:
..\..\Include
or..\..\Libs
) in your project settings(Alt+F7
) rather than the absolute paths(eg:C:\Include
orD:\Libs
etc)Also agree among yourselves a common folder structure for your project files.