Ejemplo n.º 1
0
        private void runMSBuild(string destinationFolder, string arguments = "")
        {
            Process          p    = new Process();
            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

            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)
            {
                string extractFolderName = LibLASInfo.GetLibLASInfo(libLASVersion, libLASSupportedBoostVersion).ExtractFolderName;

                if (sw.BaseStream.CanWrite)
                {
                    sw.WriteLine("cd /D " + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, "bin")));
                    sw.WriteLine("\"" + Executable.msbuildExePath + "\"" + " libLAS.sln" + arguments);
                }
            }

            readStandardOutput(p);
            readStandardError(p);

            p.WaitForExit();
            p.Close();
        }
Ejemplo n.º 2
0
        private void runCMake(string destinationFolder)
        {
            Process          p    = new Process();
            ProcessStartInfo info = CreateVisualStudioCommandPromptProcessStartInfo(compilerType, platform);

            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)
            {
                string extractFolderName = LibLASInfo.GetLibLASInfo(libLASVersion, libLASSupportedBoostVersion).ExtractFolderName;

                if (this.libLASVersion == eLibLASVersion.LibLAS1_8_0)
                {
                    extractFolderName = extractFolderName.Substring(0, extractFolderName.Length - 4);
                }

                const string BinFolderName = "bin";

                if (sw.BaseStream.CanWrite)
                {
                    string boostFullPath      = string.Empty;
                    string boostFolder        = string.Empty;
                    string cmakeCommand       = string.Empty;
                    string cmakeGeneratorName = string.Empty;

                    if (compilerType == eCompiler.VS2015)
                    {
                        boostFolder   = getSupportedBoostFolder(libLASSupportedBoostVersion);
                        boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2015.ToString(), platform.ToString(), boostFolder));

                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_14_2015), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_14_2015);
                        }

                        if (!Directory.Exists(boostFullPath))
                        {
                            throw new Exception("Supported boost folder:" + boostFolder + " does not exists!\n libLAS requires supported compiled boost version.");
                        }

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

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, BinFolderName)) + "\"" +
                                       " -DBOOST_ROOT=" + "\"" + boostFullPath + "\"";

                        sw.WriteLine(cmakeCommand);
                    }
                    else if (compilerType == eCompiler.VS2013)
                    {
                        boostFolder   = getSupportedBoostFolder(libLASSupportedBoostVersion);
                        boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2013.ToString(), platform.ToString(), boostFolder));

                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_12_2013), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_12_2013);
                        }

                        if (!Directory.Exists(boostFullPath))
                        {
                            throw new Exception("Supported boost folder:" + boostFolder + " does not exists!\n libLAS requires supported compiled boost version.");
                        }

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

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, BinFolderName)) + "\"" +
                                       " -DBOOST_ROOT=" + "\"" + boostFullPath + "\"";

                        sw.WriteLine(cmakeCommand);
                    }
                    else if (compilerType == eCompiler.VS2012)
                    {
                        boostFolder   = getSupportedBoostFolder(libLASSupportedBoostVersion);
                        boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2012.ToString(), platform.ToString(), boostFolder));

                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_11_2012), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_11_2012);
                        }

                        if (!Directory.Exists(boostFullPath))
                        {
                            throw new Exception("Supported boost folder:" + boostFolder + " does not exists!\n libLAS requires supported compiled boost version.");
                        }

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

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, BinFolderName)) + "\"" +
                                       " -DBOOST_ROOT=" + "\"" + boostFullPath + "\"";

                        sw.WriteLine(cmakeCommand);
                    }
                    else if (compilerType == eCompiler.VS2010)
                    {
                        boostFolder   = getSupportedBoostFolder(libLASSupportedBoostVersion);
                        boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2010.ToString(), platform.ToString(), boostFolder));

                        if (platform == ePlatform.x64)
                        {
                            cmakeGeneratorName = string.Concat(Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_10_2010), " ", "Win64");
                        }
                        else if (platform == ePlatform.x86)
                        {
                            cmakeGeneratorName = Helper.GetVisualStudioProductName(eVisualStudioProduct.Visual_Studio_10_2010);
                        }

                        if (!Directory.Exists(boostFullPath))
                        {
                            throw new Exception("Supported boost folder:" + boostFolder + " does not exists!\n libLAS requires supported compiled boost version.");
                        }

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

                        cmakeCommand = "\"" + Path.GetFullPath(Executable.cmakeExePath) + "\"" +
                                       " -G\"" + cmakeGeneratorName + "\"" +
                                       " -H\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName)) + "\"" +
                                       " -B\"" + Path.GetFullPath(Path.Combine(destinationFolder, extractFolderName, BinFolderName)) + "\"" +
                                       " -DBOOST_ROOT=" + "\"" + boostFullPath + "\"";

                        sw.WriteLine(cmakeCommand);
                    }
                }
            }

            readStandardOutput(p);
            readStandardError(p);

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