Fixes for Project Manager on Linux

- Fix error with EngineFinder using the wrong path to locate project.json
- Simplified and expanded clang detection
- Remove forcing clang-12 for builds and will rely on the new cmake detection of clang by default

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
monroegm-disable-blank-issue-2
Steve Pham 4 years ago
parent 4e1825a3fe
commit 289d783f25

@ -23,25 +23,11 @@ namespace O3DE::ProjectManager
QString cmakeGenerator = (whichNinjaResult.IsSuccess()) ? "Ninja Multi-Config" : "Unix Makefiles";
bool compileProfileOnBuild = (whichNinjaResult.IsSuccess());
// On Linux the default compiler is gcc. For O3DE, it is clang, so we need to specify the version of clang that is detected
// in order to get the compiler option.
auto compilerOptionResult = ProjectUtils::FindSupportedCompilerForPlatform();
if (!compilerOptionResult.IsSuccess())
{
return AZ::Failure(compilerOptionResult.GetError());
}
auto clangCompilers = compilerOptionResult.GetValue().split('|');
AZ_Assert(clangCompilers.length()==2, "Invalid clang compiler pair specification");
QString clangCompilerOption = clangCompilers[0];
QString clangPPCompilerOption = clangCompilers[1];
QString targetBuildPath = QDir(m_projectInfo.m_path).filePath(ProjectBuildPathPostfix);
QStringList generateProjectArgs = QStringList{ProjectCMakeCommand,
"-B", ProjectBuildPathPostfix,
"-S", ".",
QString("-G%1").arg(cmakeGenerator),
QString("-DCMAKE_C_COMPILER=").append(clangCompilerOption),
QString("-DCMAKE_CXX_COMPILER=").append(clangPPCompilerOption),
QString("-DLY_3RDPARTY_PATH=").append(thirdPartyPath)};
if (!compileProfileOnBuild)
{

@ -17,13 +17,11 @@ namespace O3DE::ProjectManager
namespace ProjectUtils
{
// The list of clang C/C++ compiler command lines to validate on the host Linux system
const QStringList SupportedClangCommands = {"clang-12|clang++-12"};
const QStringList SupportedClangVersions = {"13", "12", "11", "10", "9", "8", "7", "6.0"};
AZ::Outcome<QProcessEnvironment, QString> GetCommandLineProcessEnvironment()
{
QProcessEnvironment currentEnvironment(QProcessEnvironment::systemEnvironment());
currentEnvironment.insert("CC", "clang-12");
currentEnvironment.insert("CXX", "clang++-12");
return AZ::Success(currentEnvironment);
}
@ -39,16 +37,13 @@ namespace O3DE::ProjectManager
}
// Look for the first compatible version of clang. The list below will contain the known clang compilers that have been tested for O3DE.
for (const QString& supportClangCommand : SupportedClangCommands)
for (const QString& supportClangVersion : SupportedClangVersions)
{
auto clangCompilers = supportClangCommand.split('|');
AZ_Assert(clangCompilers.length()==2, "Invalid clang compiler pair specification");
auto whichClangResult = ProjectUtils::ExecuteCommandResult("which", QStringList{clangCompilers[0]}, QProcessEnvironment::systemEnvironment());
auto whichClangPPResult = ProjectUtils::ExecuteCommandResult("which", QStringList{clangCompilers[1]}, QProcessEnvironment::systemEnvironment());
auto whichClangResult = ProjectUtils::ExecuteCommandResult("which", QStringList{QString("clang-%1").arg(supportClangVersion)}, QProcessEnvironment::systemEnvironment());
auto whichClangPPResult = ProjectUtils::ExecuteCommandResult("which", QStringList{QString("clang++-%1").arg(supportClangVersion)}, QProcessEnvironment::systemEnvironment());
if (whichClangResult.IsSuccess() && whichClangPPResult.IsSuccess())
{
return AZ::Success(supportClangCommand);
return AZ::Success(QString("clang-%1").arg(supportClangVersion));
}
}
return AZ::Failure(QObject::tr("Clang not found. <br><br>"

@ -13,8 +13,8 @@
include_guard()
# Read the engine name from the project_json file
file(READ ${CMAKE_CURRENT_LIST_DIR}/project.json project_json)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/project.json)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/project.json project_json)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/project.json)
string(JSON LY_ENGINE_NAME_TO_USE ERROR_VARIABLE json_error GET ${project_json} engine)
if(json_error)

@ -13,8 +13,8 @@
include_guard()
# Read the engine name from the project_json file
file(READ ${CMAKE_CURRENT_LIST_DIR}/project.json project_json)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/project.json)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/project.json project_json)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/project.json)
string(JSON LY_ENGINE_NAME_TO_USE ERROR_VARIABLE json_error GET ${project_json} engine)
if(json_error)

Loading…
Cancel
Save