Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/Linux/UEBuildLinux.cs
Josh Adams b3cf2c5fd5 Copying //UE4/Dev-Platform to Dev-Main (//UE4/Dev-Main) (Source: //UE4/Dev-Platform @ 3061622)
#rb none
#lockdown nick.penwarden

Change 3046743 on 2016/07/12 by Mark.Satterthwaite

	Revert Metal workaround for AtmosphericFog rendering on Intel & AMD from 2897082 and instead change the MetalBackend to emit a precise::sqrt(max(0.0, value)) instruction instead of sqrt(value) to avoid the NaN from -ve values. This may still be technically incorrect versus D3D, but it matches the existing OpenGL appearance.
	#rb ben.woodhouse
	#jira UE-33028

Change 3046820 on 2016/07/12 by Peter.Sauerbrei

	PR#2594 - fix for analog input, courtesy of CleanCut
	#rb daniel.lamb

Change 3046826 on 2016/07/12 by Peter.Sauerbrei

	PR#2561 - addition of code to limit architecture in required caps for IOS, courtesy of derekvanvliet
	#rb daniel.lamb

Change 3046835 on 2016/07/12 by Peter.Sauerbrei

	PR#2559 - Increase the stack size on IOS and Mac, courtesy of derekvanvliet
	PR#2552 -  Addition for Apple ReplayKit Framework, courtesy of JoshuaKaiser
	#rb daniel.lamb

Change 3046838 on 2016/07/12 by Peter.Sauerbrei

	PR#2548 - Adding Log information when an unsupported audio type is used, courtesy of derekvanvliet
	#rb daniel.lamb

Change 3046854 on 2016/07/12 by Peter.Sauerbrei
	PR#2547 - fix for unrecognize selector crash on iOS, couretesy of derekvanvliet
	PR#2384 - prevent crashes when initializing push notifications on IOS 7, courtesy of alk3ovation
	#rb daniel.lamb

Change 3046858 on 2016/07/12 by Peter.Sauerbrei

	PR#2475, #1868 - fix for mapping of iOS device name, courtesy of wingedrobin, derekvanvliet
	PR#2567 - fix name of IPhoneSE in names array, courtesy of rohanliston
	#rb daniel.lamb

Change 3046862 on 2016/07/12 by Peter.Sauerbrei

	fix for type in tooltip
	#jira UE-27123
	#rb daniel.lamb

Change 3046919 on 2016/07/12 by Daniel.Lamb

	Stop texture derived data from loading it's bulk data when the linker is destoryed.
	#rb Peter.Sauerbrei

Change 3046922 on 2016/07/12 by Daniel.Lamb

	Updated the default cooker gc settings so that it can have more resources.
	Added support for cooker markup package and objects as (new flag) disregard for gc if it's still in use by the cooker.
	Changed the way reentry data is stored in the cooker.
	Cook only editor content flag in project settings now works again.
	#rb Josh.Adams
	#test cook Paragon

Change 3046924 on 2016/07/12 by Daniel.Lamb

	Added support for encrypting ini files.
	Added new project setting in the editor and setting in ufe.
	Also added ForDistribution flag to ufe.
	#rb Peter.Sauerbrei

Change 3046936 on 2016/07/12 by Mark.Satterthwaite

	Fix compute shader TLV clear for async. compute on Mac.
	#rb chris.babcock

Change 3047207 on 2016/07/12 by Mark.Satterthwaite

	It is illegal to use a reference to an element within a TMap to initialise a new value that is to be added to the TMap as it causes heap-use-after-free.
	#rb chris.babcock

Change 3047208 on 2016/07/12 by Mark.Satterthwaite

	When removing a vertex don't attempt to copy from one element beyond the end of the array to fill the last element - that's a heap-buffer-overflow and is unnecessary because that element will no longer be used.
	#rb chris.babcock

Change 3047209 on 2016/07/12 by Mark.Satterthwaite

	Don't attempt to update Metal class counts if the MetalRHI is uninitalised - it will attempt to double-free the TMap.
	#rb chris.babcock

