cgal/wininst/developer_scripts/examples/C2vcproj

50 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# 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;
# Create temporary subdirectory "text"
if [ -e text ]; then
rm -r text;
fi
mkdir text;
# 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 $jp VC++ makefile if it doesn't exist
jp=`echo $i|sed -e "s/\.$ext/\.vcproj/"`;
if [[ ! -e $jp ]]; then
echo "Creating $jp"
ofn=`echo $i|sed -e "s/\.$ext/\.exe/"`;
k=`echo $i|sed -e "s/\.$ext//"`;
sed -e"s/master/$k/g" ../../developer_scripts/examples/master.vcproj > ./text/temp.txt;
sed -e"s/test_msvc7.exe/$ofn/g" ./text/temp.txt > ./text/temp2.txt;
sed -e"s/test_msvc7/$k/g" ./text/temp2.txt > ./text/$jp;
mv ./text/$jp ./;
rm -rf ./text/temp.txt ./text/temp2.txt
fi
fi
fi
done
done
# Remove temporary subdirectory "text"
rm -r text
cd ..;
fi
done