Files @ r12814:d3ea363c27e5
Branch filter:

Location: cpp/openttd-patchpack/source/projects/generate - annotation

alberth
(svn r17314) -Fix (r17313): Allow the picker window to change size.
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r12768:980ae0491352
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r7897:208c0b5e92ea
r7897:208c0b5e92ea
r7897:208c0b5e92ea
r7897:208c0b5e92ea
r7897:208c0b5e92ea
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r7894:6be1a91bbf06
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r10379:941352ab53b3
r5475:3f5cd13d1b63
r6901:0ac8fd77d505
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r7294:493f34a5ab4d
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6937:bea726150bf3
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r10377:1214a5a043e3
r10239:d676e472d079
r8972:137e7b61f897
r8972:137e7b61f897
r8972:137e7b61f897
r8972:137e7b61f897
r8972:137e7b61f897
r8972:137e7b61f897
r8972:137e7b61f897
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5512:7067d1c92fed
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r10379:941352ab53b3
r5475:3f5cd13d1b63
r6901:0ac8fd77d505
r5475:3f5cd13d1b63
r6045:591cb717985d
r6045:591cb717985d
r10400:576ffcc0a2be
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5774:7cae51e69a53
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6045:591cb717985d
r8934:d5858392238b
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r8409:2e7aa818987b
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r8409:2e7aa818987b
r8409:2e7aa818987b
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5512:7067d1c92fed
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r10239:d676e472d079
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r8409:2e7aa818987b
r8409:2e7aa818987b
r5475:3f5cd13d1b63
r8409:2e7aa818987b
r8409:2e7aa818987b
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r12527:425371f8c37c
r8409:2e7aa818987b
r8409:2e7aa818987b
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6177:eb0daf8b1566
r5512:7067d1c92fed
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6177:eb0daf8b1566
r5475:3f5cd13d1b63
r8409:2e7aa818987b
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6177:eb0daf8b1566
r5475:3f5cd13d1b63
r5512:7067d1c92fed
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6177:eb0daf8b1566
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r6936:6f0a52e3732c
r6936:6f0a52e3732c
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r5475:3f5cd13d1b63
r8409:2e7aa818987b
r8409:2e7aa818987b
r8409:2e7aa818987b
r8409:2e7aa818987b
#!/bin/bash

# $Id$

# This file is part of OpenTTD.
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.

# This file generates all project files based on sources.list, so everyone who
#  can start a bash process, can update the project files.

ROOT_DIR="`pwd`/.."
if ! [ -e "$ROOT_DIR/source.list" ]
then
	ROOT_DIR="`pwd`"
fi
if ! [ -e "$ROOT_DIR/source.list" ]
then
	echo "Can't find source.list, needed in order to make this run. Please go to either"
	echo " the project dir, or the root dir of a clean SVN checkout."
	exit 1
fi

# openttd_vs90.sln    is for MSVC 2008
# openttd_vs90.vcproj is for MSVC 2008
# langs_vs90.vcproj   is for MSVC 2008
# strgen_vs90.vcproj  is for MSVC 2008

# openttd_vs80.sln    is for MSVC 2005
# openttd_vs80.vcproj is for MSVC 2005
# langs_vs80.vcproj   is for MSVC 2005
# strgen_vs80.vcproj  is for MSVC 2005



# First, collect the list of Windows files
allegro_config=""
sdl_config="1"
png_config="1"
os="MSVC"
enable_dedicated="0"
with_cocoa="0"
enable_directmusic="1"
with_threads="1"
file_prefix="..\\\\src\\\\"

safety_check() {
	li=""
	for i in `cat $1 | grep -v "#\|ottdres.rc\|win32.cpp\|win32_v.cpp" | xargs -n 1 basename | sort`; do
		if [ "$li" = "$i" ]; then
			echo " !! ERROR !!"
			echo ""
			echo "The filename '$i' is already used in this project."
			echo "Because MSVC uses one single directory for all object files, it"
			echo "cannot handle filenames with the same name inside the same project."
			echo "Please rename either one of the file and try generating again."
			echo ""
			echo " !! ERROR !!"
			exit 1
		fi
		li="$i"
	done
}

grep '\.h' "$ROOT_DIR/source.list" | grep -v '../objs/langs/table/strings.h' | sed 's/	//' | sort > tmp.headers.source.list
find "$ROOT_DIR/src" \( -iname "*.h" -or -iname "*.hpp" \) -and -not -ipath "*/.svn/*" | sed "s~$ROOT_DIR/src/~~" | sort > tmp.headers.src
if [ -n "`diff tmp.headers.source.list tmp.headers.src`" ]; then
	echo "The following headers are missing in source.list and not in /src/ or vice versa."
	diff tmp.headers.source.list tmp.headers.src | grep '[<>]' | sort
	echo ""
