public static void Build() { string projectPath = Path.GetFullPath(Path.Combine(Application.dataPath, "..")); string sourcePath = projectPath; string buildPath = Path.Combine(projectPath, "Library/cmake-build"); var cmakeTool = new CMakeTool(GlobalSettings.ExecutablePath); var cp = cmakeTool.Build(buildFolder: buildPath); EditorUtility.DisplayProgressBar("CMake", "CMake: Building", 1); try { if (cp.Start()) { while (!cp.HasExited) { string s = cp.StandardOutput.ReadToEnd(); if (s.Length > 0) { UnityEngine.Debug.Log(s); } } } else { throw new BuildFailedException("Cannot start CMake"); } } catch (System.Exception e) { EditorUtility.ClearProgressBar(); throw new BuildFailedException(e); } EditorUtility.ClearProgressBar(); if (cp.ExitCode != 0) { throw new BuildFailedException(cp.StandardError.ReadToEnd()); } }
public static void Install() { var cmakeTool = new CMakeTool(GlobalSettings.ExecutablePath); var cp = cmakeTool.Install(buildFolder: BuildPath); EditorUtility.DisplayProgressBar("CMake", "CMake: Installing", 1); try { if (cp.Start()) { while (!cp.HasExited) { string s = cp.StandardOutput.ReadToEnd(); if (s.Length > 0) { UnityEngine.Debug.Log(s); } } } else { throw new BuildFailedException("Cannot start CMake"); } } catch (System.Exception e) { EditorUtility.ClearProgressBar(); throw new BuildFailedException(e); } EditorUtility.ClearProgressBar(); if (cp.ExitCode != 0) { throw new BuildFailedException(cp.StandardError.ReadToEnd()); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
public static void Configure() { var cmakeTool = new CMakeTool(GlobalSettings.ExecutablePath); var cp = cmakeTool.Configure(sourceFolder: ProjectPath, buildFolder: BuildPath, defs: UnityDefs()); EditorUtility.DisplayProgressBar("CMake", "CMake: Configuring ", 1); try { if (cp.Start()) { while (!cp.HasExited) { string s = cp.StandardOutput.ReadToEnd(); if (s.Length > 0) { UnityEngine.Debug.Log(s); } } } else { throw new BuildFailedException("Cannot start CMake"); } } catch (System.Exception e) { EditorUtility.ClearProgressBar(); throw new BuildFailedException(e); } EditorUtility.ClearProgressBar(); if (cp.ExitCode != 0) { throw new BuildFailedException(cp.StandardError.ReadToEnd()); } }