从 Visual Studio C++ 中提取有用的文件列表(带路径)项目
我正在与一个团队合作开发相当多的 Visual Studio (2008) 项目,这些项目共享大量代码。有些文件可供所有项目使用,但有些文件仅对 1 或 2 个项目有用。 我正在寻找一种方法来提取一个特定项目的所有有用文件。
我们使用的原理是共享目录。每个项目都在包含目录列表(项目属性内)中选择它想要使用的共享目录。所有此类目录都是在根目录内创建的(直接或非)。
<前><代码> 项目目录/ 共享1_目录/ 共享2_目录/ ...
给定一个项目文件,复制所有需要的文件、保留共享目录结构但在新的根目录中的最有效方法是什么?这里的目标是对项目进行严格的归档。
注意:共享目录中的源文件通常不是 cpp 文件,而是头文件(我们的项目使用了很多模板)。
I am working with a team on quite a few visual studio (2008) projects which share a lot of code. Some files are used by all projects, but some are only useful to 1 or 2.
I am looking for a way to extract all useful files for one particular project.
The principle we use is to share directories. Each project selects the shared directories it wants to use in the inclusion-directory list (inside the project properties). All such directories are created inside a root directory (directly or not).
project_dir/ shared1_dir/ shared2_dir/ ...
Given a project file, what it the most efficient way to copy all needed files, keeping the shared-directory structure, but in a new root directory ? The objective here is to make a strict archive of a project.
NB : source files in shared directories are usually not cpp files, but rather header files (our projects use a lot of templates).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我用 python 编写了一个小工具来完成这项工作。其原理是在 devenv 中为要存档的解决方案+项目启动“全部重建”命令,并解释其输出。
此命令应用于特殊配置(在我的例子中为“ReleaseInclude”),对此进行了一些细微的更改(与“Release”配置相比):
*启用选项“showInincludes”(编译器选项)
* 为库启用选项“/verbose:lib”(链接器选项)
现在,
* 在 Visual Studio 项目文件中使用正则表达式,我已经能够检索所有 cpp 和其他资源文件。
* 在编译的输出上使用正则表达式(不要忘记启用 devenv 的输出!),我已经能够列出所有包含文件和库文件
我还过滤了此文件列表以忽略以 Visual-studio 为中心的文件。
经测试并批准。
I have written a small tool in python that does the job. The principle is to launch a "rebuild all" command in devenv for the to-be-archived solution+project, and to interpret its output.
This command is applied to a special configuration (in my case "ReleaseInclude") to which a couple of subtle changes (compared to "Release" configuration) have been made :
* enabled option "showIncludes" (compiler option)
* enabled option "/verbose:lib" for libraries (linker option)
Now,
* using regexp in visual studio project files, i have been able to retrieve all cpp and other ressource files.
* using regexp on the output of the compilation (don't forget to enable the output for devenv !), i have been able to list all include and library files
I have also filtered this list of files to ignore visual-studio-centric files.
Tested and approved.