Change 3047641 on 2016/07/13 by Lee.Clark

	PS4 - Improve SDK Version checking messages

	#rb none

Change 3047663 on 2016/07/13 by Keith.Judge

	Orion - Various minor PS4-only things activated for XB1.

	#rb none

Change 3047664 on 2016/07/13 by Keith.Judge

	XB1 - Fix analysis warning of shadowing a member variable.

	#rb none

Change 3047784 on 2016/07/13 by Keith.Judge

	Xbox One - Memory and perf saving in query handling. Store 8 queries per allocation, rather than 1 so we're making the maximum use of the 256byte allocation granularity.

	#rb None

Change 3047834 on 2016/07/13 by Keith.Judge

	XB1 - Release underlying memory of 3D textures when destroying them. Oops!

	#rb none

Change 3048190 on 2016/07/13 by Josh.Adams

	- Now leave around the ASTC encoder input file on error, for reproing outside of the engine
	#rb none

Change 3048256 on 2016/07/13 by Daniel.Lamb

	Removed warning about missing file when using cook on the fly.
	#rb Peter.Sauerbrei

Change 3048409 on 2016/07/13 by Daniel.Lamb

	Improved output for saving packages in unattended builds.
	#rb Jonathan.Fitzpatrick

Change 3048763 on 2016/07/13 by Peter.Sauerbrei

	switch AppleTV to tvOS in the editor
	#jira UE-30532
	#rb michael.trepka

Change 3049608 on 2016/07/14 by Keith.Judge

	XB1 - Optimize vertex/index buffer dynamic memory usage.

	#rb none

Change 3049609 on 2016/07/14 by Keith.Judge

	Xbox One CPU Perf - Add _RenderThread versions of Lock/Unlock Texture 2D to stop more RHI thread stalls.

	#rb None

Change 3049610 on 2016/07/14 by Keith.Judge

	Xbox One - Reduce latency of deferred deletions to two frames.

	#rb None

Change 3049730 on 2016/07/14 by Keith.Judge

	Xbox One - Disable _RenderThread versions of Lock/Unlock Texture 2D for now as they're causing hangs.

	#rb None

