New script to generate per-package vcproj files in VC71/VC80 subfolders, with just two parent sln files

This commit is contained in:
Fernando Cacciola 2007-03-26 23:38:41 +00:00
parent fcb91e76c7
commit ed5be7e498
8 changed files with 147 additions and 8 deletions

5
.gitattributes vendored
View File

@ -2601,6 +2601,11 @@ Voronoi_diagram_2/demo/Voronoi_diagram_2/voronoi_diagram_2.vcproj eol=crlf
Voronoi_diagram_2/doc_tex/Voronoi_diagram_2/voronoi.png -text
iostream/test/iostream/data/io.cin -text
wininst/developer_scripts/examples/master_71.vcproj -text
wininst/developer_scripts/examples/master_71_head.sln eol=crlf
wininst/developer_scripts/examples/master_71_proj_line.sln eol=crlf
wininst/developer_scripts/examples/master_80.vcproj -text
wininst/developer_scripts/examples/master_80_head.sln eol=crlf
wininst/developer_scripts/examples/master_80_proj_line.sln eol=crlf
wininst/developer_scripts/examples/src2sln -text
wininst/src/CGAL/cgallib_71.vcproj -text
wininst/src/CGAL/cgallib_80.vcproj -text

View File

@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="test_msvc71"
Name="SOURCE"
ProjectGUID="{7E47FDD3-2BE2-4190-B391-03778A146F31}"
Keyword="ManagedCProj">
<Platforms>
@ -34,7 +34,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
OutputFile="$(OutDir)/test_msvc71.exe"
OutputFile="$(OutDir)/SOURCE.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;..\..\lib&quot;;$(GMP_LIB_VC71);$(MPFR_LIB_VC71)"
GenerateDebugInformation="TRUE"/>
@ -82,7 +82,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
OutputFile="$(OutDir)/test_msvc71.exe"
OutputFile="$(OutDir)/SOURCE.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\lib&quot;;$(GMP_LIB_VC71);$(MPFR_LIB_VC71)"
GenerateDebugInformation="TRUE"/>
@ -115,7 +115,7 @@
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="master.EXT">
RelativePath="SOURCE.EXT">
<FileConfiguration
Name="Debug|Win32">
<Tool

View File

@ -0,0 +1,3 @@
Microsoft Visual Studio Solution File, Format Version 8.00
# Visual Studio 2003

View File

@ -0,0 +1,2 @@
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TARGET", "PROJECT", "{7E47FDD3-2BE2-4190-B391-03778A146F31}"
EndProject

View File

@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="test_msvc80"
Name="SOURCE"
ProjectGUID="{7E47FDD3-2BE2-4190-B391-03778A146F31}"
Keyword="ManagedCProj"
>
@ -63,7 +63,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
OutputFile="$(OutDir)/test_msvc80.exe"
OutputFile="$(OutDir)/SOURCE.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;..\..\lib&quot;;$(GMP_LIB_VC80);$(MPFR_LIB_VC80)"
GenerateDebugInformation="true"
@ -141,7 +141,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
OutputFile="$(OutDir)/test_msvc80.exe"
OutputFile="$(OutDir)/SOURCE.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;..\..\lib&quot;;$(GMP_LIB_VC80);$(MPFR_LIB_VC80)"
GenerateDebugInformation="true"
@ -180,7 +180,7 @@
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
>
<File
RelativePath="master.EXT"
RelativePath="SOURCE.EXT"
>
<FileConfiguration
Name="Debug|Win32"

View File

@ -0,0 +1,3 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005

View File

@ -0,0 +1,2 @@
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TARGET", "PROJECT", "{7E47FDD3-2BE2-4190-B391-03778A146F31}"
EndProject

View File

@ -0,0 +1,124 @@
#!/bin/sh
# Creates a VC71/VC80 .vcproj file corresponding to a source file
# $1 is the source file
# $2 is the extension of the source file
# $3 is the target compiler version: "71" or "80"
# $4 is the parent solution file
#
create_project_file()
{
srcfile=${1};
ext=${2};
ver=${3};
slnfile=${4};
# $srcname is a string of the form "source" were "source.some_extension" is the of the source file
srcname=`echo $srcfile|sed -e "s/\.$ext//"`;
# $projfile is a filename of the form "source.vcproj" were "source" is the basename of the source file
projfile=`echo $srcfile|sed -e "s/\.$ext/\.vcproj/"`;
# Creates a vcroj IFF it doesn't exist
if [[ ! -e $projfile ]]; then
echo "Creating $projfile under VC$ver folder"
#
# Takes a master .vcproj file, replaces the keywords
# SOURCE for $srcname
# EXT for $ext
# And moves the generated project file into the final folder
#
sed -e"s/SOURCE/$srcname/g" ../../developer_scripts/examples/master_${ver}.vcproj > ./src2sln_/temp.txt;
sed -e"s/EXT/$ext/g" ./src2sln_/temp.txt > ./src2sln_/$projfile;
mv ./src2sln_/$projfile ./VC$ver;
#
# Takes a master .sln entry line, replaces the keywords
# TARGET for $srcname
# PROJECT for $projfile
# And adds the line to parent solution file
#
echo "Adding $projfile to $slnfile"
sed -e"s/TARGET/$srcname/g" ../../developer_scripts/examples/master_${ver}_proj_line.sln > ./src2sln_/temp.txt;
sed -e"s,PROJECT,VC$ver/$projfile,g" ./src2sln_/temp.txt > ./src2sln_/temp2.txt;
mv ./src2sln_/$slnfile ./src2sln_/$slnfile.tmp
cat ./src2sln_/$slnfile.tmp ./src2sln_/temp2.txt > ./src2sln_/$slnfile
rm ./src2sln_/$slnfile.tmp
rm -rf ./src2sln_/temp.txt
rm -rf ./src2sln_/temp2.txt
fi
}
#
# Create a .vcproj Visual C++ makefile for each .C and .cpp file
# Usage: C2vcproj folder1 ...
#
# For each folder in parameters list
for h in $@ ; do
if [ -d $h ]; then
cd $h;
echo "In " $h;
pkg=`basename $h`
# Create a VC71 subdirectory IFF it doesn't already exists
if [[ ! -e "VC71" ]]; then
mkdir VC71
fi
# Create a VC80 subdirectory IFF it doesn't already exists
if [[ ! -e "VC80" ]]; then
mkdir VC80
fi
# ALWAYS create temporary subdirectory "src2sln_"
if [ -e src2sln_ ]; then
rm -r src2sln_;
fi
mkdir src2sln_;
# $sp71 is the filename of the solution for for VC71
sp71=$pkg"_VC71.sln"
# $sp80 is the filename of the solution for for VC80
sp80=$pkg"_VC80.sln"
echo "Creating $sp71"
cat ../../developer_scripts/examples/master_71_head.sln > ./src2sln_/$sp71
echo "Creating $sp80"
cat ../../developer_scripts/examples/master_80_head.sln > ./src2sln_/$sp80
# For each .C and .cpp file file
for ext in C cpp ; do
for i in *.$ext ; do
if [ ! $i = "*.$ext" ]; then
# if $i contains a function "main()"
zgrep main $i >/dev/null 2>&1
if [[ $? == 0 ]]; then
create_project_file $i $ext "71" $sp71
create_project_file $i $ext "80" $sp80
fi
fi
done
done
mv ./src2sln_/$sp71 ./$sp71;
mv ./src2sln_/$sp80 ./$sp80;
# Remove temporary subdirectory "src2sln_"
rm -r src2sln_
cd ..;
fi
done