Beispiel #1
0
 public ProcessRunner(string cppProjectPath, string cmakeCachesPath, BuildOutputParser outputParser)
 {
     projectPath          = Directory.GetParent(Application.dataPath).ToString();
     this.cppProjectPath  = Path.Combine(projectPath, cppProjectPath);
     this.cmakeCachesPath = Path.Combine(this.cppProjectPath, cmakeCachesPath);
     _outputParser        = outputParser;
 }
Beispiel #2
0
        public static void BuildProject()
        {
            if (_isAnythingRunning)
            {
                return;
            }
            _isAnythingRunning = true;

            ClearConsoleLogs();

            AssetDatabase.DisallowAutoRefresh();

            Debug.Log("---->>> Starting C++ project build");

            BuildOutputParser parser = new BuildOutputParser();
            ProcessRunner     runner = new ProcessRunner(_cppProjectPath, _cmakeCachesPath, parser);

            if (!Directory.Exists(runner.cmakeCachesPath))
            {
                Directory.CreateDirectory(runner.cmakeCachesPath);
            }

            EditorUtility.DisplayProgressBar(_progressBarTitle, "Starting C++ project build", 0F);

            string[] arguments =
            {
                _buildTypeParameter,
                $"-G \"{_cmakeGenerationString}\"",
                $"\"{runner.cppProjectPath}\"",
                $"-B \"{runner.cmakeCachesPath}\"",
            };

            runner.applicationPath     = _cmakePath;
            runner.arguments           = arguments;
            runner.workingDirectory    = runner.cppProjectPath;
            runner.progressUpdateEvent = UpdateProgressBar;
            runner.exitEvent           = DidFinishGeneratingCppProject;

            runner.RunProcess();
        }
Beispiel #3
0
        private static void DidFinishGeneratingCppProject(object sender, EventArgs e)
        {
            EditorUtility.DisplayProgressBar(_progressBarTitle, "Building C++ project", .5F);

            BuildOutputParser parser = new BuildOutputParser();
            ProcessRunner     runner = new ProcessRunner(_cppProjectPath, _cmakeCachesPath, parser);

            string[] arguments =
            {
                "--build",
                $"\"{runner.cmakeCachesPath}\"",
                _cmakeCompileParameter
            };

            runner.applicationPath     = _cmakePath;
            runner.arguments           = arguments;
            runner.workingDirectory    = runner.cppProjectPath;
            runner.progressUpdateEvent = UpdateProgressBar;
            runner.exitEvent           = DidFinishBuildProcess;

            runner.RunProcess();
        }