projects/generate
branchnoai
changeset 9628 b5c2449616b5
parent 9621 7654501cf02d
child 9722 ebf0ece7d8f6
equal deleted inserted replaced
9627:6a7c8ead2328 9628:b5c2449616b5
    29 
    29 
    30 
    30 
    31 
    31 
    32 # First, collect the list of Windows files
    32 # First, collect the list of Windows files
    33 sdl_config="1"
    33 sdl_config="1"
       
    34 png_config="1"
    34 os="MSVC"
    35 os="MSVC"
    35 enable_dedicated="0"
    36 enable_dedicated="0"
    36 with_cocoa="0"
    37 with_cocoa="0"
    37 enable_directmusic="1"
    38 enable_directmusic="1"
    38 with_threads="1"
    39 with_threads="1"
    39 file_prefix="..\\\\src\\\\"
    40 file_prefix="..\\\\src\\\\"
       
    41 
       
    42 safety_check() {
       
    43 	li=""
       
    44 	for i in `cat $1 | grep -v "#\|ottdres.rc\|win32.cpp\|win32_v.cpp" | xargs -n 1 basename | sort`; do
       
    45 		if [ "$li" = "$i" ]; then
       
    46 			echo " !! ERROR !!"
       
    47 			echo ""
       
    48 			echo "The filename '$i' is already used in this project."
       
    49 			echo "Because MSVC uses one single directory for all object files, it"
       
    50 			echo "cannot handle filenames with the same name inside the same project."
       
    51 			echo "Please rename either one of the file and try generating again."
       
    52 			echo ""
       
    53 			echo " !! ERROR !!"
       
    54 			exit 1
       
    55 		fi
       
    56 		li="$i"
       
    57 	done
       
    58 }
    40 
    59 
    41 load_main_data() {
    60 load_main_data() {
    42 	# Read the source.list and process it
    61 	# Read the source.list and process it
    43 	RES="`cat $1 | tr '\r' '\n' | awk '
    62 	RES="`cat $1 | tr '\r' '\n' | awk '
    44 		/^(	*)#end/  { if (deep == skip) { skip -= 1; } deep -= 1; next; }
    63 		/^(	*)#end/  { if (deep == skip) { skip -= 1; } deep -= 1; next; }
    51 			if (deep != skip) { deep += 1; next; }
    70 			if (deep != skip) { deep += 1; next; }
    52 
    71 
    53 			deep += 1;
    72 			deep += 1;
    54 
    73 
    55 			if ($0 == "SDL"         && "'$sdl_config'" == "")          { next; }
    74 			if ($0 == "SDL"         && "'$sdl_config'" == "")          { next; }
       
    75 			if ($0 == "PNG"         && "'$png_config'" == "")          { next; }
    56 			if ($0 == "OSX"         && "'$os'" != "OSX")               { next; }
    76 			if ($0 == "OSX"         && "'$os'" != "OSX")               { next; }
    57 			if ($0 == "OS2"         && "'$os'" != "OS2")               { next; }
    77 			if ($0 == "OS2"         && "'$os'" != "OS2")               { next; }
    58 			if ($0 == "PSP"         && "'$os'" != "PSP")               { next; }
    78 			if ($0 == "PSP"         && "'$os'" != "PSP")               { next; }
    59 			if ($0 == "DEDICATED"   && "'$enable_dedicated'" != "1")   { next; }
    79 			if ($0 == "DEDICATED"   && "'$enable_dedicated'" != "1")   { next; }
    60 			if ($0 == "COCOA"       && "'$with_cocoa'" == "0")         { next; }
    80 			if ($0 == "COCOA"       && "'$with_cocoa'" == "0")         { next; }
   167 			if (stop == 2) { stop = 0 }
   187 			if (stop == 2) { stop = 0 }
   168 		}
   188 		}
   169 	' >> "$ROOT_DIR/projects/$2"
   189 	' >> "$ROOT_DIR/projects/$2"
   170 }
   190 }
   171 
   191 
       
   192 safety_check "$ROOT_DIR/source.list"
       
   193 
   172 load_main_data "$ROOT_DIR/source.list" openttd
   194 load_main_data "$ROOT_DIR/source.list" openttd
   173 load_lang_data "$ROOT_DIR/src/lang/*.txt" lang
   195 load_lang_data "$ROOT_DIR/src/lang/*.txt" lang
   174 
   196 
   175 generate "$openttd" "openttd.vcproj"      "msvc2003"
   197 generate "$openttd" "openttd.vcproj"      "msvc2003"
   176 generate "$openttd" "openttd_vs80.vcproj" "msvc2005"
   198 generate "$openttd" "openttd_vs80.vcproj" "msvc2005"