You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden #rb none ========================== MAJOR FEATURES + CHANGES ========================== Change 3146735 on 2016/09/30 by Ben.Marsh EC: Add the standard postprocessor onto conform job steps. Change 3147190 on 2016/09/30 by Ben.Marsh UBT: Add a whitelist for circular dependencies between modules, and output a warning if any new circular dependencies are added. Change 3148611 on 2016/10/03 by Matthew.Griffin Added list of Dependant modules to EULA check #jira UE-29432 Change 3149098 on 2016/10/03 by Ben.Marsh PR #2821: Fix to stop BuildGraph-created files from being tracked by Git (*.manifest and 'LocalBuilds/') (Contributed by BrodyHiggerson) Change 3149395 on 2016/10/03 by Ben.Marsh UBT: Don't execute pre- and post-build steps when generating project files. Change 3150398 on 2016/10/04 by Ben.Marsh UBT: Fix support for the OptimizeCode setting on Mac, HTML5, Android, Linux, iOS, and XboxOne, and use it to control optimization level in DebugGame configurations. Also determine whether optimization should be enabled for a module at the UEBuildModule level, rather than deriving it (inconsistently) from the ModuleRules enum in the toolchain. #jira UE-18652 Change 3150569 on 2016/10/04 by Ben.Marsh UBT: Remove the NativeBuildEnvironmentConfiguration and NativeBuildEnvironmentConfiguration.TargetInfo classes; store the platform/configuration/architecture on the CPPEnvironment and LinkEnvironment directly. Change 3150606 on 2016/10/04 by Ben.Marsh UBT: Remove support for C++/CLR modules. There's quite a lot of baggage to support it, and I suspect it's already rotted since we don't use it. Change 3150628 on 2016/10/04 by Ben.Marsh UBT: Remove .NET framework assembly paths for C++ modules. Change 3150640 on 2016/10/04 by Ben.Marsh UBT: Move functionality for finding headers into its own class (CPPHeaders), rather than hijacking CPPEnvironment. Change 3152101 on 2016/10/05 by Ben.Marsh UBT: Always force include PCHs, even if they're the first header in the file. Clang already has to work this way, as do shared pchs on Windows, and it's simpler to use the same system universally. Change 3153231 on 2016/10/06 by Ben.Marsh UBT: Write arguments for the Visual C++ toolchain to the response file on separate lines, for easier debugging. Change 3154868 on 2016/10/07 by Richard.Fawcett Ensure that child instances of UAT invoked by BuildGraph honor p4 and submit properties Change 3155017 on 2016/10/07 by Ben.Marsh Lightmass: Add a prefix to all SSE macros to distinguish from overlapping implementations in Core. Change 3156159 on 2016/10/08 by Ben.Marsh UBT: Rewrite code to generate/consume shared PCHs in a way that is compatible with Clang platforms (and which doesn't require supressing warnings on Windows) * Per-module defines are now set via a generated header rather than the command line (Definitions.<ModuleName>.h). This header is force-included AFTER the shared PCH header. * Shared PCHs are now built using the public compile environment only, eliminating situations where private include paths and definitions from the first module using the shared PCH were being passed to the compiler. * Shared PCHs can now be generated in separate optimized/unoptimized variants if necessary due to per-module optimization settings * Names of shared PCHs now follow the pattern "SharedPCH.<ModuleName>.h" to distinguish from private PCHs * Enabled shared PCHs for Mac, iOS, Linux. Reduces UE4Editor Mac build times by ~25% (~21m vs ~28m). Change 3163040 on 2016/10/14 by Ben.Marsh UBT: Add an option to export a target's properties, modules, and binaries for external analyzers (-jsonexport and -jsonexport=<filename>). Also add an option to specifically supress building a target (-skipbuild). Change 3165028 on 2016/10/17 by Ben.Marsh PR #2799: Set Windows exe properties from ini (Contributed by projectgheist) Change 3165076 on 2016/10/17 by Ben.Marsh Build: Remove run conditions from agent setup steps. Should fix issues where an agent doesn't run because the preconditions for one of its nodes failed, but which doesn't prevent another node from running. (Also: being able to see an expanded list of job steps is a useful feature, and it doesn't take much time to run if it's a no-op). Change 3167773 on 2016/10/19 by Ben.Marsh BuildGraph: More flexible <Copy> task for BuildGraph. Now takes "From" and "To" attributes, which may take individual files as well as wildcards, and permits renaming as part of copies. Separate "Files" attribute is still supported, but is now optional, and is used to filter the list of source files. Examples, taken from Engine/Build/Graph/TagsAndFiles.xml: <!-- Source and destination are treated as directories due to presence of 'Files' attribute --> <Copy Files="..." From="Engine/Build" To="Output0" /> <!-- Single file --> <Copy From="Engine/Build/Build.version" To="Output1/Output.version" /> <!-- Output treated as directory --> <Copy From="Engine/Build/.../*.txt" To="Output2" /> <Copy From="Engine/Build/.../*.txt" To="Output3/" /> <Copy From="Engine/Build/....txt" To="Output4" /> <!-- With rename --> <Copy From="Engine/Build/....txt" To="Output5/....old" /> <!-- Copy only subdirectories of Engine/Build, but maintain directory structure --> <Copy From="Engine/Build/*/....txt" To="Output6/" /> <!-- Match bat*/.../*.txt --> <Copy From="Engine/Build/bat...txt" To="Output7" /> <!-- Copy only PS4 subfolders --> <Copy From="Engine/Build/.../ps4/..." To="Output8" /> Change 3167852 on 2016/10/19 by Ben.Marsh BuildGraph: Add a <Move> task, which can move or rename files using the same syntax as the <Copy> task. Change 3168034 on 2016/10/19 by Ben.Marsh BuildGraph: Add support for multi-line properties, declared inside a <Property> tag. Mutli-line properties can be useful for making lists for filtering. Each non-empty line inside the property tag is stripped of leading and trailing whitespace, and appended to the property value separated by a semicolon. For example, the following two properties have an identical value: <Property Name="Prop1" Value="One;Two;Three;One hundred"/> <Property Name="Prop2"> <!-- Some numbers --> One Two Three <!-- Values are delimited by newlines; spaces within a line are preserved --> One hundred </Property> Change 3169256 on 2016/10/20 by Ben.Marsh UBT: Fix chronic algorithmic complexity of StableTopologicalSort(). Was recursively building lists of dependencies for each module, scanning linearly to find dependencies, and only caching pairs of modules being checked. Now caches a flat set of dependencies for each module. Previously took >10s to run on my machine, now takes < 0.2s. Change 3169271 on 2016/10/20 by Ben.Marsh BuildGraph: Modify implementation of task merging. Instead of combining multiple tasks together, allow any task to supply a proxy executor instance deriving from ITaskExecutor, to which other tasks can be added. Keeps the in-memory representation closer to the script representation, and makes it easier to re-export preprocessed scripts and do in-memory analysis of the graph. Change 3179662 on 2016/10/31 by Matthew.Griffin Fixed last remaining issues with building QAGameEditor as a monolithic executable Added a node for building mono editor in CIS so that we catch any new issues #jira UE-32712 Change 3184857 on 2016/11/03 by Matthew.Griffin Removing CopyVisualizers now that UE4.natvis is included in solution and we're not supporting VS2013 #jira UE-35628 Change 3187232 on 2016/11/04 by Ben.Marsh UGS: Fix editor .target file being deleted when doing a content-only sync, and causing a prompt to rebuild the editor when trying to launch. Change 3188413 on 2016/11/07 by Matthew.Griffin Added Switch to Installed Build so that it matches pattern for other confidential platforms Change 3188426 on 2016/11/07 by Matthew.Griffin Changed BuildPlugin command so that it reads from installed platform data to get list of target platforms Some hard coding remains so as to not change functionality for code users, Mac only built on Mac etc. #jira UE-36205 Change 3189363 on 2016/11/07 by Ben.Marsh Consolidate functionality for determining the path to MSBuild.exe to use for compiling UE4 tools into a single batch file (GetMSBuildToolPath) and fix "Clean" not working on PS4 due to include/library paths being set to something by the Visual Studio environment. Change 3191372 on 2016/11/09 by Ben.Marsh UGS: Ensure project config file remains valid even if sync is aborted due to files needing resolve. Prevents user configuration from not being applied onto build steps. Change 3191381 on 2016/11/09 by Ben.Marsh UGS: Allow Ctrl-A to select all in the log window. #jira UE-38378 Change 3193388 on 2016/11/10 by Ben.Marsh Change installed plugins to be disabled by default, but display a notification in the editor the first time you load a project with a new one. Installed plugins which are new to this project will be adorned with a "NEW!" badge in the plugin browser. Change 3193677 on 2016/11/10 by Ben.Marsh UBT: Remove global static instance of ActionGraph. Instance is now instantiated and passed around to functions that require it. Change 3193942 on 2016/11/10 by Ben.Marsh UBT: Store the include cache as an instanced object on each target, rather than looking up separate caches in a global variable. Change 3198296 on 2016/11/15 by Ben.Marsh UBT: Include .modules files in target receipts and manifests. Change 3200284 on 2016/11/16 by Matthew.Griffin Move Sample game projects into a different solution folder like Templates Change 3205168 on 2016/11/19 by Ben.Marsh Update strings to refer to Visual Studio "15" as Visual Studio 2017. Change 3206333 on 2016/11/21 by Ben.Marsh Merge fix to detection of VS2017 RC from 4.14 release. Change 3206786 on 2016/11/21 by Ben.Marsh BuildGraph: Spawn child processes to embed source server information into PDB files in parallel. Change 3207588 on 2016/11/22 by Ben.Marsh UBT: Reduce the number of resource files needed to compile local builds. ModuleVersionResource.rc.inl is now always only compiled once, and linked into each output binary. The default PCLaunch.rc file is also only compiled once, expect when making formal builds (where -formal is passed on the command line, or a changelist is set in Build.version). This ensures that the OriginalFileName metadata is still set for output binaries in binary releases. [CL 3209331 by Ben Marsh in Main branch]
522 lines
18 KiB
C#
522 lines
18 KiB
C#
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
class LinuxPlatformContext : UEBuildPlatformContext
|
|
{
|
|
/** Architecture as stored in the ini. */
|
|
public enum LinuxArchitecture
|
|
{
|
|
/** x86_64, most commonly used architecture.*/
|
|
X86_64UnknownLinuxGnu,
|
|
|
|
/** A.k.a. AArch32, ARM 32-bit with hardware floats */
|
|
ArmUnknownLinuxGnueabihf,
|
|
|
|
/** AArch64, ARM 64-bit */
|
|
AArch64UnknownLinuxGnueabi
|
|
}
|
|
|
|
/** Currently active architecture */
|
|
private string ActiveArchitecture = LinuxPlatform.DefaultArchitecture;
|
|
|
|
public LinuxPlatformContext(FileReference InProjectFile) : base(UnrealTargetPlatform.Linux, InProjectFile)
|
|
{
|
|
// read settings from the config
|
|
string EngineIniPath = ProjectFile != null ? ProjectFile.Directory.FullName : null;
|
|
if (String.IsNullOrEmpty(EngineIniPath))
|
|
{
|
|
// If the project file hasn't been specified, try to get the path from -remoteini command line param
|
|
EngineIniPath = UnrealBuildTool.GetRemoteIniPath();
|
|
}
|
|
DirectoryReference EngineIniDir = !String.IsNullOrEmpty(EngineIniPath) ? new DirectoryReference(EngineIniPath) : null;
|
|
|
|
ConfigCacheIni Ini = ConfigCacheIni.CreateConfigCacheIni(UnrealTargetPlatform.Linux, "Engine", EngineIniDir);
|
|
|
|
string LinuxArchitectureString;
|
|
if (Ini.GetString("/Script/LinuxTargetPlatform.LinuxTargetSettings", "TargetArchitecture", out LinuxArchitectureString))
|
|
{
|
|
LinuxArchitecture Architecture;
|
|
if (Enum.TryParse(LinuxArchitectureString, out Architecture))
|
|
{
|
|
switch (Architecture)
|
|
{
|
|
default:
|
|
System.Console.WriteLine("Architecture enum value {0} does not map to a valid triplet.", Architecture);
|
|
break;
|
|
|
|
case LinuxArchitecture.X86_64UnknownLinuxGnu:
|
|
ActiveArchitecture = "x86_64-unknown-linux-gnu";
|
|
break;
|
|
|
|
case LinuxArchitecture.ArmUnknownLinuxGnueabihf:
|
|
ActiveArchitecture = "arm-unknown-linux-gnueabihf";
|
|
break;
|
|
|
|
case LinuxArchitecture.AArch64UnknownLinuxGnueabi:
|
|
ActiveArchitecture = "aarch64-unknown-linux-gnueabi";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// The current architecture
|
|
/// </summary>
|
|
public override string GetActiveArchitecture()
|
|
{
|
|
return ActiveArchitecture;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get name for architecture-specific directories (can be shorter than architecture name itself)
|
|
/// </summary>
|
|
public override string GetActiveArchitectureFolderName()
|
|
{
|
|
// shorten the string (heuristically)
|
|
string Arch = GetActiveArchitecture();
|
|
uint Sum = 0;
|
|
int Len = Arch.Length;
|
|
for (int Index = 0; Index < Len; ++Index)
|
|
{
|
|
Sum += (uint)(Arch[Index]);
|
|
Sum <<= 1; // allowed to overflow
|
|
}
|
|
return Sum.ToString("X");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Modify the rules for a newly created module, in a target that's being built for this platform.
|
|
/// This is not required - but allows for hiding details of a particular platform.
|
|
/// </summary>
|
|
/// <param name="ModuleName">The name of the module</param>
|
|
/// <param name="Rules">The module rules</param>
|
|
/// <param name="Target">The target being build</param>
|
|
public override void ModifyModuleRulesForActivePlatform(string ModuleName, ModuleRules Rules, TargetInfo Target)
|
|
{
|
|
bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats;
|
|
|
|
if (!UEBuildConfiguration.bBuildRequiresCookedData)
|
|
{
|
|
if (ModuleName == "TargetPlatform")
|
|
{
|
|
bBuildShaderFormats = true;
|
|
}
|
|
}
|
|
|
|
// allow standalone tools to use target platform modules, without needing Engine
|
|
if (ModuleName == "TargetPlatform")
|
|
{
|
|
if (UEBuildConfiguration.bForceBuildTargetPlatforms)
|
|
{
|
|
Rules.DynamicallyLoadedModuleNames.Add("LinuxTargetPlatform");
|
|
Rules.DynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform");
|
|
Rules.DynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform");
|
|
Rules.DynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform");
|
|
Rules.DynamicallyLoadedModuleNames.Add("AllDesktopTargetPlatform");
|
|
}
|
|
|
|
if (bBuildShaderFormats)
|
|
{
|
|
// Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatD3D");
|
|
Rules.DynamicallyLoadedModuleNames.Add("ShaderFormatOpenGL");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gives the platform a chance to 'override' the configuration settings
|
|
/// that are overridden on calls to RunUBT.
|
|
/// </summary>
|
|
/// <param name="Configuration"> The UnrealTargetConfiguration being built</param>
|
|
public override void ResetBuildConfiguration(UnrealTargetConfiguration Configuration)
|
|
{
|
|
ValidateUEBuildConfiguration();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Validate configuration for this platform
|
|
/// NOTE: This function can/will modify BuildConfiguration!
|
|
/// </summary>
|
|
/// <param name="InPlatform"> The CPPTargetPlatform being built</param>
|
|
/// <param name="InConfiguration"> The CPPTargetConfiguration being built</param>
|
|
/// <param name="bInCreateDebugInfo">true if debug info is getting create, false if not</param>
|
|
public override void ValidateBuildConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo)
|
|
{
|
|
UEBuildConfiguration.bCompileSimplygon = false;
|
|
UEBuildConfiguration.bCompileSimplygonSSF = false;
|
|
// depends on arch, APEX cannot be as of November'16 compiled for AArch32/64
|
|
UEBuildConfiguration.bCompileAPEX = GetActiveArchitecture().StartsWith("x86_64");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Validate the UEBuildConfiguration for this platform
|
|
/// This is called BEFORE calling UEBuildConfiguration to allow setting
|
|
/// various fields used in that function such as CompileLeanAndMean...
|
|
/// </summary>
|
|
public override void ValidateUEBuildConfiguration()
|
|
{
|
|
if (ProjectFileGenerator.bGenerateProjectFiles)
|
|
{
|
|
// When generating project files we need intellisense generator to include info from all modules,
|
|
// including editor-only third party libs
|
|
UEBuildConfiguration.bCompileLeanAndMeanUE = false;
|
|
}
|
|
|
|
// Don't stop compilation at first error...
|
|
BuildConfiguration.bStopXGECompilationAfterErrors = true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Setup the target environment for building
|
|
/// </summary>
|
|
/// <param name="InBuildTarget"> The target being built</param>
|
|
public override void SetUpEnvironment(UEBuildTarget InBuildTarget)
|
|
{
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_LINUX=1");
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("LINUX=1");
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_SUPPORTS_JEMALLOC=1"); // this define does not set jemalloc as default, just indicates its support
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0"); //@todo linux: valid?
|
|
|
|
if (GetActiveArchitecture().StartsWith("arm")) // AArch64 doesn't strictly need that - aligned access improves perf, but this will be likely offset by memcpys we're doing to guarantee it.
|
|
{
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS");
|
|
}
|
|
|
|
// link with Linux libraries.
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("pthread");
|
|
|
|
// Disable Simplygon support if compiling against the NULL RHI.
|
|
if (InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Contains("USE_NULL_RHI=1"))
|
|
{
|
|
UEBuildConfiguration.bCompileSimplygon = false;
|
|
UEBuildConfiguration.bCompileSimplygonSSF = false;
|
|
}
|
|
|
|
// At the moment ICU has not been compiled for AArch64. Also, localization isn't needed on servers by default, and ICU is pretty heavy
|
|
if (GetActiveArchitecture().StartsWith("aarch64") || InBuildTarget.TargetType == TargetRules.TargetType.Server)
|
|
{
|
|
UEBuildConfiguration.bCompileICU = false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether this platform should create debug information or not
|
|
/// </summary>
|
|
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
|
|
/// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
|
|
/// <returns>bool true if debug info should be generated, false if not</returns>
|
|
public override bool ShouldCreateDebugInfo(UnrealTargetConfiguration Configuration)
|
|
{
|
|
switch (Configuration)
|
|
{
|
|
case UnrealTargetConfiguration.Development:
|
|
case UnrealTargetConfiguration.Shipping:
|
|
case UnrealTargetConfiguration.Test:
|
|
case UnrealTargetConfiguration.Debug:
|
|
default:
|
|
return true;
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a toolchain instance for the given platform.
|
|
/// </summary>
|
|
/// <param name="Platform">The platform to create a toolchain for</param>
|
|
/// <returns>New toolchain instance.</returns>
|
|
public override UEToolChain CreateToolChain(CPPTargetPlatform Platform)
|
|
{
|
|
return new LinuxToolChain(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Create a build deployment handler
|
|
/// </summary>
|
|
/// <param name="ProjectFile">The project file of the target being deployed. Used to find any deployment specific settings.</param>
|
|
/// <param name="DeploymentHandler">The output deployment handler</param>
|
|
/// <returns>True if the platform requires a deployment handler, false otherwise</returns>
|
|
public override UEBuildDeploy CreateDeploymentHandler()
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
class LinuxPlatform : UEBuildPlatform
|
|
{
|
|
/// <summary>
|
|
/// Linux architecture (compiler target triplet)
|
|
/// </summary>
|
|
// FIXME: for now switching between architectures is hard-coded
|
|
public const string DefaultArchitecture = "x86_64-unknown-linux-gnu";
|
|
//public const string DefaultArchitecture = "arm-unknown-linux-gnueabihf";
|
|
//public const string DefaultArchitecture = "aarch64-unknown-linux-gnueabi";
|
|
|
|
LinuxPlatformSDK SDK;
|
|
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public LinuxPlatform(LinuxPlatformSDK InSDK) : base(UnrealTargetPlatform.Linux, CPPTargetPlatform.Linux)
|
|
{
|
|
SDK = InSDK;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether the required external SDKs are installed for this platform. Could be either a manual install or an AutoSDK.
|
|
/// </summary>
|
|
public override SDKStatus HasRequiredSDKsInstalled()
|
|
{
|
|
return SDK.HasRequiredSDKsInstalled();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Allows the platform to override whether the architecture name should be appended to the name of binaries.
|
|
/// </summary>
|
|
/// <returns>True if the architecture name should be appended to the binary</returns>
|
|
public override bool RequiresArchitectureSuffix()
|
|
{
|
|
// Linux ignores architecture-specific names, although it might be worth it to prepend architecture
|
|
return false;
|
|
}
|
|
|
|
public override bool CanUseXGE()
|
|
{
|
|
// XGE crashes with very high probability when v8_clang-3.9.0-centos cross-toolchain is used on Windows. Please make sure this is resolved before re-enabling it.
|
|
return BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the extension to use for the given binary type
|
|
/// </summary>
|
|
/// <param name="InBinaryType"> The binary type being built</param>
|
|
/// <returns>string The binary extension (i.e. 'exe' or 'dll')</returns>
|
|
public override string GetBinaryExtension(UEBuildBinaryType InBinaryType)
|
|
{
|
|
switch (InBinaryType)
|
|
{
|
|
case UEBuildBinaryType.DynamicLinkLibrary:
|
|
return ".so";
|
|
case UEBuildBinaryType.Executable:
|
|
return "";
|
|
case UEBuildBinaryType.StaticLibrary:
|
|
return ".a";
|
|
case UEBuildBinaryType.Object:
|
|
return ".o";
|
|
case UEBuildBinaryType.PrecompiledHeader:
|
|
return ".gch";
|
|
}
|
|
return base.GetBinaryExtension(InBinaryType);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the extension to use for debug info for the given binary type
|
|
/// </summary>
|
|
/// <param name="InBinaryType"> The binary type being built</param>
|
|
/// <returns>string The debug info extension (i.e. 'pdb')</returns>
|
|
public override string GetDebugInfoExtension(UEBuildBinaryType InBinaryType)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether PDB files should be used
|
|
/// </summary>
|
|
/// <param name="InPlatform"> The CPPTargetPlatform being built</param>
|
|
/// <param name="InConfiguration"> The CPPTargetConfiguration being built</param>
|
|
/// <param name="bInCreateDebugInfo">true if debug info is getting create, false if not</param>
|
|
/// <returns>bool true if PDB files should be used, false if not</returns>
|
|
public override bool ShouldUsePDBFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, bool bCreateDebugInfo)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Modify the rules for a newly created module, where the target is a different host platform.
|
|
/// This is not required - but allows for hiding details of a particular platform.
|
|
/// </summary>
|
|
/// <param name="ModuleName">The name of the module</param>
|
|
/// <param name="Rules">The module rules</param>
|
|
/// <param name="Target">The target being build</param>
|
|
public override void ModifyModuleRulesForOtherPlatform(string ModuleName, ModuleRules Rules, TargetInfo Target)
|
|
{
|
|
if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
|
|
{
|
|
if (!UEBuildConfiguration.bBuildRequiresCookedData)
|
|
{
|
|
if (ModuleName == "Engine")
|
|
{
|
|
if (UEBuildConfiguration.bBuildDeveloperTools)
|
|
{
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxTargetPlatform");
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform");
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform");
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform");
|
|
}
|
|
}
|
|
}
|
|
|
|
// allow standalone tools to use targetplatform modules, without needing Engine
|
|
if (UEBuildConfiguration.bForceBuildTargetPlatforms && ModuleName == "TargetPlatform")
|
|
{
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxTargetPlatform");
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxNoEditorTargetPlatform");
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxClientTargetPlatform");
|
|
Rules.PlatformSpecificDynamicallyLoadedModuleNames.Add("LinuxServerTargetPlatform");
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a context for the given project on the current platform.
|
|
/// </summary>
|
|
/// <param name="ProjectFile">The project file for the current target</param>
|
|
/// <returns>New platform context object</returns>
|
|
public override UEBuildPlatformContext CreateContext(FileReference ProjectFile)
|
|
{
|
|
return new LinuxPlatformContext(ProjectFile);
|
|
}
|
|
}
|
|
|
|
class LinuxPlatformSDK : UEBuildPlatformSDK
|
|
{
|
|
/// <summary>
|
|
/// This is the SDK version we support
|
|
/// </summary>
|
|
static string ExpectedSDKVersion = "v8_clang-3.9.0-centos7"; // now unified for all the architectures
|
|
|
|
/// <summary>
|
|
/// Platform name (embeds architecture for now)
|
|
/// </summary>
|
|
static private string TargetPlatformName = "Linux_x64";
|
|
|
|
/// <summary>
|
|
/// Whether platform supports switching SDKs during runtime
|
|
/// </summary>
|
|
/// <returns>true if supports</returns>
|
|
protected override bool PlatformSupportsAutoSDKs()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns platform-specific name used in SDK repository
|
|
/// </summary>
|
|
/// <returns>path to SDK Repository</returns>
|
|
public override string GetSDKTargetPlatformName()
|
|
{
|
|
return TargetPlatformName;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns SDK string as required by the platform
|
|
/// </summary>
|
|
/// <returns>Valid SDK string</returns>
|
|
protected override string GetRequiredSDKString()
|
|
{
|
|
return ExpectedSDKVersion;
|
|
}
|
|
|
|
protected override String GetRequiredScriptVersionString()
|
|
{
|
|
return "3.0";
|
|
}
|
|
|
|
protected override bool PreferAutoSDK()
|
|
{
|
|
// having LINUX_ROOT set (for legacy reasons or for convenience of cross-compiling certain third party libs) should not make UBT skip AutoSDKs
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Whether the required external SDKs are installed for this platform
|
|
/// </summary>
|
|
protected override SDKStatus HasRequiredManualSDKInternal()
|
|
{
|
|
if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Linux)
|
|
{
|
|
return SDKStatus.Valid;
|
|
}
|
|
|
|
string MultiArchRoot = Environment.GetEnvironmentVariable("LINUX_MULTIARCH_ROOT");
|
|
string BaseLinuxPath;
|
|
|
|
if (MultiArchRoot != null)
|
|
{
|
|
// FIXME: UBT should loop across all the architectures and compile for all the selected ones.
|
|
BaseLinuxPath = Path.Combine(MultiArchRoot, LinuxPlatform.DefaultArchitecture);
|
|
}
|
|
else
|
|
{
|
|
// support the existing, non-multiarch toolchains for continuity
|
|
BaseLinuxPath = Environment.GetEnvironmentVariable("LINUX_ROOT");
|
|
}
|
|
|
|
// we don't have an LINUX_ROOT specified
|
|
if (String.IsNullOrEmpty(BaseLinuxPath))
|
|
{
|
|
return SDKStatus.Invalid;
|
|
}
|
|
|
|
// paths to our toolchains
|
|
BaseLinuxPath = BaseLinuxPath.Replace("\"", "");
|
|
string ClangPath = Path.Combine(BaseLinuxPath, @"bin\clang++.exe");
|
|
|
|
if (File.Exists(ClangPath))
|
|
{
|
|
return SDKStatus.Valid;
|
|
}
|
|
|
|
return SDKStatus.Invalid;
|
|
}
|
|
}
|
|
|
|
class LinuxPlatformFactory : UEBuildPlatformFactory
|
|
{
|
|
protected override UnrealTargetPlatform TargetPlatform
|
|
{
|
|
get { return UnrealTargetPlatform.Linux; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Register the platform with the UEBuildPlatform class
|
|
/// </summary>
|
|
protected override void RegisterBuildPlatforms()
|
|
{
|
|
LinuxPlatformSDK SDK = new LinuxPlatformSDK();
|
|
SDK.ManageAndValidateSDK();
|
|
|
|
if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (SDK.HasRequiredSDKsInstalled() == SDKStatus.Valid))
|
|
{
|
|
bool bRegisterBuildPlatform = true;
|
|
|
|
string EngineSourcePath = Path.Combine(ProjectFileGenerator.RootRelativePath, "Engine", "Source");
|
|
string LinuxTargetPlatformFile = Path.Combine(EngineSourcePath, "Developer", "Linux", "LinuxTargetPlatform", "LinuxTargetPlatform.Build.cs");
|
|
|
|
if (File.Exists(LinuxTargetPlatformFile) == false)
|
|
{
|
|
bRegisterBuildPlatform = false;
|
|
}
|
|
|
|
if (bRegisterBuildPlatform == true)
|
|
{
|
|
// Register this build platform for Linux
|
|
if (BuildConfiguration.bPrintDebugInfo)
|
|
{
|
|
Console.WriteLine(" Registering for {0}", UnrealTargetPlatform.Linux.ToString());
|
|
}
|
|
UEBuildPlatform.RegisterBuildPlatform(new LinuxPlatform(SDK));
|
|
UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.Linux, UnrealPlatformGroup.Unix);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|