fi
rm tmp.headers.*

load_main_data() {
	# Read the source.list and process it
	RES="`cat $1 | tr '\r' '\n' | awk '
		/^(	*)#end/  { if (deep == skip) { skip -= 1; } deep -= 1; next; }
		/^(	*)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; }
		/^(	*)#if/   {
			gsub("	", "", $0);
			gsub("^#if", "", $0);
			gsub("^ ", "", $0);

			if (deep != skip) { deep += 1; next; }

			deep += 1;

			if ($0 == "ALLEGRO"     && "'$allegro_config'" == "")      { next; }
			if ($0 == "SDL"         && "'$sdl_config'" == "")          { next; }
			if ($0 == "PNG"         && "'$png_config'" == "")          { next; }
			if ($0 == "OSX"         && "'$os'" != "OSX")               { next; }
			if ($0 == "OS2"         && "'$os'" != "OS2")               { next; }
			if ($0 == "PSP"         && "'$os'" != "PSP")               { next; }
			if ($0 == "DOS"         && "'$os'" != "DOS")               { next; }
			if ($0 == "DEDICATED"   && "'$enable_dedicated'" != "1")   { next; }
			if ($0 == "COCOA"       && "'$with_cocoa'" == "0")         { next; }
			if ($0 == "BEOS"        && "'$os'" != "BEOS")              { next; }
			if ($0 == "WIN32"       && "'$os'" != "MINGW" &&
											"'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; }
			if ($0 == "WINCE"       && "'$os'" != "WINCE")             { next; }
			if ($0 == "MSVC"        && "'$os'" != "MSVC")              { next; }
			if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; }
			if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" )        { next; }
			if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0")       { next; }

			skip += 1;

			next;
		}
		/^(	*)#/ {
			if (deep == skip) {
				gsub("	", "", $0);
				gsub("^#", "", $0);
				gsub("^ ", "", $0);

				if (first_time != 0) {
					print "		</Filter>";
				} else {
					first_time = 1;
				}

				print "		<Filter";
				print "			Name=\\""$0"\\"";
				print "			>";
			}

			next;
		}
		/^$/ { next }
		{
			if (deep == skip) {
				gsub("	", "", $0);
				gsub("/", "\\\\", $0);
				print "			<File";
				print "				RelativePath=\\".\\\\'$file_prefix'"$0"\\"";
				print "				>";
				print "			</File>";
			}
		}
		END { print "		</Filter>"; }
	'`"

	eval "$2=\"\$RES\""
}

load_lang_data() {
	RES=""
	for i in `ls $1`
	do
		i=`basename $i | sed s~.txt$~~g`
		RES="$RES
		<File
			RelativePath=\"..\\src\\lang\\"$i".txt\"
			>
			<FileConfiguration
				Name=\"Debug|Win32\"
				>
				<Tool
					Name=\"VCCustomBuildTool\"
					Description=\"Generating "$i" language file\"
					CommandLine=\"..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang &quot;\$(InputPath)&quot;&#x0D;&#x0A;\"
					AdditionalDependencies=\"..\\src\\lang\\english.txt\"
					Outputs=\"..\\bin\\lang\\"$i".lng\"
				/>
			</FileConfiguration>
		</File>"
	done

	eval "$2=\"\$RES\""
}

generate() {
	echo "Generating $2..."
	# Everything above the !!FILES!! marker
	cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
		/^$/ { next }
		/!!FILES!!/ { stop = 1; }
		{
			if (stop == 0) { print $0 }
		}
	' > "$ROOT_DIR/projects/$2"

	echo "$1" >> "$ROOT_DIR/projects/$2"

	# Everything below the !!FILES!! marker
	cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk '
		BEGIN { stop = 1; }
		/^$/ { next }
		/!!FILES!!/ { stop = 2; }
		{
			if (stop == 0) { print $0 }
			if (stop == 2) { stop = 0 }
		}
	' >> "$ROOT_DIR/projects/$2"
}

safety_check "$ROOT_DIR/source.list"

load_main_data "$ROOT_DIR/source.list" openttd
load_lang_data "$ROOT_DIR/src/lang/*.txt" lang

generate "$openttd" "openttd_vs80.vcproj"
generate "$openttd" "openttd_vs90.vcproj"
generate "$lang" "langs_vs80.vcproj"
generate "$lang" "langs_vs90.vcproj"