Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxCommon.cs
jonathan adamczewski bece46b1b4 Remove (remnants of) GCC support from Linux toolchain, remove references to i686, assume minimal valid clang version of 10.0.0
#jira none
#preflight 61d7669ec65e66487b2e4b51
#rb brandon.schaefer
#rb joe.kirchoff

#ROBOMERGE-AUTHOR: jonathan.adamczewski
#ROBOMERGE-SOURCE: CL 18537239 in //UE5/Release-5.0/... via CL 18537245
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18537257 by jonathan adamczewski in ue5-release-engine-test branch]
2022-01-06 18:06:08 -05:00

63 lines
1.5 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.Win32;
using EpicGames.Core;
namespace UnrealBuildTool
{
class LinuxCommon
{
public static string? Which(string name)
{
Process proc = new Process();
proc.StartInfo.FileName = "/bin/sh";
proc.StartInfo.Arguments = String.Format("-c 'which {0}'", name);
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.Start();
proc.WaitForExit();
string? path = proc.StandardOutput.ReadLine();
Log.TraceVerbose(String.Format("which {0} result: ({1}) {2}", name, proc.ExitCode, path));
if (proc.ExitCode == 0 && String.IsNullOrEmpty(proc.StandardError.ReadToEnd()))
{
return path;
}
return null;
}
public static string? WhichClang()
{
string? InternalSDKPath = UEBuildPlatform.GetSDK(UnrealTargetPlatform.Linux)?.GetInternalSDKPath();
if (!String.IsNullOrEmpty(InternalSDKPath))
{
return Path.Combine(InternalSDKPath, "bin", "clang++");
}
string[] ClangNames = { "clang++", "clang++-7.0", "clang++-6.0" };
string? ClangPath;
foreach (string ClangName in ClangNames)
{
ClangPath = Which(ClangName);
if (!String.IsNullOrEmpty(ClangPath))
{
return ClangPath;
}
}
return null;
}
}
}