从Visual Studio C ++项目中提取有用的文件列表(带有路径) [英] Extract useful file list (with path) from Visual Studio C++ project

查看:339
本文介绍了从Visual Studio C ++项目中提取有用的文件列表(带有路径)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个团队与一些视觉工作室(2008年)项目共享了很多代码。一些文件被所有项目使用,但有些只对1或2有用。
我正在寻找一种方法来提取一个特定项目的所有有用文件。

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/  
 ...



$ b b

给定一个项目文件,什么是最有效的方式来复制所有需要的文件,保持共享目录结构,但在一个新的根目录?这里的目标是对一个项目进行严格的归档。

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.

注意:共享目录中的源文件通常不是cpp文件,而是头文件(我们的项目使用了很多模板)。

NB : source files in shared directories are usually not cpp files, but rather header files (our projects use a lot of templates).

推荐答案

我在python中写了一个小工具。原则是在devenv中为要归档的解决方案+项目启动rebuild all命令,并解释其输出。

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.

此命令适用于特殊配置(在我的情况下为ReleaseInclude),对其进行了一些细微的更改(与发布配置相比):
*启用选项showIncludes(编译器选项)
*为库(链接器选项)启用选项/ verbose:lib

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)


*在Visual Studio项目文件中使用regexp,我已经能够检索所有cpp和其他ressource文件。
*使用regexp对编译的输出(不要忘记启用devenv的输出!),我已经能够列出所有包含和库文件

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

我也过滤了此文件列表,以忽略以visual-studio为中心的文件。

I have also filtered this list of files to ignore visual-studio-centric files.

测试并通过审核。

这篇关于从Visual Studio C ++项目中提取有用的文件列表(带有路径)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