1#! /bin/sh
2#
3# This script generates the Visual Studio 6 build files for Windows.
4#
5# 20041214 larsa
6
7if test x"$COINDIR" = x""; then
8  echo >&2 "error: you must have the environment variable COINDIR set."
9  exit 1
10fi
11
12if test x"$QTDIR" = x""; then
13  echo >&2 "error: you must have the environment variable QTDIR set."
14  exit 1
15fi
16
17project=soqt1
18
19function cleansolution() {
20  name=$1;
21  rm -f ${name}.dsw ${name}.sln;
22}
23
24function cleanproject() {
25  name=$1;
26  rm -f ${name}.dsp ${name}.vcproj;
27}
28
29function escape () {
30  echo $1 | sed -e 's/\\/\\\\/g'
31}
32
33proper=true;
34
35cleansolution ${project}
36cleanproject ${project}
37cleanproject ${project}_install
38cleanproject ${project}_uninstall
39cleanproject ${project}_docs
40
41rm -f install-headers.bat uninstall-headers.bat
42
43build_pwd=`pwd`
44build="`cygpath -w $build_pwd | sed -e 's/\\\\/\\\\\\\\/g'`"
45build_pwd="`pwd | sed -e 's/\\//\\\\\\\\/g'`\\\\"
46
47source_pwd=`cd ../..; pwd`
48source="`cygpath -w $source_pwd | sed -e 's/\\\\/\\\\\\\\/g'`"
49source_pwd="`(cd ../..; pwd) | sed -e 's/\\//\\\\\\\\/g'`"
50
51../../configure --with-msvcrt=mtd --with-suffix=d \
52  --enable-debug --enable-symbols || exit 1
53mv src/config.h src/config-debug.h
54
55../../configure --enable-msvcdsp --with-msvcrt=mt \
56  --disable-debug --disable-symbols --enable-optimization || exit 1
57mv src/config.h src/config-release.h
58
59cp ../misc/config-wrapper.h src/config.h
60
61make || exit 1
62
63ECOINDIR=$(escape ${COINDIR})
64EQTDIR=$(escape ${QTDIR})
65
66sed \
67  -e "s/$build/./g" \
68  -e "s/$build_pwd//g" \
69  -e "s/$source/..\\\\../g" \
70  -e "s/$source_pwd/..\\\\../g" \
71  -e "s/${ECOINDIR}/\$(COINDIR)/gi" \
72  -e "s/${EQTDIR}/\$(QTDIR)/gi" \
73  -e 's/COIN_DLL/COIN_NOT_DLL/g' \
74  -e '/_MAKE_DLL/ { s/COIN_NOT_DLL/COIN_DLL/g; }' \
75  -e '/^# ADD .*LINK32.*\/debug/ { s/COINDIR)\\lib\\coin3.lib/COINDIR)\\lib\\coin3d.lib/g; }' \
76  -e '/^# ADD .*LINK32.*\/debug/ { s/QTDIR)\\lib\\Qt\([^ ]*\)4.lib/QTDIR)\\lib\\Qt\1d4.lib/g; }' \
77  -e 's/$/\r/g' \
78  <${project}.dsp >new.dsp
79
80mv new.dsp ${project}.dsp
81
82sed \
83  -e "s/$build/./g" \
84  -e "s/$build_pwd//g" \
85  -e "s/$source/..\\\\../g" \
86  -e "s/$source_pwd/..\\\\../g" \
87  -e "s/${ECOINDIR}/\$(COINDIR)/gi" \
88  -e "s/${EQTDIR}/\$(QTDIR)/gi" \
89  -e 's/$/\r/g' \
90  <install-headers.bat >new.bat
91
92mv new.bat ../misc/install-headers.bat
93
94sed \
95  -e "s/$build/./g" \
96  -e "s/$build_pwd//g" \
97  -e "s/$source/..\\\\../g" \
98  -e "s/$source_pwd/..\\\\../g" \
99  -e "s/${ECOINDIR}/\$(COINDIR)/gi" \
100  -e "s/${EQTDIR}/\$(QTDIR)/gi" \
101  -e 's/$/\r/g' \
102  <uninstall-headers.bat >new.bat
103
104mv new.bat ../misc/uninstall-headers.bat
105
106echo "Done."
107echo ""
108echo "* Make sure there are no absolute paths in the project files"
109grep -i c: ${project}.dsp ${project}.dsw
110echo "* Make sure 'Public Headers' group is preceded by 2s 'End Group' lines."
111echo "* Fix up DLL library dependencies, so Debug Builds use debug dependencies."
112echo "* Upgrade project files by running devenv soqt1.dsw"
113echo "* Run ./fixvcproj.sh if you are using msvc7."
114
115find . -name "moc_*" | xargs rm
116
117# How can I avoid the modal upgrade prompt-dialog for MSVC7.1 here???
118# devenv /command "File.OpenProject $build\\${project}.dsp"
119