Commits

Julian Amann  committed 2b66f13

Refactored boost compiling.

  • Participants
  • Parent commits bb075a4

Comments (0)

Files changed (3)

File BlueGo.suo

Binary file modified.

File BlueGo/Boost.cs

 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Windows.Forms;
+using System.Diagnostics;
 
 namespace BlueGo
 {
         }
     }    
 
+    class boostBuildProcessDescripton
+    {
+        public string destinationFolder;// Where to download and build boost?
+        public eCompiler compilerType;
+        public eBoostVersion boostVersion;
+        public int coreCount;
+    }
+
+
+    public delegate void MessageEventHandler(object sender, string message);
+    public delegate void StandardOutputMessageEventHandler(object sender, string message);
+    public delegate void StandardErrorMessageEventHandler(object sender, string message);
+    public delegate void FinishedEventHandler(object sender);
+
     class BoostBuildProcess
     {
+        public BoostBuildProcess(boostBuildProcessDescripton bbpd)
+        {
+            destinationFolder = bbpd.destinationFolder;
+            compilerType = bbpd.compilerType;
+            boostVersion = bbpd.boostVersion;
+            coreCount = bbpd.coreCount;
+        }
 
+        public void DownloadAndBuildBoost_x64()
+        {
+            try
+            {
+                if (!Directory.Exists(destinationFolder))
+                {
+                    Directory.CreateDirectory(destinationFolder);
+                }
+
+                message("Downloading boost...");
+
+                string boostDownloadURL = BoostInfo.GetBoostDownloadURL(boostVersion);
+                string boostZIPFilename = BoostInfo.GetBoostZipFileName(boostVersion);
+
+                DownloadHelper.DownloadFileFromURL(boostDownloadURL, destinationFolder + boostZIPFilename);
+
+                message("Start to unzip boost...");
+
+                if (boostVersion == eBoostVersion.Boost1_51_0)
+                {
+                    FileInfo fi = new FileInfo(destinationFolder + boostZIPFilename);
+                    long fileLength = fi.Length;
+
+                    if (fileLength != 91365553)
+                    {
+                        MessageBox.Show("Invalid file size of " + boostZIPFilename + " Size in bytes should be 91365553");
+                        //throw new Exception("Invalid file size of " + boostZIPFilename + " Size in bytes should be 91365553");
+                    }
+                }
+
+                // Unzip Boost 
+                SevenZip.Decompress(destinationFolder + "/" + boostZIPFilename, destinationFolder);
+
+                message("boost has been unzipped!");
+
+
+                message("start building boost...");
+
+                // Build boost
+                if (boostVersion == eBoostVersion.Boost1_51_0)
+                {
+                    buildBoost_1_51_0_x64(destinationFolder);
+                }
+                else
+                {
+                    bootstrapBoost_1_52_0_x64(destinationFolder);
+                    buildBoost_1_52_0_x64(destinationFolder);
+                }
+
+                message("boost successfully built!");
+
+                Finished(this);
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.ToString());
+            }
+        }
+
+        public event MessageEventHandler Message;
+        public event StandardOutputMessageEventHandler StandardOutputMessage;
+        public event StandardErrorMessageEventHandler StandardErrorMessage;
+        public event FinishedEventHandler Finished;
+
+        void message(string msg)
+        {
+            Message(this, msg);
+        }
+
+        private void readStandardOutput(Process p)
+        {
+            using (StreamReader sr = p.StandardOutput)
+            {
+                while (sr.BaseStream.CanRead)
+                {
+                    string test = sr.ReadLine();
+
+                    if (test == null)
+                        break;
+
+                    StandardOutputMessage(this, test);
+                }
+            }
+        }
+
+        private void readStandardError(Process p)
+        {
+            using (StreamReader sr = p.StandardError)
+            {
+                while (sr.BaseStream.CanRead)
+                {
+                    string test = sr.ReadLine();
+
+                    if (test == null)
+                        break;
+
+                    StandardErrorMessage(this, test);
+                }
+            }
+        }
+
+        private void buildBoost_1_51_0_x64(string destinationFolder)
+        {
+            Process p = new Process();
+            ProcessStartInfo info = null;
+
+            if (compilerType == eCompiler.VS2012)
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" amd64");
+            if (compilerType == eCompiler.VS2010)
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64");
+
+            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)
+                {
+                    if (compilerType == eCompiler.VS2010)
+                    {
+                        eBoostVersion version = boostVersion;
+                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
+
+
+                        sw.WriteLine("cd " + destinationFolder + extractFolderName); //"boost_1_51_0-x64");
+                        sw.WriteLine("bootstrap");
+                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-10.0 address-model=64 --build-type=complete stage");
+                    }
+                    else
+                    {
+                        eBoostVersion version = boostVersion;
+                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
+
+                        // go to boost root directory
+                        sw.WriteLine("cd " + destinationFolder + extractFolderName);
+
+                        // should work like this 
+
+                        //sw.WriteLine("bootstrap.bat");
+                        //sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); // todo find out number of cores...
+
+                        // workaround
+
+                        // change directory to boost_1_51_0-x64\tools\build\v2
+                        string path = System.Windows.Forms.Application.StartupPath;
+                        File.Copy(path + "\\b2.exe", destinationFolder + extractFolderName + "\\b2.exe");
+                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); // todo find out number of cores...
+                    }
+                }
+            }
+
+            readStandardOutput(p);
+            readStandardError(p);
+
+            p.WaitForExit();
+            p.Close();
+        }
+
+        private void bootstrapBoost_1_52_0_x64(string destinationFolder)
+        {
+            Process p = new Process();
+
+ 
+            ProcessStartInfo info = null;
+
+            if (compilerType == eCompiler.VS2012)
+            {
+                info = new ProcessStartInfo("cmd.exe");
+            }
+            else
+            {
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
+            }
+
+            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;
+
+                    sw.WriteLine("cd " + destinationFolder + extractFolderName + @"\tools\build\v2"); //"boost_1_51_0-x64");
+                    sw.WriteLine("bootstrap");
+                }
+            }
+
+            readStandardOutput(p);
+            readStandardError(p);
+
+            p.WaitForExit();
+            p.Close();
+        }
+
+        private void buildBoost_1_52_0_x64(string destinationFolder)
+        {
+            Process p = new Process();
+
+            ProcessStartInfo info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
+
+
+            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;
+
+                    File.Copy(destinationFolder + extractFolderName + @"\tools\build\v2" + "\\b2.exe", destinationFolder + extractFolderName + "\\b2.exe");
+                    sw.WriteLine("cd " + destinationFolder + extractFolderName);
+
+                    if (compilerType == eCompiler.VS2012)
+                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage");
+                    else
+                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-10.0 address-model=64 --build-type=complete stage");
+                }
+            }
+
+            readStandardOutput(p);
+            readStandardError(p);
+
+            p.WaitForExit();
+            p.Close();
+        }
+
+        private void buildBoost_x642(string destinationFolder)
+        {
+            Process p = new Process();
+            ProcessStartInfo info = null;
+
+            if (compilerType == eCompiler.VS2012)
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64");
+            if (compilerType == eCompiler.VS2010)
+                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" amd64");
+
+            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)
+                {
+                    if (compilerType == eCompiler.VS2010)
+                    {
+                        eBoostVersion version = boostVersion;
+                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
+
+
+                        sw.WriteLine("cd " + destinationFolder + extractFolderName); //"boost_1_51_0-x64");
+                        sw.WriteLine("bootstrap");
+                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-10.0 address-model=64 --build-type=complete stage");
+                    }
+                    else
+                    {
+
+                        eBoostVersion version = boostVersion;
+                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
+
+
+                        sw.WriteLine("cd " + destinationFolder + extractFolderName);
+                        sw.WriteLine("bootstrap");
+                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage");
+                    }
+                }
+            }
+
+            readStandardOutput(p);
+            readStandardError(p);
+
+            p.WaitForExit();
+            p.Close();
+        }
+
+        private void buildBoost1_49_0_gcc(string destinationFolder)
+        {
+            Process p = new Process();
+            ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
+            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)
+                {
+                    sw.WriteLine("cd " + destinationFolder + "boost_1_49_0-x86");
+                    sw.WriteLine("bootstrap.bat gcc");
+                    sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=gcc address-model=32 --build-type=complete stage"); // todo find out number of cores...
+                }
+            }
+
+            readStandardOutput(p);
+            readStandardError(p);
+
+            p.WaitForExit();
+            p.Close();
+        }
+
+        string destinationFolder;// Where to download and build boost?
+        eCompiler compilerType;
+        eBoostVersion boostVersion;
+        int coreCount;
     }
