views:

91

answers:

1

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

A: 

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.

Benoît