Open CMake GUI from Project Manager (#4360)

This provides a fast way for engineers who want to configure -> generate -> open project in IDE -> build & run to do so without waiting for a potentially lengthy Project Manager build.

Signed-off-by: AMZN-alexpete <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
Alex Peterson
2021-10-04 13:20:42 -07:00
committed by GitHub
parent c9608846a1
commit 555e95679d
10 changed files with 190 additions and 19 deletions
@@ -92,12 +92,43 @@ namespace O3DE::ProjectManager
}
}
return AZ::Failure(QObject::tr("Visual Studio 2019 version 16.9.2 or higher not found.\n\n"
return AZ::Failure(QObject::tr("Visual Studio 2019 version 16.9.2 or higher not found.<br><br>"
"Visual Studio 2019 is required to build this project."
" Install any edition of <a href='https://visualstudio.microsoft.com/downloads/'>Visual Studio 2019</a>"
" or update to a newer version before proceeding to the next step."
" While installing configure Visual Studio with these <a href='https://o3de.org/docs/welcome-guide/setup/requirements/#visual-studio-configuration'>workloads</a>."));
}
AZ::Outcome<void, QString> OpenCMakeGUI(const QString& projectPath)
{
AZ::Outcome processEnvResult = GetCommandLineProcessEnvironment();
if (!processEnvResult.IsSuccess())
{
return AZ::Failure(processEnvResult.GetError());
}
QString projectBuildPath = QDir(projectPath).filePath(ProjectBuildPathPostfix);
AZ::Outcome projectBuildPathResult = GetProjectBuildPath(projectPath);
if (projectBuildPathResult.IsSuccess())
{
projectBuildPath = projectBuildPathResult.GetValue();
}
QProcess process;
process.setProcessEnvironment(processEnvResult.GetValue());
// if the project build path is relative, it should be relative to the project path
process.setWorkingDirectory(projectPath);
process.setProgram("cmake-gui");
process.setArguments({ "-S", projectPath, "-B", projectBuildPath });
if(!process.startDetached())
{
return AZ::Failure(QObject::tr("Failed to start CMake GUI"));
}
return AZ::Success();
}
} // namespace ProjectUtils
} // namespace O3DE::ProjectManager