예제 #1
0
        private void configureQT4()
        {
            eCompiler compiler = compilerType;

            Process          p    = new Process();
            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

            info.RedirectStandardInput  = true;
            info.UseShellExecute        = false;
            info.RedirectStandardOutput = true;
            info.RedirectStandardError  = true;
            info.CreateNoWindow         = true;

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

            string extractFolderName = QtInfo.GetQtInfo(qtVersion).ExtractFolderName;

            using (StreamWriter sw = p.StandardInput)
            {
                if (sw.BaseStream.CanWrite)
                {
                    sw.WriteLine("cd /D " + destinationFolder + extractFolderName);

                    if (compiler == eCompiler.VS2010 || qtVersion == eQtVersion.Qt4_8_3)// Qt 4.8.3 does not know platform msvc2012
                    {
                        sw.WriteLine("configure -mp -opensource -nomake demos -nomake examples -platform win32-msvc2010" + qtCommandLineArguments + withLibraries);
                    }
                    else
                    {
                        sw.WriteLine("configure -mp -opensource -nomake demos -nomake examples -platform win32-msvc2012" + qtCommandLineArguments + withLibraries);
                    }

                    sw.WriteLine("y");
                }
            }

            readStandardOutput(p);
            readStandardError(p);

            p.WaitForExit();
            p.Close();
        }
예제 #2
0
        private void buildQT()
        {
            using (Process process = new Process())
            {
                process.StartInfo = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.RedirectStandardInput  = true;

                StringBuilder output = new StringBuilder();
                StringBuilder error  = new StringBuilder();

                using (AutoResetEvent outputWaitHandle = new AutoResetEvent(false))
                    using (AutoResetEvent errorWaitHandle = new AutoResetEvent(false))
                    {
                        process.OutputDataReceived += (sender, e) =>
                        {
                            if (e.Data == null)
                            {
                                outputWaitHandle.Set();
                            }
                            else
                            {
                                output.AppendLine(e.Data);
                                writeStandardOutputMessage(e.Data);
                            }
                        };

                        process.ErrorDataReceived += (sender, e) =>
                        {
                            if (e.Data == null)
                            {
                                errorWaitHandle.Set();
                            }
                            else
                            {
                                error.AppendLine(e.Data);
                                writeStandardErrorMessage(e.Data);
                            }
                        };

                        process.Start();

                        process.BeginOutputReadLine();
                        process.BeginErrorReadLine();

                        using (StreamWriter sw = process.StandardInput)
                        {
                            if (sw.BaseStream.CanWrite)
                            {
                                string extractFolderName = QtInfo.GetQtInfo(qtVersion).ExtractFolderName;

                                sw.WriteLine("cd /D " + destinationFolder + extractFolderName);
                                sw.WriteLine(@"nmake");

                                //sw.WriteLine("y");
                            }
                        }

                        int timeoutInOneDay = 1000 * 60 * 60 * 24; // 1 day
                        if (process.WaitForExit(timeoutInOneDay) &&
                            outputWaitHandle.WaitOne(timeoutInOneDay) &&
                            errorWaitHandle.WaitOne(timeoutInOneDay))
                        {
                            // Process completed. Check process.ExitCode here.
                            //process.ExitCode
                        }
                        else
                        {
                            // Timed out.
                            throw new Exception("Build Qt5: TimeOut");
                        }
                    }
            }
        }
예제 #3
0
        private void configureQT5()
        {
            using (Process process = new Process())
            {
                process.StartInfo = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.RedirectStandardInput  = true;

                StringBuilder output = new StringBuilder();
                StringBuilder error  = new StringBuilder();

                using (AutoResetEvent outputWaitHandle = new AutoResetEvent(false))
                    using (AutoResetEvent errorWaitHandle = new AutoResetEvent(false))
                    {
                        process.OutputDataReceived += (sender, e) =>
                        {
                            if (e.Data == null)
                            {
                                outputWaitHandle.Set();
                            }
                            else
                            {
                                output.AppendLine(e.Data);
                                writeStandardOutputMessage(e.Data);
                            }
                        };

                        process.ErrorDataReceived += (sender, e) =>
                        {
                            if (e.Data == null)
                            {
                                errorWaitHandle.Set();
                            }
                            else
                            {
                                error.AppendLine(e.Data);
                                writeStandardErrorMessage(e.Data);
                            }
                        };

                        process.Start();

                        process.BeginOutputReadLine();
                        process.BeginErrorReadLine();

                        using (StreamWriter sw = process.StandardInput)
                        {
                            if (sw.BaseStream.CanWrite)
                            {
                                string extractFolderName = QtInfo.GetQtInfo(qtVersion).ExtractFolderName;

                                sw.WriteLine("cd /D " + destinationFolder + extractFolderName);
                                if (compilerType == eCompiler.VS2010)
                                {
                                    sw.WriteLine("configure -developer-build -opensource -nomake examples -nomake tests" + qtCommandLineArguments + withLibraries);
                                }
                                else
                                {
                                    sw.WriteLine("configure -developer-build -opensource -nomake examples -nomake tests" + qtCommandLineArguments + withLibraries);
                                }

                                sw.WriteLine("y");
                            }
                        }

                        int timeoutIn30Seconds = 1000 * 60 * 30; // 30 minutes
                        if (process.WaitForExit(timeoutIn30Seconds) &&
                            outputWaitHandle.WaitOne(timeoutIn30Seconds) &&
                            errorWaitHandle.WaitOne(timeoutIn30Seconds))
                        {
                            // Process completed. Check process.ExitCode here.
                            //process.ExitCode
                        }
                        else
                        {
                            // Timed out.
                            throw new Exception("Configure Qt5: TimeOut");
                        }
                    }
            }
        }