3 using System.Diagnostics;
7 public class Win32Builder : ABuilder
9 public Win32Builder(Config _cfg)
14 public override string GetPawnCompilerName()
19 public override bool BuildLibrary(Package pkg, Library lib)
21 ProcessStartInfo info = new ProcessStartInfo();
23 string path = Config.PathFormat("{0}/{1}/msvc8",
27 /* PlatformExt ignored for us */
28 string binName = lib.binary_name + (lib.is_executable ? ".exe" : ".dll");
30 string config_name = "Unknown";
32 if (lib.release_mode == ReleaseMode.ReleaseMode_Release)
34 config_name = "Release";
36 else if (lib.release_mode == ReleaseMode.ReleaseMode_Debug)
38 config_name = "Debug";
41 if (lib.build_mode == BuildMode.BuildMode_Episode1)
43 config_name = config_name + " - Episode 1";
45 else if (lib.build_mode == BuildMode.BuildMode_Episode2)
47 config_name = config_name + " - Orange Box";
49 else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
51 config_name = config_name + " - Old Metamod";
54 string binpath = Config.PathFormat("{0}/{1}/{2}",
59 if (File.Exists(binpath))
64 string project_file = null;
65 if (lib.vcproj_name != null)
67 project_file = lib.vcproj_name + ".vcproj";
71 project_file = lib.binary_name + ".vcproj";
74 info.WorkingDirectory = path;
75 info.FileName = cfg.builder_path;
76 info.UseShellExecute = false;
77 info.RedirectStandardOutput = true;
78 info.RedirectStandardError = true;
80 if (cfg.build_options != null)
82 info.Arguments = cfg.build_options + " ";
85 info.Arguments += "/rebuild \"" + config_name + "\" " + project_file;
87 Process p = Process.Start(info);
88 Console.WriteLine(p.StandardOutput.ReadToEnd());
92 if (!File.Exists(binpath))
97 path = Config.PathFormat("{0}/{1}/{2}/{3}",
102 File.Copy(binpath, path, true);
104 /* On Windows we optionally log the PDB path */
105 if (!lib.is_executable && cfg.pdb_log_file != null)
107 FileStream fs = File.Open(cfg.pdb_log_file, FileMode.Append, FileAccess.Write);
108 StreamWriter sw = new StreamWriter(fs);
109 sw.WriteLine(binpath.Replace(".dll", ".pdb"));