2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Xml;
|
2015-01-20 10:05:42 -05:00
|
|
|
using System.Linq;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
namespace UnrealBuildTool
|
|
|
|
|
{
|
|
|
|
|
class AndroidPlatform : UEBuildPlatform
|
|
|
|
|
{
|
|
|
|
|
// The current architecture - affects everything about how UBT operates on Android
|
|
|
|
|
public override string GetActiveArchitecture()
|
|
|
|
|
{
|
2014-08-26 09:56:29 -04:00
|
|
|
// internal architectures are handled inside the toolchain to be able to build all at once, so we no longer need an architecture here
|
|
|
|
|
return base.GetActiveArchitecture();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-11 16:25:06 -04:00
|
|
|
public override bool CanUseXGE()
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-18 14:21:02 -04:00
|
|
|
protected override bool PlatformSupportsAutoSDKs()
|
2014-06-18 10:26:14 -04:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string GetSDKTargetPlatformName()
|
|
|
|
|
{
|
|
|
|
|
return "Android";
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-18 14:21:02 -04:00
|
|
|
protected override string GetRequiredSDKString()
|
2014-06-18 10:26:14 -04:00
|
|
|
{
|
|
|
|
|
return "-19";
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-18 14:21:02 -04:00
|
|
|
protected override String GetRequiredScriptVersionString()
|
2014-06-18 10:26:14 -04:00
|
|
|
{
|
2014-07-25 21:56:32 -04:00
|
|
|
return "3.0";
|
2014-06-18 10:26:14 -04:00
|
|
|
}
|
|
|
|
|
|
2014-07-23 15:41:23 -04:00
|
|
|
// prefer auto sdk on android as correct 'manual' sdk detection isn't great at the moment.
|
|
|
|
|
protected override bool PreferAutoSDK()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-19 11:22:53 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// checks if the sdk is installed or has been synced
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private bool HasAnySDK()
|
|
|
|
|
{
|
|
|
|
|
string NDKPath = Environment.GetEnvironmentVariable("NDKROOT");
|
2015-01-29 20:43:52 -05:00
|
|
|
/* Don't check for existence of env vars, always set them from the .ini values if they exist
|
|
|
|
|
// bool bNeedsNDKPath = string.IsNullOrEmpty(NDKPath);
|
|
|
|
|
// bool bNeedsAndroidHome = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ANDROID_HOME"));
|
|
|
|
|
// bool bNeedsAntHome = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ANT_HOME"));
|
|
|
|
|
// if((bNeedsNDKPath || bNeedsAndroidHome || bNeedsAntHome))
|
|
|
|
|
*/
|
2015-01-20 10:05:42 -05:00
|
|
|
{
|
|
|
|
|
var configCacheIni = new ConfigCacheIni("Engine", null);
|
|
|
|
|
var AndroidEnv = new Dictionary<string, string>();
|
2014-12-11 17:09:39 -05:00
|
|
|
|
2015-01-20 10:05:42 -05:00
|
|
|
Dictionary<string, string> EnvVarNames = new Dictionary<string,string> {
|
|
|
|
|
{"ANDROID_HOME", "SDKPath"},
|
|
|
|
|
{"NDKROOT", "NDKPath"},
|
2015-01-22 11:14:12 -05:00
|
|
|
{"ANT_HOME", "ANTPath"},
|
|
|
|
|
{"JAVA_HOME", "JavaPath"}
|
2015-01-20 10:05:42 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
string path;
|
|
|
|
|
foreach(var kvp in EnvVarNames)
|
|
|
|
|
{
|
2015-01-26 20:18:16 -05:00
|
|
|
if (configCacheIni.GetPath("/Script/AndroidPlatformEditor.AndroidSDKSettings", kvp.Value, out path) && !string.IsNullOrEmpty(path))
|
2015-01-20 10:05:42 -05:00
|
|
|
{
|
2015-01-26 20:18:16 -05:00
|
|
|
// Log.TraceWarning("Adding {0} from ini as {1} to {2}", kvp.Value, path, kvp.Key);
|
2015-01-20 10:05:42 -05:00
|
|
|
AndroidEnv.Add(kvp.Key, path);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var envValue = Environment.GetEnvironmentVariable(kvp.Key);
|
|
|
|
|
if(!String.IsNullOrEmpty(envValue))
|
|
|
|
|
{
|
2015-01-26 20:18:16 -05:00
|
|
|
// Log.TraceWarning("Adding {0} from env as {1}", kvp.Key, envValue);
|
2015-01-20 10:05:42 -05:00
|
|
|
AndroidEnv.Add(kvp.Key, envValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we are on Mono and we are still missing a key then go and find it from the .bash_profile
|
|
|
|
|
if (Utils.IsRunningOnMono && !EnvVarNames.All(s => AndroidEnv.ContainsKey(s.Key)))
|
|
|
|
|
{
|
|
|
|
|
string BashProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), ".bash_profile");
|
|
|
|
|
if (File.Exists(BashProfilePath))
|
|
|
|
|
{
|
|
|
|
|
string[] BashProfileContents = File.ReadAllLines(BashProfilePath);
|
|
|
|
|
foreach (string Line in BashProfileContents)
|
|
|
|
|
{
|
|
|
|
|
foreach (var kvp in EnvVarNames)
|
|
|
|
|
{
|
|
|
|
|
if (AndroidEnv.ContainsKey(kvp.Key))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Line.StartsWith("export " + kvp.Key + "="))
|
|
|
|
|
{
|
|
|
|
|
string PathVar = Line.Split('=')[1].Replace("\"", "");
|
|
|
|
|
AndroidEnv.Add(kvp.Key, PathVar);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set for the process
|
|
|
|
|
foreach (var kvp in AndroidEnv)
|
|
|
|
|
{
|
|
|
|
|
Environment.SetEnvironmentVariable(kvp.Key, kvp.Value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// See if we have an NDK path now...
|
|
|
|
|
AndroidEnv.TryGetValue("NDKROOT", out NDKPath);
|
|
|
|
|
}
|
2014-06-19 11:22:53 -04:00
|
|
|
|
|
|
|
|
// we don't have an NDKROOT specified
|
|
|
|
|
if (String.IsNullOrEmpty(NDKPath))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NDKPath = NDKPath.Replace("\"", "");
|
|
|
|
|
|
- Upgraded to support API 21 (Android 5.0, Lollipop)
- Lots of Android iteration speedups:
- When compiling from UBT (Visual Studio) perform incremental APK generation - it doesn't wipe the Intermadiate/APK directory between runs
- Don't update project settings every run:
- Looks at the project.properties for both game and google play services to make sure they are built with current SDK API version, if not, fixup project.properties, etc
- Even with a non-incremental build (from Editor/UAT), keep the pre-dexed libraries (currently GooglePlayServices [GPS] only) for HUGE speedup
- We can't just pre-dex GPS and check-in, that's not going to be safe with different java/SDK versions.
- Removed the project.properties and proguard-project.txt from p4, as they will be generated if needed. A game can pre-supply those if needed, but we will still check API version and update if required
#codereview chris.babcock,ryan.gerleve,michael.noland
[CL 2341079 by Josh Adams in Main branch]
2014-10-27 13:07:43 -04:00
|
|
|
// need a supported llvm
|
2014-12-11 15:30:24 -05:00
|
|
|
if (!Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.5")) &&
|
|
|
|
|
!Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.3")) &&
|
|
|
|
|
!Directory.Exists(Path.Combine(NDKPath, @"toolchains/llvm-3.1")))
|
2014-06-19 11:22:53 -04:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-07-18 14:21:02 -04:00
|
|
|
protected override SDKStatus HasRequiredManualSDKInternal()
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-07-18 14:21:02 -04:00
|
|
|
// if any autosdk setup has been done then the local process environment is suspect
|
|
|
|
|
if (HasSetupAutoSDK())
|
2014-06-18 10:26:14 -04:00
|
|
|
{
|
2014-07-18 14:21:02 -04:00
|
|
|
return SDKStatus.Invalid;
|
2014-06-18 10:26:14 -04:00
|
|
|
}
|
2014-07-18 14:21:02 -04:00
|
|
|
|
|
|
|
|
if (HasAnySDK())
|
|
|
|
|
{
|
|
|
|
|
return SDKStatus.Valid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SDKStatus.Invalid;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-07-18 14:21:02 -04:00
|
|
|
protected override void RegisterBuildPlatformInternal()
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-01-23 10:53:16 -05:00
|
|
|
if ((ProjectFileGenerator.bGenerateProjectFiles == true) || (HasRequiredSDKsInstalled() == SDKStatus.Valid) || Environment.GetEnvironmentVariable("IsBuildMachine") == "1")
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
bool bRegisterBuildPlatform = true;
|
|
|
|
|
|
|
|
|
|
string EngineSourcePath = Path.Combine(ProjectFileGenerator.EngineRelativePath, "Source");
|
|
|
|
|
string AndroidTargetPlatformFile = Path.Combine(EngineSourcePath, "Developer", "Android", "AndroidTargetPlatform", "AndroidTargetPlatform.Build.cs");
|
|
|
|
|
|
|
|
|
|
if (File.Exists(AndroidTargetPlatformFile) == false)
|
|
|
|
|
{
|
|
|
|
|
bRegisterBuildPlatform = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bRegisterBuildPlatform == true)
|
|
|
|
|
{
|
|
|
|
|
// Register this build platform
|
|
|
|
|
Log.TraceVerbose(" Registering for {0}", UnrealTargetPlatform.Android.ToString());
|
|
|
|
|
UEBuildPlatform.RegisterBuildPlatform(UnrealTargetPlatform.Android, this);
|
|
|
|
|
UEBuildPlatform.RegisterPlatformWithGroup(UnrealTargetPlatform.Android, UnrealPlatformGroup.Android);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override CPPTargetPlatform GetCPPTargetPlatform(UnrealTargetPlatform InUnrealTargetPlatform)
|
|
|
|
|
{
|
|
|
|
|
switch (InUnrealTargetPlatform)
|
|
|
|
|
{
|
|
|
|
|
case UnrealTargetPlatform.Android:
|
|
|
|
|
return CPPTargetPlatform.Android;
|
|
|
|
|
}
|
|
|
|
|
throw new BuildException("AndroidPlatform::GetCPPTargetPlatform: Invalid request for {0}", InUnrealTargetPlatform.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string GetBinaryExtension(UEBuildBinaryType InBinaryType)
|
|
|
|
|
{
|
|
|
|
|
switch (InBinaryType)
|
|
|
|
|
{
|
|
|
|
|
case UEBuildBinaryType.DynamicLinkLibrary:
|
|
|
|
|
return ".so";
|
|
|
|
|
case UEBuildBinaryType.Executable:
|
|
|
|
|
return ".so";
|
|
|
|
|
case UEBuildBinaryType.StaticLibrary:
|
|
|
|
|
return ".a";
|
2014-06-05 12:11:58 -04:00
|
|
|
case UEBuildBinaryType.Object:
|
|
|
|
|
return ".o";
|
|
|
|
|
case UEBuildBinaryType.PrecompiledHeader:
|
|
|
|
|
return ".gch";
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
return base.GetBinaryExtension(InBinaryType);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-26 09:56:29 -04:00
|
|
|
public override bool ShouldUsePCHFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration)
|
|
|
|
|
{
|
2014-09-02 17:48:19 -04:00
|
|
|
return true;
|
2014-08-26 09:56:29 -04:00
|
|
|
}
|
|
|
|
|
|
2014-06-05 12:11:58 -04:00
|
|
|
public override string GetDebugInfoExtension(UEBuildBinaryType InBinaryType)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ResetBuildConfiguration(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
|
|
|
|
|
{
|
|
|
|
|
ValidateUEBuildConfiguration();
|
|
|
|
|
//BuildConfiguration.bDeployAfterCompile = true;
|
2014-08-11 17:27:11 -04:00
|
|
|
|
|
|
|
|
UEBuildConfiguration.bCompileICU = true;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ValidateUEBuildConfiguration()
|
|
|
|
|
{
|
|
|
|
|
BuildConfiguration.bUseUnityBuild = true;
|
|
|
|
|
|
|
|
|
|
UEBuildConfiguration.bCompileLeanAndMeanUE = true;
|
|
|
|
|
UEBuildConfiguration.bCompilePhysX = true;
|
|
|
|
|
UEBuildConfiguration.bCompileAPEX = false;
|
2014-09-09 16:30:29 -04:00
|
|
|
UEBuildConfiguration.bRuntimePhysicsCooking = false;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
UEBuildConfiguration.bBuildEditor = false;
|
|
|
|
|
UEBuildConfiguration.bBuildDeveloperTools = false;
|
|
|
|
|
UEBuildConfiguration.bCompileSimplygon = false;
|
|
|
|
|
|
|
|
|
|
UEBuildConfiguration.bCompileRecast = true;
|
|
|
|
|
|
|
|
|
|
// Don't stop compilation at first error...
|
|
|
|
|
BuildConfiguration.bStopXGECompilationAfterErrors = true;
|
|
|
|
|
|
|
|
|
|
BuildConfiguration.bUseSharedPCHs = false;
|
|
|
|
|
}
|
2015-03-11 18:50:57 -04:00
|
|
|
|
|
|
|
|
public override bool HasDefaultBuildConfig(UnrealTargetPlatform Platform, string ProjectPath)
|
|
|
|
|
{
|
|
|
|
|
string[] BoolKeys = new string[] {
|
|
|
|
|
"bBuildForArmV7", "bBuildForArm64", "bBuildForX86", "bBuildForX8664",
|
|
|
|
|
"bBuildForES2", "bBuildForES31",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// look up iOS specific settings
|
|
|
|
|
if (!DoProjectSettingsMatchDefault(Platform, ProjectPath, "/Script/AndroidRuntimeSettings.AndroidRuntimeSettings",
|
|
|
|
|
BoolKeys, null, null))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// check the base settings
|
|
|
|
|
return base.HasDefaultBuildConfig(Platform, ProjectPath);
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
public override bool ShouldCompileMonolithicBinary(UnrealTargetPlatform InPlatform)
|
|
|
|
|
{
|
|
|
|
|
// This platform currently always compiles monolithic
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ShouldUsePDBFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, bool bCreateDebugInfo)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ShouldNotBuildEditor(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool BuildRequiresCookedData(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool RequiresDeployPrepAfterCompile()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void GetExtraModules(TargetInfo Target, UEBuildTarget BuildTarget, ref List<string> PlatformExtraModules)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ModifyNewlyLoadedModule(UEBuildModule InModule, TargetInfo Target)
|
|
|
|
|
{
|
2015-01-21 09:58:03 -05:00
|
|
|
if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
bool bBuildShaderFormats = UEBuildConfiguration.bForceBuildShaderFormats;
|
|
|
|
|
if (!UEBuildConfiguration.bBuildRequiresCookedData)
|
|
|
|
|
{
|
|
|
|
|
if (InModule.ToString() == "Engine")
|
|
|
|
|
{
|
|
|
|
|
if (UEBuildConfiguration.bBuildDeveloperTools)
|
|
|
|
|
{
|
2014-12-11 13:44:41 -05:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform");
|
2014-03-14 14:13:41 -04:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform");
|
|
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform");
|
|
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform");
|
2014-12-11 13:44:41 -05:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform");
|
|
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform");
|
2015-03-11 17:28:22 -04:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ASTCTargetPlatform");
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (InModule.ToString() == "TargetPlatform")
|
|
|
|
|
{
|
|
|
|
|
bBuildShaderFormats = true;
|
2014-12-11 13:44:41 -05:00
|
|
|
InModule.AddDynamicallyLoadedModule("TextureFormatPVR");
|
2014-03-14 14:13:41 -04:00
|
|
|
InModule.AddDynamicallyLoadedModule("TextureFormatDXT");
|
2014-12-04 10:35:50 -05:00
|
|
|
InModule.AddDynamicallyLoadedModule("TextureFormatASTC");
|
2014-12-11 13:44:41 -05:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("TextureFormatAndroid"); // ATITC, ETC1 and ETC2
|
|
|
|
|
if (UEBuildConfiguration.bBuildDeveloperTools)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
//InModule.AddDynamicallyLoadedModule("AudioFormatADPCM"); //@todo android: android audio
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// allow standalone tools to use targetplatform modules, without needing Engine
|
|
|
|
|
if (UEBuildConfiguration.bForceBuildTargetPlatforms)
|
|
|
|
|
{
|
2014-12-11 13:44:41 -05:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("AndroidTargetPlatform");
|
2014-03-14 14:13:41 -04:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_PVRTCTargetPlatform");
|
|
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ATCTargetPlatform");
|
|
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_DXTTargetPlatform");
|
2014-12-11 13:44:41 -05:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC1TargetPlatform");
|
|
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ETC2TargetPlatform");
|
2015-03-11 17:28:22 -04:00
|
|
|
InModule.AddPlatformSpecificDynamicallyLoadedModule("Android_ASTCTargetPlatform");
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bBuildShaderFormats)
|
|
|
|
|
{
|
|
|
|
|
//InModule.AddDynamicallyLoadedModule("ShaderFormatAndroid"); //@todo android: ShaderFormatAndroid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetUpEnvironment(UEBuildTarget InBuildTarget)
|
|
|
|
|
{
|
|
|
|
|
// we want gcc toolchain 4.8, but fall back to 4.6 for now if it doesn't exist
|
|
|
|
|
string NDKPath = Environment.GetEnvironmentVariable("NDKROOT");
|
|
|
|
|
NDKPath = NDKPath.Replace("\"", "");
|
|
|
|
|
|
|
|
|
|
string GccVersion = "4.8";
|
2014-12-11 15:30:24 -05:00
|
|
|
if (!Directory.Exists(Path.Combine(NDKPath, @"sources/cxx-stl/gnu-libstdc++/4.8")))
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
GccVersion = "4.6";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_DESKTOP=0");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_64BITS=0");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_CAN_SUPPORT_EDITORONLY_DATA=0");
|
|
|
|
|
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_OGGVORBIS=1");
|
|
|
|
|
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("UNICODE");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("_UNICODE");
|
|
|
|
|
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("PLATFORM_ANDROID=1");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("ANDROID=1");
|
|
|
|
|
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_DATABASE_SUPPORT=0");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("WITH_EDITOR=0");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("USE_NULL_RHI=0");
|
2014-05-22 09:13:12 -04:00
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.Definitions.Add("REQUIRES_ALIGNED_INT_ACCESS");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-08-26 09:56:29 -04:00
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.CPPIncludeInfo.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/include");
|
|
|
|
|
|
|
|
|
|
// the toolchain will actually filter these out
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.CPPIncludeInfo.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a/include");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.CPPIncludeInfo.SystemIncludePaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86/include");
|
2014-08-11 17:27:11 -04:00
|
|
|
|
2014-08-26 09:56:29 -04:00
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/armeabi-v7a");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.LibraryPaths.Add("$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/" + GccVersion + "/libs/x86");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
Experimental UnrealBuildTool makefile support
UnrealBuildTool 'Makefiles' allow for very fast iterative builds.
- New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default)
- Turning this on causes Unreal Build Tool to emit 'UBT Makefiles' for targets when they're built the first time.
- Subsequent builds will load these Makefiles and begin outdatedness checking and build invocation very quickly.
- The caveat is that if source files are added or removed to the project, UBT will need to gather information about those in order for your build to complete successfully.
- Currently, you must run the project file generator after adding/removing source files to tell UBT to re-gather this information.
- Events that can invalidate the 'UBT Makefile':
- Adding/removing .cpp files
- Adding/removing .h files with UObjects
- Adding new UObject types to a file that didn't previously have any
- Changing global build settings (most settings in this file qualify.)
- Changed code that affects how Unreal Header Tool works
- You can force regeneration of the 'UBT Makefile' by passing the '-Gather' argument, or simply regenerating project files
- New command-line parameters added:
- "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes)
- "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled
- "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything
- "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled
- "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not
- "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must
Other changes:
- UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different
- C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization)
- The method that UBT uses to find the CoreUObject module timestamp was rewritten
- Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks
- The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable
- Cleaned up the comments and member variables in the "Action" class, while making it serializable
- Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles.
- Removed support for Actions to tinker with Stdout and Stderror (was not used for anything)
- Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file
- Plugin intermediate include directories are now selected on demand rather than cached early
- Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile)
- Removed Action.StatusDetailedDescription, was not used for anything
- Removed UEBuildConfiguration.bExcludePlugins, was not used for anything
- Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything
[CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.CPPIncludeInfo.SystemIncludePaths.Add("$(NDKROOT)/sources/android/native_app_glue");
|
|
|
|
|
InBuildTarget.GlobalCompileEnvironment.Config.CPPIncludeInfo.SystemIncludePaths.Add("$(NDKROOT)/sources/android/cpufeatures");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-12 22:11:52 -04:00
|
|
|
// Add path to statically compiled version of cxa_demangle
|
2014-08-26 09:56:29 -04:00
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.LibraryPaths.Add(UEBuildConfiguration.UEThirdPartySourceDirectory + "Android/cxa_demangle/armeabi-v7a");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.LibraryPaths.Add(UEBuildConfiguration.UEThirdPartySourceDirectory + "Android/cxa_demangle/x86");
|
2014-06-12 22:11:52 -04:00
|
|
|
|
2014-09-18 17:49:40 -04:00
|
|
|
//@TODO: Tegra Gfx Debugger
|
|
|
|
|
// InBuildTarget.GlobalLinkEnvironment.Config.LibraryPaths.Add(UEBuildConfiguration.UEThirdPartySourceDirectory + "NVIDIA/TegraGfxDebugger");
|
|
|
|
|
// InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("Tegra_gfx_debugger");
|
|
|
|
|
|
2014-08-11 17:27:11 -04:00
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("gnustl_shared");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("gcc");
|
2014-03-14 14:13:41 -04:00
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("z");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("c");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("m");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("log");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("dl");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("GLESv2");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("EGL");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("OpenSLES");
|
|
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("android");
|
2014-06-12 22:11:52 -04:00
|
|
|
InBuildTarget.GlobalLinkEnvironment.Config.AdditionalLibraries.Add("cxa_demangle");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
UEBuildConfiguration.bCompileSimplygon = false;
|
|
|
|
|
BuildConfiguration.bDeployAfterCompile = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool ShouldCreateDebugInfo(UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration)
|
|
|
|
|
{
|
|
|
|
|
switch (Configuration)
|
|
|
|
|
{
|
|
|
|
|
case UnrealTargetConfiguration.Development:
|
|
|
|
|
case UnrealTargetConfiguration.Shipping:
|
|
|
|
|
case UnrealTargetConfiguration.Test:
|
|
|
|
|
case UnrealTargetConfiguration.Debug:
|
|
|
|
|
default:
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-02 14:26:49 -04:00
|
|
|
public override string[] FinalizeBinaryPaths(string BinaryName)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-08-26 16:05:32 -04:00
|
|
|
string[] Architectures = AndroidToolChain.GetAllArchitectures();
|
2014-09-18 17:49:40 -04:00
|
|
|
string[] GPUArchitectures = AndroidToolChain.GetAllGPUArchitectures();
|
2014-08-26 16:05:32 -04:00
|
|
|
|
2014-09-02 14:26:49 -04:00
|
|
|
// make multiple output binaries
|
|
|
|
|
List<string> AllBinaries = new List<string>();
|
2014-08-26 16:05:32 -04:00
|
|
|
foreach (string Architecture in Architectures)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-09-18 17:49:40 -04:00
|
|
|
foreach (string GPUArchitecture in GPUArchitectures)
|
|
|
|
|
{
|
|
|
|
|
AllBinaries.Add(AndroidToolChain.InlineArchName(BinaryName, Architecture, GPUArchitecture));
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-09-02 14:26:49 -04:00
|
|
|
return AllBinaries.ToArray();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|