public static void Initialize() { ePlatform run_platform = GetRuntimePlatform(); UnityEngine.Debug.Log("\n============Runtime Config Setting State================"); if (run_platform == _Platform) { UnityEngine.Debug.Log("<color=#00ff00> Platform Matching OK!... Runtime Platform = " + GetRuntimePlatform().ToString() + " / " + "Using Platform = " + _Platform.ToString() + "</Color>"); } else { UnityEngine.Debug.Log("<color=#ff0000> Faild! Platform Matching... Runtime Platform = " + GetRuntimePlatform().ToString() + " / " + "Using Platform = " + _Platform.ToString() + "</Color>"); } Debug.Log("<color=#FFC000>Network Mode : " + _NetworkMode.ToString() + "</Color>"); Debug.Log("<color=#FFC000>Localization : " + _Localization.ToString() + "</Color>"); Debug.Log("<color=#FFC000>Config Load Mode : " + _ConfigLoadMode.ToString() + "</Color>"); Debug.Log("<color=#FFC000>Bundle Load Mode : " + CurrentBundleLoadMode.ToString() + "</Color>"); UnityEngine.Debug.Log("======================================================== \n"); }
private void runCMake(string destinationFolder) { using (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; StringBuilder output = new StringBuilder(); StringBuilder error = new StringBuilder(); using (AutoResetEvent outputWaitHandle = new AutoResetEvent(false)) using (AutoResetEvent errorWaitHandle = new AutoResetEvent(false)) { p.OutputDataReceived += (sender, e) => { if (e.Data == null) { outputWaitHandle.Set(); } else { output.AppendLine(e.Data); writeStandardOutputMessage(e.Data); } }; p.ErrorDataReceived += (sender, e) => { if (e.Data == null) { errorWaitHandle.Set(); } else { error.AppendLine(e.Data); writeStandardErrorMessage(e.Data); } }; p.Start(); p.BeginOutputReadLine(); p.BeginErrorReadLine(); using (StreamWriter sw = p.StandardInput) { if (sw.BaseStream.CanWrite) { if (compilerType == eCompiler.VS2013) { boostFolder = getSupportedBoostFolder(pclSupportedBoostVersion); boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2013.ToString(), platform.ToString(), boostFolder)); eigenFolder = getSupportedEigenFolder(); eigenFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2013.ToString(), platform.ToString(), eigenFolder)); flannFolder = getSupportedFlannFolder(); flannFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2013.ToString(), platform.ToString(), flannFolder)); vtkFolder = getSupportedVTKFolder(); vtkFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2013.ToString(), platform.ToString(), vtkFolder)); 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); } checkForDependencyFolder(); sw.WriteLine("cd /D " + destinationFolder + pclFolderName); sw.WriteLine(getCMakeCommand()); } else if (compilerType == eCompiler.VS2012) { boostFolder = getSupportedBoostFolder(pclSupportedBoostVersion); boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2012.ToString(), platform.ToString(), boostFolder)); eigenFolder = getSupportedEigenFolder(); eigenFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2012.ToString(), platform.ToString(), eigenFolder)); flannFolder = getSupportedFlannFolder(); flannFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2012.ToString(), platform.ToString(), flannFolder)); vtkFolder = getSupportedVTKFolder(); vtkFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2012.ToString(), platform.ToString(), vtkFolder)); 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); } checkForDependencyFolder(); sw.WriteLine("cd /D " + destinationFolder + pclFolderName); sw.WriteLine(getCMakeCommand()); } else if (compilerType == eCompiler.VS2010) { boostFolder = getSupportedBoostFolder(pclSupportedBoostVersion); boostFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2010.ToString(), platform.ToString(), boostFolder)); eigenFolder = getSupportedEigenFolder(); eigenFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2010.ToString(), platform.ToString(), eigenFolder)); flannFolder = getSupportedFlannFolder(); flannFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2010.ToString(), platform.ToString(), flannFolder)); vtkFolder = getSupportedVTKFolder(); vtkFullPath = Path.GetFullPath(Path.Combine(PreferencesManager.Instance.ThirdPartyDownloadFolder, eCompiler.VS2010.ToString(), platform.ToString(), vtkFolder)); 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); } checkForDependencyFolder(); sw.WriteLine("cd /D " + destinationFolder + pclFolderName); sw.WriteLine(cmakeCommand); } } } int timeoutIn30Seconds = 1000 * 60 * 30; // 30 minutes if (p.WaitForExit(timeoutIn30Seconds) && outputWaitHandle.WaitOne(timeoutIn30Seconds) && errorWaitHandle.WaitOne(timeoutIn30Seconds)) { } else { throw new Exception("Configuring PCL timed out!"); } } } }
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(); }