-}
+}

File BlueGo/FormMain.cs

             return destinationFolder;
         }
 
-        void DownloadAndBuildBoost_x64()
-        {
-            try
-            {
-                // Where to download and build boost?
-                string destinationFolder = DetermineDestinationFolder();
-
-                if (!Directory.Exists(destinationFolder))
-                {
-                    Directory.CreateDirectory(destinationFolder);
-                }
-
-                message("Downloading boost...");
-
-                eBoostVersion boostVersion = DetermineSelectedBoostVersion();
-
-                string boostDownloadURL = BoostInfo.GetBoostDownloadURL(boostVersion);
-                string boostZIPFilename = BoostInfo.GetBoostZipFileName(boostVersion);
-
-                // todo: Remove old build folder
-                //if (boostVersion == eBoostVersion.Boost1_51_0)
-                //{
-                    //string destinationDir = destinationFolder + "boost_1_51_0";
-                    //if(Directory.Exists(destinationDir))
-                    //{
-                    //    Directory.Delete(destinationDir, true);
-                    //}
-                //}
-
-                DownloadHelper.DownloadFileFromURL(boostDownloadURL, destinationFolder + boostZIPFilename);
-
-                message("Start to unzip boost...");
-
-                if(boostVersion == eBoostVersion.Boost1_51_0)
-                {
-                    FileInfo fi = new FileInfo(destinationFolder + boostZIPFilename);
-                    long fileLength = fi.Length;
-
-                    if (fileLength != 91365553)
-                    {
-                        MessageBox.Show("Invalid file size of " + boostZIPFilename + " Size in bytes should be 91365553");
-                        //throw new Exception("Invalid file size of " + boostZIPFilename + " Size in bytes should be 91365553");
-                    }
-                }
-
-                // Unzip Boost 
-                SevenZip.Decompress(destinationFolder + "/" + boostZIPFilename, destinationFolder);
-
-                message("boost has been unzipped!");
-
-
-                message("start building boost...");
-
-                // Build boost
-                if (boostVersion == eBoostVersion.Boost1_51_0)
-                {
-                    buildBoost_1_51_0_x64(destinationFolder);
-                }
-                else
-                {
-                    bootstrapBoost_1_52_0_x64(destinationFolder);
-                    buildBoost_1_52_0_x64(destinationFolder);
-                }
-
-                message("boost successfully built!");
-
-                UnlockBoostBuildButton();
-            }
-            catch(Exception ex)
-            {
-                MessageBox.Show(ex.ToString());
-            }
-        }
-
-
-        private void buildBoost_1_51_0_x64(string destinationFolder)
-        {
-            Process p = new Process();
-            ProcessStartInfo info = null;
-            
-            eCompiler compilerType = DetermineSelectedCompiler();
-            if (compilerType == eCompiler.VS2012)
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" amd64");
-            if (compilerType == eCompiler.VS2010)
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64");
-                       
-            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)
-                {
-                    if(compilerType == eCompiler.VS2010)
-                    {
-                        eBoostVersion version = DetermineSelectedBoostVersion();
-                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-
-                        sw.WriteLine("cd " + destinationFolder + extractFolderName); //"boost_1_51_0-x64");
-                        sw.WriteLine("bootstrap");
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-10.0 address-model=64 --build-type=complete stage");
-                    }
-                    else
-                    {
-                        eBoostVersion version = DetermineSelectedBoostVersion();
-                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-                        // go to boost root directory
-                        sw.WriteLine("cd " + destinationFolder + extractFolderName);
-
-                        // should work like this 
-
-                        //sw.WriteLine("bootstrap.bat");
-                        //sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); // todo find out number of cores...
-
-                        // workaround
-
-                        // change directory to boost_1_51_0-x64\tools\build\v2
-                        string path = System.Windows.Forms.Application.StartupPath;
-                        File.Copy(path + "\\b2.exe", destinationFolder + extractFolderName + "\\b2.exe");
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); // todo find out number of cores...
-                    }
-                }
-            }
-
-            readStandardOutput(p);
-            readStandardError(p);
-
-            p.WaitForExit();
-            p.Close();
-        }
-        
-        private void bootstrapBoost_1_52_0_x64(string destinationFolder)
-        {
-            Process p = new Process();
-
-            eCompiler compilerType = DetermineSelectedCompiler();
-
-
-            ProcessStartInfo info = null;
-
-            if (compilerType == eCompiler.VS2012)
-            {
-                info = new ProcessStartInfo("cmd.exe");
-            }
-            else
-            {
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
-            }
-
-            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 = DetermineSelectedBoostVersion();
-                    string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-                    sw.WriteLine("cd " + destinationFolder + extractFolderName + @"\tools\build\v2"); //"boost_1_51_0-x64");
-                    sw.WriteLine("bootstrap");
-                }
-            }
-
-            readStandardOutput(p);
-            readStandardError(p);
-
-            p.WaitForExit();
-            p.Close();
-        }
-
-        private void buildBoost_1_52_0_x64(string destinationFolder)
-        {
-            Process p = new Process();
-
-            eCompiler compilerType = DetermineSelectedCompiler();
-            ProcessStartInfo info = new ProcessStartInfo("cmd.exe", @"%comspec% /k """ + Compiler.GetCompilerPath(compilerType) + @"\VC\vcvarsall.bat"" amd64");
-
-
-            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 = DetermineSelectedBoostVersion();
-                    string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-                    File.Copy(destinationFolder + extractFolderName + @"\tools\build\v2" + "\\b2.exe", destinationFolder + extractFolderName + "\\b2.exe");
-                    sw.WriteLine("cd " + destinationFolder + extractFolderName);
-
-                    if(compilerType == eCompiler.VS2012)
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage");
-                    else
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-10.0 address-model=64 --build-type=complete stage");
-                }
-            }
-
-            readStandardOutput(p);
-            readStandardError(p);
-
-            p.WaitForExit();
-            p.Close();
-        }
-
-        private void buildBoost_x642(string destinationFolder)
-        { 
-            Process p = new Process();
-            ProcessStartInfo info = null;
-
-            eCompiler compilerType = DetermineSelectedCompiler();
-            if (compilerType == eCompiler.VS2012)
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64");
-            if (compilerType == eCompiler.VS2010)
-                info = new ProcessStartInfo("cmd.exe", @"%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" amd64");
-                       
-            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)
-                {
-                    if(compilerType == eCompiler.VS2010)
-                    {
-                        eBoostVersion version = DetermineSelectedBoostVersion();
-                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-
-                        sw.WriteLine("cd " + destinationFolder + extractFolderName); //"boost_1_51_0-x64");
-                        sw.WriteLine("bootstrap");
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2,coreCount) + " --toolset=msvc-10.0 address-model=64 --build-type=complete stage"); 
-                    }
-                    else
-                    {
-
-                        eBoostVersion version = DetermineSelectedBoostVersion();
-                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-
-                        sw.WriteLine("cd " + destinationFolder + extractFolderName); 
-                        sw.WriteLine("bootstrap");
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); 
-
-                        /*
-                        eBoostVersion version = DetermineSelectedBoostVersion();
-                        string extractFolderName = BoostInfo.GetBoostInfo(version).ExtractFolderName;
-
-                        // go to boost root directory
-                        sw.WriteLine("cd " + destinationFolder + extractFolderName);
-                    
-                        // should work like this 
-
-                        //sw.WriteLine("bootstrap.bat");
-                        //sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); // todo find out number of cores...
-
-                        // workaround
-
-                        // change directory to boost_1_51_0-x64\tools\build\v2
-                        string path = System.Windows.Forms.Application.StartupPath;
-                        File.Copy(path + "\\b2.exe", destinationFolder + extractFolderName + "\\b2.exe");
-                        sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=msvc-11.0 address-model=64 --build-type=complete stage"); // todo find out number of cores...
-                         */
-                    }
-                }
-            }
-
-            readStandardOutput(p);
-            readStandardError(p);
-
-            p.WaitForExit();
-            p.Close();
-        }
-
-        private void buildBoost1_49_0_gcc(string destinationFolder)
-        {
-            Process p = new Process();
-            ProcessStartInfo info = new ProcessStartInfo("cmd.exe");
-            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)
-                {
-                    sw.WriteLine("cd " + destinationFolder + "boost_1_49_0-x86");
-                    sw.WriteLine("bootstrap.bat gcc");
-                    sw.WriteLine(@".\b2 -j" + Math.Max(2, coreCount) + " --toolset=gcc address-model=32 --build-type=complete stage"); // todo find out number of cores...
-                }
-            }
-
-            readStandardOutput(p);
-            readStandardError(p);
-
-            p.WaitForExit();
-            p.Close();
-        }
-
         void message(string msg)
         {
             SetWindowTitleStatusInfo(msg);
                         break;
 
                     this.Invoke((MethodInvoker)delegate
-                    { 
+                    {
                         listBoxLogOutput.Items.Add(test);
                     });
                 }
             // Lock GUI
             buttonBoostBuild.Enabled = false;
 
+            /*
             Thread t = new Thread(new ThreadStart(DownloadAndBuildBoost_x64));
             t.Start();
+            */
+
+            boostBuildProcessDescripton bbpd = new boostBuildProcessDescripton();
+            bbpd.boostVersion = DetermineSelectedBoostVersion();
+            bbpd.compilerType = compiler;
+            bbpd.coreCount = coreCount;
+            bbpd.destinationFolder = DetermineDestinationFolder();
+            BoostBuildProcess boostBuildProcess = new BoostBuildProcess(bbpd);
+
+            boostBuildProcess.Message += new MessageEventHandler(boostBuildProcess_Message);
+            boostBuildProcess.StandardOutputMessage += new StandardOutputMessageEventHandler(boostBuildProcess_StandardOutputMessage);
+            boostBuildProcess.StandardErrorMessage += new StandardErrorMessageEventHandler(boostBuildProcess_StandardErrorMessage);
+            boostBuildProcess.Finished += new FinishedEventHandler(boostBuildProcess_Finished);
+
+            Thread workerThread = new Thread(boostBuildProcess.DownloadAndBuildBoost_x64);
+            workerThread.Start();
+        }
+
+        void boostBuildProcess_StandardErrorMessage(object sender, string message)
+        {
+            this.Invoke((MethodInvoker)delegate
+            {
+                listBoxLogOutput.Items.Add(message);
+                //listBox1.EnsureVisible(listBox1.Items.Count - 1);
+            });
+        }
+
+        void boostBuildProcess_StandardOutputMessage(object sender, string message)
+        {
+            this.Invoke((MethodInvoker)delegate
+            {
+                listBoxLogOutput.Items.Add(message);
+                //listBox1.EnsureVisible(listBox1.Items.Count - 1);
+            });
+        }
+
+        void boostBuildProcess_Finished(object sender)
+        {
+            UnlockBoostBuildButton();
+        }
+
+        void boostBuildProcess_Message(object sender, string message)
+        {
+            this.message(message);
         }
 
         private static void CheckDestinationFolder(string destinationFolder)