Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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());
            }
        }