Change 3049732 on 2016/07/14 by Keith.Judge

	Xbox One - Add critical section to the query slot incrementing code as this wa  causing a hang after running for a while as it can be done on any of the parallel rendering threads (not just the RHI thread.

	Also remove optimization pragmas accidentally left in.

	#rb none

Change 3049791 on 2016/07/14 by Keith.Judge

	Xbox One - Made the occlusion query multithreading even more robust. Can play for ages now in a large level without a crash.

	#rb None

Change 3049968 on 2016/07/14 by Jeremiah.Waldron

	Adding AndroidDisableThreadedRendering CVar and device profiles for 4 specific devices that need to have threaded rendering disabled on them due to swap buffer issues.
	Leaving previous checks in FAndroidMisc::AllowRenderThread as they are, but any new devices that need threaded rendering disabled should use the CVar

	#jira UE-24954, UE-27685, UE-20067
	#rb chris.babcock

Change 3050428 on 2016/07/14 by Jeremiah.Waldron

	Fix for application window being terminated if an AlertDialog is showing onPause
	Repro'd and fix tested on Samsung Galaxy Note 3
	#android
	#jira UE-32998
	#rb chris.babcock

Change 3050642 on 2016/07/14 by Peter.Sauerbrei

	fix for invalid generated plist
	#rb daniel.lamb

Change 3050718 on 2016/07/14 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
	#rb none

Change 3051327 on 2016/07/15 by Keith.Judge

	Xbox One - Save memory when locking 2D textures by only allocating a linear copy of the mip/array slice we're locking, rather than the entire mip chain. I'll do the same for 3D textures next.

	#rb None

Change 3051346 on 2016/07/15 by Keith.Judge

	Xbox One - Same memory savings for UpdateTexture2D/3D. Only allocate for the mip/slice that we're updating, not the entire texture.

	#rb None.

Change 3051530 on 2016/07/15 by Nick.Shin

	github: minor typo fixes

	#jira UE-32129 - GitHub 2513 : Update default output of HTML5 packaging
	#rb none

Change 3053631 on 2016/07/18 by Mark.Satterthwaite

	Don't attempt to bind a 2D texture to the FOnePassPointShadowProjectionShaderParameters  because it just won't work on Metal - instead bind the black-cube. This fixes validation errors that prevent running projects under the debugger.
	#codereview daniel.wright
	#rb josh.adams
	#jira UE-33350

Change 3053816 on 2016/07/18 by Mark.Satterthwaite

	Fixes for iOS Metal:
	- Depth-clip mode was erroneously exported on iOS SDK 9, it wasn't ever actually available.
	- Stencil texture views are only required on Mac.
	- State cache shouldn't suggest a render target change is required if the current state is clear and the new state is load/don't care as this breaks iOS rendering with MSAA.
	- Instead the debug submissions should just directly invoke submit and switch to rendering so that its SetRenderTarget call always succeeds.
	#rb michael.trepka

Change 3053818 on 2016/07/18 by Mark.Satterthwaite

	Explicit casts for Metal precise::sqrt required for iOS to work with ffast-math workaround.
	#rb michael.trepka

Change 3054426 on 2016/07/18 by Dmitry.Rekman

	Fix case-sensitive compilation problems (UE-33420).

	#codereview Olaf.Piesche
	#rb none

Change 3054434 on 2016/07/18 by Mark.Satterthwaite

	Silence delete-non-virtual-dtor  warnings on iOS as we do on Mac.
	#rb none

Change 3054719 on 2016/07/18 by Jeremiah.Waldron

	Adding ShowHiddenAlertDialog JNI function to be called from native code after the render thread is resumed after pausing.
	Tested locally on Galaxy Note 3. Tested on LG G4 by nick.shin. Tested on Galaxy S6 by chris.babcock
	#jira UE-32998
	#android
	#rb chris.babcock

Change 3054742 on 2016/07/18 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
	#rb none

Change 3054850 on 2016/07/18 by Dmitry.Rekman

	Replace Fatal->Error so messagebox can be shown (UE-22818).

	- Incorporates PR #1714 by zaps166.

	#rb none
	#tests Tried to create an invalid context, made sure messagebox is popping up.

Change 3055317 on 2016/07/19 by Lee.Clark

	PS4 - Fix render target memory allocation

	#jira UE-32988
	#rb Marcus.Wassmer

Change 3055682 on 2016/07/19 by Brent.Pease

	 + Fix Debug builds by removing force inline attribute only on debug builds to prevent a warning that is treated as an error

	#rb michael.trepka

Change 3056065 on 2016/07/19 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
	#rb none

Change 3056256 on 2016/07/19 by Chris.Babcock

	Add optional log spew filtering callback to Run
	#jira UE-33468
	#ue4
	#android
	#rb Ben.Marsh
	#codereview Jack.Porter

Change 3056727 on 2016/07/19 by Chris.Babcock

	Added addition scope (plus.login) to Google Play Games builder
	#jira UE-33480
	#ue4
	#android
	#rb none
	#codereview ryan.gerleve

Change 3056811 on 2016/07/19 by Jeff.Campeau

	Xbox One now accepts client configs.
	#rb none

Change 3057152 on 2016/07/20 by Dmitry.Rekman

	Linux: use libc++ instead of libstdc++.

	- Needed to solve problems with third-party C++ libraries (e.g. WebRTC).
	- Bundled libc++ 3.8.1 (TPS cleared).
	- Turned off ICU compilation (needs recompile against libc++).
	- Some libraries (e.g. FBX sdk) still need libstdc++, so in practice it is going to be a mix.

	#rb none
	#tests Built and ran a number of Linux targets.

Change 3057362 on 2016/07/20 by Keith.Judge

	XB1 - Fix busted merge from yesterday

	#rb None

Change 3057647 on 2016/07/20 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
	#rb none

Change 3057655 on 2016/07/20 by Daniel.Lamb

	Added test cooking flag.
	#rb Peter.Sauerbrei
	#test Cook paragon.

Change 3058779 on 2016/07/20 by Dmitry.Rekman

	Fix crash on cooker exit (UE-33583).

	- Global/static tickable objects could outlive the collection and trigger asserts when removing themselves from it.

	#rb Josh.Adams
	#codereview Josh.Adams, Jamie.Dale
	#tests Compiled and ran Linux editor.
	#lockdown Josh.Adams

Change 3058835 on 2016/07/20 by Chris.Babcock

	Enable GooglePlay and GameCenter plugins by default
	#jira UE-33605
	#ue4
	#android
	#ios
	#rb mark.satterthwaite
	#codereview Peter.Sauerbrei
	#lockdown Josh.Adams

Change 3058847 on 2016/07/20 by Chris.Babcock

	Fix Android device rule for AlcatelPixi3
	#jira UE-33606
	#ue4
	#android
	#rb none
	#codereview Jeremiah.Walron
	#lockdown Josh.Adams

Change 3059693 on 2016/07/21 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
	#rb none
	#lockdown nick.penwarden

Change 3060139 on 2016/07/21 by Chris.Babcock

	Fix proguard entry for Android mediaplayer tracks
	#jira UE-33644
	#ue4
	#android
	#rb Josh.Adams
	#lockdown Josh.Adams

Change 3061151 on 2016/07/22 by Niklas.Smedberg

	Fast ASTC texture compression, using ISPC.

	#jira UE-32308
	#rb chris.babcock
	#lockdown josh.adams

Change 3061428 on 2016/07/22 by Peter.Sauerbrei

	Back out changelist 3061151 as it wasn't approved for submission
	#rb none
	#lockdown josh.adams

Change 3061436 on 2016/07/22 by Lee.Clark

	PS4 - Back out render target mem allocation changes and put in a temp hack

	#jira UE-33657
	#codereview Marcus.Wassmer
	#lockdown josh.adams
	#rb none

[CL 3061637 by Josh Adams in Main branch]
2016-07-22 11:36:47 -04:00

464 lines
16 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
{
public LinuxPlatformContext(FileReference InProjectFile) : base(UnrealTargetPlatform.Linux, InProjectFile)
{
}
/// <summary>
/// The current architecture
/// </summary>
public override string GetActiveArchitecture()
{
return LinuxPlatform.DefaultArchitecture;
}
/// <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;
}
/// <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;
}
BuildConfiguration.bUseUnityBuild = true;
// Don't stop compilation at first error...
BuildConfiguration.bStopXGECompilationAfterErrors = true;
BuildConfiguration.bUseSharedPCHs = false;
}
/// <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("WITH_DATABASE_SUPPORT=0"); //@todo linux: valid?
if (GetActiveArchitecture().StartsWith("arm"))
{
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;
}
// Do not compile ICU for any Linux build at the moment until it is rebuilt against libc++
//if (InBuildTarget.TargetType == TargetRules.TargetType.Server)
{
// Localization shouldn't be needed on servers by default, and ICU is pretty heavy
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";
//static private string DefaultArchitecture = "arm-unknown-linux-gnueabihf";
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()
{
// [RCL] 2015-08-04 FIXME: we have seen XGE builds fail on Windows
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 private Dictionary<string, string> ExpectedSDKVersions = new Dictionary<string, string>()
{
{ "x86_64-unknown-linux-gnu", "v7_clang-3.7.0_ld-2.24_glibc-2.12.2" },
{ "arm-unknown-linux-gnueabihf", "arm-unknown-linux-gnueabihf_v5_clang-3.5.0-ld-2.23.1-glibc-2.13" },
};
/// <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()
{
string SDKString;
if (!ExpectedSDKVersions.TryGetValue(LinuxPlatform.DefaultArchitecture, out SDKString))
{
throw new BuildException("LinuxPlatform::GetRequiredSDKString: no toolchain set up for architecture '{0}'", LinuxPlatform.DefaultArchitecture);
}
return SDKString;
}
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 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);
}
}
}
}
}