コード例 #1
0
ファイル: Boost.cs プロジェクト: Vertexwahn/BlueGo
        private void bootstrapBoost_1_52_0_AndLaterVersion()
        {
            Process p = new Process();

            ProcessStartInfo info = null;

            if (compilerType == eCompiler.VS2015 ||
                compilerType == eCompiler.VS2013)
            {
                if (platform == ePlatform.x64)
                {
                    info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
                }
                else if (platform == ePlatform.x86)
                {
                    info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" x86");
                }
                else
                {
                    throw new Exception("Unknown platform.");
                }
            }
            else if (compilerType == eCompiler.VS2012)
            {
                info = new ProcessStartInfo("cmd.exe");
            }
            else
            {
                throw new Exception("Unknown compiler.");
            }

            info.RedirectStandardInput  = true;
            info.UseShellExecute        = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError  = true;
            info.WindowStyle            = ProcessWindowStyle.Hidden;

            p.StartInfo = info;
            p.Start();

            using (StreamWriter sw = p.StandardInput)
            {
                if (sw.BaseStream.CanWrite)
                {
                    eBoostVersion version           = boostVersion;
                    string        extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
                    if (Directory.Exists(destinationFolder + extractFolderName + @"\tools\build\v2"))
                    {
                        sw.WriteLine("cd /D " + destinationFolder + extractFolderName + @"\tools\build\v2");
                    }
                    else
                    {
                        sw.WriteLine("cd /D " + destinationFolder + extractFolderName);
                    }
                    sw.WriteLine("bootstrap");
                }
            }

            readStandardOutput(p);
            readStandardError(p);

            p.WaitForExit();
            p.Close();
        }