Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/Android/AndroidProjectGenerator.cs
Josh Adams 60b019520c Copying //UE4/Dev-Platform to //UE4/Dev-Main (Source: //UE4/Dev-Platform @ 3295257)
#lockdown Nick.Penwarden
#rb none

==========================
MAJOR FEATURES + CHANGES
==========================

Change 3235199 on 2016/12/14 by Joe.Barnes

	Fix new compile error for missing #define

Change 3235340 on 2016/12/14 by Arciel.Rekman

	Linux: refactor of some PlatformMisc functions.

	- RootDir() removed since it was a no-op.
	- Old EngineDir() implementation removed in favor of more generic one that should handle foreign engine dir.
	- Change by CengizT,

Change 3237014 on 2016/12/15 by Michael.Trepka

	Fixed a crash in FChunkCacheWorker constructor

Change 3238305 on 2016/12/16 by Josh.Adams

	- Added a None option to the FKey customization, unless the FKey property had NoClear on it

Change 3240823 on 2016/12/20 by Josh.Stoddard

	Device profiles don't work for iPadPro 9.7 and 12.9

	#jira UE-39943

Change 3241103 on 2016/12/20 by Alicia.Cano

	Android support from Visual Studio
	#jira UEPLAT-1421
	#android

Change 3241357 on 2016/12/20 by Chris.Babcock

	Add gameActivityOnNewIntentAddtions section to Android UPL
	#jira UE-38986
	#PR #2969
	#ue4
	#android

Change 3241941 on 2016/12/21 by Alicia.Cano

	Build Fix

Change 3249832 on 2017/01/06 by Nick.Shin

	refetch on timed out GET/POST requests

	#jira UE-39992  Quicklaunch UFE HTML5 fails with "NS_ERROR_Failure"

Change 3249837 on 2017/01/06 by Nick.Shin

	black box issues fixed:

	use device pixel ratio during width and height checks
	and use canvas dimensions if in full screen -- otherwise store SDL_window dimensions for future use

	#jira UE-36341  HTML5 - View is incorrectly drawn
	#jira UE-32311  Templates on Firefox/Chrome on HTML5 are not full screen during Launch On

Change 3249988 on 2017/01/06 by Josh.Adams

	- Disable the HeartBeat() function on platforms that don't actually want to use the HeartbeatThread
	#jira UE-40305, UE-39291, UE-40113

Change 3253720 on 2017/01/11 by Josh.Adams

	- Added support for a config class to use a specific platform's config hierarchy, so that the editor can read NDA'd platform default settings without needing the settings to in Base*.ini
	  - See SwitchRuntimeSettings.h / GetConfigOverridePlatform()
	- Addiontally made it so that NDAd platforms are saved to Project/Platform/Platform*.ini, instead of Project/Default*.ini (to keep samples .ini files free of NDAd platform settings).
	  - See UObject::GetDefaultConfigFilename()
	- Updated some minor ShooterGame switch settings while cleaning this up

Change 3254162 on 2017/01/11 by Daniel.Lamb

	Avoid trying to load empty package names.
	Fixed issue with iterative ini files being unparseable if they inlcude a colon in them.
	#jira UE-40257, UE-35001
	#test Cook QAGame

Change 3255309 on 2017/01/12 by Daniel.Lamb

	In the derived datacache commandlet wait for texture building to finish before we GC.
	#test DDC QAGame

Change 3255311 on 2017/01/12 by Daniel.Lamb

	Removed debug logging for shader compilation.
	Issue hasn't occured in a while and the logging is annoying.
	#test Cook QAGame

Change 3257024 on 2017/01/13 by Josh.Adams

	- Reread in the target RHIs array every time the list of shader types is needed, instead of caching, because the user could change the settings in the editor, then click cook.
	#jira UE-38691

Change 3259636 on 2017/01/16 by Josh.Adams

	- Fixed split screen render issue with payer 2 getting no geometry
	#jira UE-40684

Change 3260159 on 2017/01/17 by Ben.Marsh

	Added extra logging when deleting a directory fails during ReconcileWorkspace.

Change 3260300 on 2017/01/17 by Ben.Marsh

	More logging for cleaning workspaces.

Change 3261056 on 2017/01/17 by Daniel.Lamb

	Cook on the fly builds now resolve string asset references.
	#test Trivial

Change 3262803 on 2017/01/18 by Joe.Graf

	Added missing support for compiling plugins external to Engine/Plugins & Game/Plugins

Change 3262852 on 2017/01/18 by Joe.Graf

	Fixed the bad robomerge
	Don't try to regenerate projects when adding a content only plugin to a content only project

Change 3264930 on 2017/01/19 by Joe.Barnes

	#include some header files needed when building UFE.

Change 3265728 on 2017/01/20 by Will.Fissler

	PlatformShowcase - Added TestBed_MobileFeatures .umap and related test content.

Change 3267188 on 2017/01/21 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)

Change 3267439 on 2017/01/22 by Arciel.Rekman

	Fix Dev-Platform build.

	- Fixed just to have it compile; perhaps a proper fix is needed.
	- Seems to be caused by CL 3265587 (delegate was changed to return an array of search results instead of a single one).

Change 3267556 on 2017/01/23 by Arciel.Rekman

	Linux: fix MoveFile to work across file systems.

	- PR #3141 with slight changes.

Change 3267843 on 2017/01/23 by Arciel.Rekman

	Remove name collision (macro vs libc++).

	- Redoing CL 3259310.

Change 3267850 on 2017/01/23 by Arciel.Rekman

	Fix wrong always true condition.

	- PLATFORM_LINUX is always defined, but can be 0.

Change 3268048 on 2017/01/23 by Daniel.Lamb

	Integrated fix for rebuild lighting commandlet from Greg Korman @ Impulse Gear.
	#test Rebuild lighting Paragon

Change 3268403 on 2017/01/23 by Josh.Adams

	#BUILDUPGRADENOTES
	- Moved XboxOne and PS4 settings into platform specific .ini files (after using GetConfigOverridePlatform() in their class delcarations)
	- Licensee games that have PS4, XboxOne, Switch settings in DefaultEngine.ini will have those settings saved in the platform version next time the project settings are edited. DOCUMENT THIS!

Change 3272441 on 2017/01/25 by Chris.Babcock

	Fixed documentation error in UnrealPluginLanguage
	#ue4
	#android

Change 3272478 on 2017/01/25 by Chris.Babcock

	Fix another documentation error in UnrealPluginLanguage
	#ue4

Change 3272826 on 2017/01/25 by Chris.Babcock

	Google Cloud Messaging plugin for Android
	#jira UEPLAT-1458
	#ue4
	#android

Change 3272839 on 2017/01/25 by Chris.Babcock

	Fix name of Google Cloud Messaging Sender ID
	#ue4
	#android

Change 3273837 on 2017/01/26 by Daniel.Lamb

	Added check to ensure editor never saves source texture data which has had ReleaseSourceMemory called on it.
	Instead crash as this is a loss of content situation.
	#test Cook paragon cook qagame

Change 3274122 on 2017/01/26 by Alicia.Cano

	Runtime permissions support on Android
	- Removing certain permissions
	#jira UE-38512
	#android

Change 3274311 on 2017/01/26 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)

Change 3274794 on 2017/01/27 by Arciel.Rekman

	Linux: fix installed SDK check (UE-40392).

	- Pull request #3111 by rubu.

Change 3274803 on 2017/01/27 by Arciel.Rekman

	Linux: added few more exceptions to .gitignore (UE-39612).

	- Pull request #3026 by ardneran.

Change 3276247 on 2017/01/27 by Nick.Shin

	HTML5 HeapSize settings - make use of it from UE4 Editor:Platforms:HTML5:Memory:HeapSize

	note: emscripten says this is really no longer needed when using [ -s ALLOW_MEMORY_GROWTH=1 ] -- but tests have shown when using that, the game load/compile times takes longer

	#jira UE-34753  Zen Garden cannot compile in HTML5
	#jira UE-40815  Launching QAGame for HTML5 creates an 'uncaught exception: out of memory'.

Change 3276347 on 2017/01/27 by dan.reynolds

	Android Streaming Test Content

Change 3276682 on 2017/01/29 by Nick.Shin

	HTML5 thirdparty build scripts

	- fix up what looks like a bad merge
	- allow linux to also build these  libs
	- fixed harfbuzz to use freetype2-2.6 when building HTML5 libs

	- tested on mac, linux, and windows (git-bash)

Change 3276796 on 2017/01/29 by Nick.Shin

	HTML5 thirdparty (python) build scripts

	- linux patches from mozilla's jukka

	- tested on mac and, linux, and windows (git-bash)

	part of:
	#jira UEPLAT-1437  (4.16)  Switch [to] web assembly

Change 3276803 on 2017/01/29 by Nick.Shin

	HTML5 thirdparty build scripts

	- getting ready to build with (new toolchain that has) wasm support
	- minor fix to handle whitespace in project path

	- tested on mac and, linux, and windows (git-bash)

	part of:
	#jira UEPLAT-1437  (4.16)  Switch [to] web assembly

Change 3278007 on 2017/01/30 by Arciel.Rekman

	SteamVR: whitelist for Linux.

	- Makes Blueprint functions available in Linux builds, even if stubbed.
	- Can be probably whitelisted for Mac too.

Change 3278172 on 2017/01/30 by Arciel.Rekman

	Do not rebuild UnrealPak locally (UE-41285).

Change 3279873 on 2017/01/31 by Brent.Pease

	 + Implement streaming in Vorbis
	 + Add streaming to Android audio
	 + Fix audio streaming chunk race condition

Change 3280063 on 2017/01/31 by Brent.Pease

	GitHub 2949 : Fix for crashes when backgrounding/sleeping on iOS metal devices

	#2949
	#jira UE-38829

Change 3280072 on 2017/01/31 by Brent.Pease

	PR #2889: Add -distribution when iOS distribution Packaging. with IPhonePackage.exe (Contributed by sangpan)
	https://github.com/EpicGames/UnrealEngine/pull/2889

	#jira ue-37874
	#2889

Change 3280091 on 2017/01/31 by Arciel.Rekman

	Linux: fix "unable to make writable" toast (UE-37228).

	- Also fixed other platforms that returned inverted the error result.

Change 3280624 on 2017/01/31 by Brent.Pease

	PR #2891: iOS IDFV string allocation fix (Contributed by robertfsegal)
	https://github.com/EpicGames/UnrealEngine/pull/2891

	#2891
	#jira ue-37891

Change 3280625 on 2017/01/31 by Brent.Pease

	GitHub 2576 - Fix UIImagePickerController crash

	#2576
	#jira UE-328888

Change 3281618 on 2017/02/01 by Josh.Adams

	- Fixed hopeful compile error with missing inlcude
	#jira UE-41415

Change 3282277 on 2017/02/01 by Josh.Adams

	- Support 0.12.16 and 1.1.1 (the first versions that can share Oasis)

Change 3282441 on 2017/02/01 by Arciel.Rekman

	Fix Linux editor splash screen (UE-28123).

Change 3282580 on 2017/02/01 by Nick.Shin

	HTML5 - fix "firefox nighly" issue with:

	failed to compile wasm module: CompileError: at offset XXX: initial memory size too big:

	WARNING: this greatly impacts (in browser) compile times

Change 3285991 on 2017/02/03 by Chris.Babcock

	Fix executable path for stripping Android debug symbols (handle non-Windows properly)
	#jira UE-41238
	#ue4
	#android

Change 3286406 on 2017/02/03 by Chris.Babcock

	Save and restore texture filtering for movie playback in all cases
	#jira UE-41565
	#ue4
	#android

Change 3286800 on 2017/02/04 by Chris.Babcock

	Fix executable path for stripping Android debug symbols (handle non-Windows properly)
	#jira UE-41238
	#ue4
	#android

Change 3288598 on 2017/02/06 by Arciel.Rekman

	CodeLite fixes.

	- Use *-Linux-Debug binary for Debug configuration.
	- Fix virtual paths.

Change 3288864 on 2017/02/06 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
	- Note, Switch is known to not boot with this, fix coming next

Change 3289364 on 2017/02/06 by Josh.Adams

	[BUILDUPGRADENOTES] - Fixed the "type" of the desktop device profiles to be Windows, not WindowsNoEditor, etc. It should be the platform, not a random string.
	- Updated how DeviceProfiles are loaded, especially in the editor, so that we can have NDAd platforms have their default DP values in platform-hidden files
	- This makes use of the ability for a class to override the platform hierarchy in the editor (like we do with other editor-exposed platform objects)
	- Added Config/[PS4|XboxOne|Switch]/ConfidentialPlatform.ini files so that the DP loading code knows to look in their directories for DPs. See FGenericPlatformMisc::GetConfidentialPlatforms() for more information
	- Note that saving still saves the entire DP to the .ini. Next DP change is to have them properly save against their 2(!) parents - the .ini file earlier in the hierarchy, and the parent DP object. Makes it tricky, for sure.
	- Added FConfigFile::GetArray (previous was only on FConfigCacheIni)

Change 3289796 on 2017/02/07 by Arciel.Rekman

	Linux: remove leftover CEF build script.

Change 3289872 on 2017/02/07 by Arciel.Rekman

	Linux: install MIME types (UE-40954).

	- Pull request #3154 by RicardoEPRodrigues.

Change 3289915 on 2017/02/07 by Josh.Adams

	- Fixed CIS warnings

Change 3289916 on 2017/02/07 by Arciel.Rekman

	Linux: remove -opengl4 from the default invocation.

Change 3290009 on 2017/02/07 by Gil.Gribb

	UE4 - Fixed boot time EDL causing some issues even when it wasn't being used.

Change 3290120 on 2017/02/07 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)

Change 3290948 on 2017/02/07 by Arciel.Rekman

	Linux: fix crash when clicking on question mark (UE-41634).

	- Symbol interposition problem (proper fix is still to be investigated).

	(Edigrating part of CL 3290683 from Release-4.15 to Dev-Platform)

Change 3291074 on 2017/02/07 by Arciel.Rekman

	Speculative build fix.

Change 3292028 on 2017/02/08 by Josh.Adams

	- Fixed Incremental CIS build failures

Change 3292105 on 2017/02/08 by Nick.Shin

	emcc.py - change warning to info

	#jira UE-41747 //UE4/Dev-Platform Compile UE4Game HTML5 completed with 50 warnings

Change 3292201 on 2017/02/08 by JohnHenry.Carawon

	Change comment to fix XML warning when generating project files on Linux

Change 3292242 on 2017/02/08 by Arciel.Rekman

	Linux: avoid unnecessary dependency on CEF (UE-41634).

	- Do not apply CEF workaround to monolithic builds (eg. stock Game/Server targets).
	- Also disable CEF compilation for ShaderCompileWorker.
	- Based on CL 3292077 in 4.15.

Change 3292559 on 2017/02/08 by Josh.Adams

	- Added more platforms to disable the file handle caching (all the ones that use MANAGED_FILE_HANDLES)

Change 3294333 on 2017/02/09 by Josh.Adams

	Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)

Change 3294506 on 2017/02/09 by Josh.Adams

	- Fixed GoogleCloudMessaging.uplugin to fix the Installed flag. Every other plugin had false, this one had true, which caused various checks to go haywire
	#jira UE-41710

Change 3294984 on 2017/02/09 by Josh.Adams

	- Worked around the remote compiling issue with code-based projects on a different drive than the engine
	#jira UE-41704

Change 3295056 on 2017/02/09 by Josh.Adams

	- Fixed the remote compiling issue by unconverting the path back to host when reading from the module filename

Change 3295161 on 2017/02/09 by Josh.Adams

	- Fixed new bug when buildin native ios that was caused by a remote compile break

Change 3295229 on 2017/02/09 by Josh.Adams

	- Fixed a crash in clothing on platforms that don't support clothing
	#jira UE-41830

[CL 3295859 by Josh Adams in Main branch]
2017-02-09 19:20:55 -05:00

636 lines
34 KiB
C#

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
namespace UnrealBuildTool
{
/// <summary>
/// Base class for platform-specific project generators
/// </summary>
class AndroidProjectGenerator : UEPlatformProjectGenerator
{
static bool CheckedForNsight = false; // whether we have checked for a recent enough version of Nsight yet
static bool NsightInstalled = false; // true if a recent enough version of Nsight is installed
static int NsightVersionCode = 0; // version code matching detected Nsight
public static bool VSDebugCommandLineOptionPresent = false; //User must put -vsdebugandroid commandline option to build the debug projects
static bool VSDebuggingEnabled = false; // When set to true, allows debugging with built in MS Cross Platform Android tools.
// It adds separate projects ending in .androidproj and a file VSAndroidUnreal.props for the engine and all game projects
static bool VSSupportChecked = false; // Don't want to check multiple times
static bool VSPropsFileWritten = false; // This is for the file VSAndroidUnreal.props which only needs to be written once
bool IsVSAndroidSupportInstalled()
{
if (VSSupportChecked)
{
return VSDebuggingEnabled;
}
VSSupportChecked = true;
//check to make sure Cross Platform Tools are installed for MS
string Path = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Android SDK Tools", "Path", null) as string;
if (!String.IsNullOrEmpty(Path) && VSDebugCommandLineOptionPresent)
{
VSDebuggingEnabled = true;
}
else if (VSDebugCommandLineOptionPresent)
{
Log.TraceWarning("Android SDK tools have to be installed to use this. Please Install Visual C++ for Cross-Platform Mobile Development https://msdn.microsoft.com/en-us/library/dn707598.aspx");
}
return VSDebuggingEnabled;
}
/// <summary>
/// Check to see if a recent enough version of Nsight is installed.
/// </summary>
bool IsNsightInstalled(VCProjectFileFormat ProjectFileFormat)
{
// cache the results since this gets called a number of times
if (CheckedForNsight)
{
return NsightInstalled;
}
CheckedForNsight = true;
// NOTE: there is now a registry key that we can use instead at:
// HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\NVIDIA Corporation\Nsight Tegra\Version
string ProgramFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
string PlatformToolsetVersion = VCProjectFileGenerator.GetProjectFilePlatformToolsetVersionString(ProjectFileFormat);
if (String.IsNullOrEmpty(PlatformToolsetVersion))
{
// future maintainer: add toolset version and verify that the rest of the msbuild path, version, and location in ProgramFiles(x86) is still valid
Log.TraceInformation("Android project generation needs to be updated for this version of Visual Studio.");
return false;
}
// build the path to where the Nsight DLL we'll be checking should sit
string NsightDllPath = Path.Combine(ProgramFilesPath, @"MSBuild\Microsoft.Cpp\v4.0", PlatformToolsetVersion, @"Platforms\Tegra-Android\Nvidia.Build.CPPTasks.Tegra-Android.Extensibility.dll");
if (!File.Exists(NsightDllPath))
{
return false;
}
// grab the version info from the DLL
FileVersionInfo NsightVersion = FileVersionInfo.GetVersionInfo(NsightDllPath);
if (NsightVersion.ProductMajorPart > 3)
{
// Mark as Nsight 3.1 (project will be updated)
NsightVersionCode = 11;
NsightInstalled = true;
}
else if (NsightVersion.ProductMajorPart == 3)
{
// Nsight 3.0 supported
NsightVersionCode = 9;
NsightInstalled = true;
if (NsightVersion.ProductMinorPart >= 1)
{
// Nsight 3.1+ should be valid (will update project if newer)
NsightVersionCode = 11;
}
}
else if (NsightVersion.ProductMajorPart == 2)
{
// Nsight 2.0+ should be valid
NsightVersionCode = 6;
NsightInstalled = true;
}
else if ((NsightVersion.ProductMajorPart == 1) && (NsightVersion.ProductMinorPart >= 5))
{
// Nsight 1.5+ should be valid
NsightVersionCode = 6;
NsightInstalled = true;
}
if (!NsightInstalled)
{
Log.TraceInformation("\nNsight Tegra {0}.{1} found, but Nsight Tegra 1.5 or higher is required for debugging support.", NsightVersion.ProductMajorPart, NsightVersion.ProductMinorPart);
}
return NsightInstalled;
}
/// <summary>
/// Register the platform with the UEPlatformProjectGenerator class
/// </summary>
public override void RegisterPlatformProjectGenerator()
{
Log.TraceVerbose(" Registering for {0}", UnrealTargetPlatform.Android.ToString());
UEPlatformProjectGenerator.RegisterPlatformProjectGenerator(UnrealTargetPlatform.Android, this);
}
/// <summary>
/// Whether this build platform has native support for VisualStudio
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
/// <param name="ProjectFileFormat"></param>
/// <returns>bool true if native VisualStudio support (or custom VSI) is available</returns>
public override bool HasVisualStudioSupport(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, VCProjectFileFormat ProjectFileFormat)
{
// Debugging, etc. are dependent on the TADP being installed
return IsNsightInstalled(ProjectFileFormat) || IsVSAndroidSupportInstalled();
}
/// <summary>
/// Return the VisualStudio platform name for this build platform
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
/// <returns>string The name of the platform that VisualStudio recognizes</returns>
public override string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
{
string PlatformName = InPlatform.ToString();
if (InPlatform == UnrealTargetPlatform.Android)
{
if (IsVSAndroidSupportInstalled())
{
PlatformName = "ARM";
}
else
{
PlatformName = "Tegra-Android";
}
}
return PlatformName;
}
/// <summary>
/// Return any custom property group lines
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="ProjectFileFormat"></param>
/// <returns>string The custom property import lines for the project file; Empty string if it doesn't require one</returns>
public override string GetAdditionalVisualStudioPropertyGroups(UnrealTargetPlatform InPlatform, VCProjectFileFormat ProjectFileFormat)
{
if(IsVSAndroidSupportInstalled() || !IsNsightInstalled(ProjectFileFormat))
{
return base.GetAdditionalVisualStudioPropertyGroups(InPlatform, ProjectFileFormat);
}
return " <PropertyGroup Label=\"NsightTegraProject\">" + ProjectFileGenerator.NewLine +
" <NsightTegraProjectRevisionNumber>" + NsightVersionCode.ToString() + "</NsightTegraProjectRevisionNumber>" + ProjectFileGenerator.NewLine +
" </PropertyGroup>" + ProjectFileGenerator.NewLine;
}
/// <summary>
/// Return any custom property group lines
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="ProjectFileFormat"></param>
/// <returns>string The custom property import lines for the project file; Empty string if it doesn't require one</returns>
public override string GetVisualStudioPlatformConfigurationType(UnrealTargetPlatform InPlatform, VCProjectFileFormat ProjectFileFormat)
{
string ConfigurationType = "";
if(IsVSAndroidSupportInstalled())
{
ConfigurationType = "Makefile";
}
else if (IsNsightInstalled(ProjectFileFormat))
{
ConfigurationType = "ExternalBuildSystem";
}
else
{
ConfigurationType = base.GetVisualStudioPlatformConfigurationType(InPlatform, ProjectFileFormat);
}
return ConfigurationType;
}
/// <summary>
/// Return the platform toolset string to write into the project configuration
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
/// <param name="InProjectFileFormat">The version of Visual Studio to target</param>
/// <returns>string The custom configuration section for the project file; Empty string if it doesn't require one</returns>
public override string GetVisualStudioPlatformToolsetString(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, VCProjectFileFormat InProjectFileFormat)
{
if (IsVSAndroidSupportInstalled() || !IsNsightInstalled(InProjectFileFormat))
{
return "\t\t<PlatformToolset>" + VCProjectFileGenerator.GetProjectFilePlatformToolsetVersionString(InProjectFileFormat) + "</PlatformToolset>" + ProjectFileGenerator.NewLine;
}
return "\t\t<PlatformToolset>" + VCProjectFileGenerator.GetProjectFilePlatformToolsetVersionString(InProjectFileFormat) + "</PlatformToolset>" + ProjectFileGenerator.NewLine
+ "\t\t<AndroidNativeAPI>UseTarget</AndroidNativeAPI>" + ProjectFileGenerator.NewLine;
}
/// <summary>
/// Return any custom paths for VisualStudio this platform requires
/// This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
/// </summary>
/// <param name="InPlatform">The UnrealTargetPlatform being built</param>
/// <param name="InConfiguration">The configuration being built</param>
/// <param name="TargetType">The type of target (game or program)</param>
/// <param name="TargetRulesPath">Path to the target.cs file</param>
/// <param name="ProjectFilePath">Path to the project file</param>
/// <param name="NMakeOutputPath"></param>
/// <param name="InProjectFileFormat">Format for the generated project files</param>
/// <returns>The custom path lines for the project file; Empty string if it doesn't require one</returns>
public override string GetVisualStudioPathsEntries(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath, VCProjectFileFormat InProjectFileFormat)
{
string PathsLines = "";
if (!IsVSAndroidSupportInstalled() && IsNsightInstalled(InProjectFileFormat))
{
// NOTE: We are intentionally overriding defaults for these paths with empty strings. We never want Visual Studio's
// defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
// the environment that UBT is building in. We'll set these environment variables ourselves!
// NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
// environment variable
//@todo android: clean up debug path generation
string GameName = TargetRulesPath.GetFileNameWithoutExtension();
GameName = Path.GetFileNameWithoutExtension(GameName);
// intermediate path for Engine or Game's intermediate
string IntermediateDirectoryPath;
IntermediateDirectoryPath = Path.GetDirectoryName(NMakeOutputPath.FullName) + "/../../Intermediate/Android/APK";
// string for <OverrideAPKPath>
string APKPath = Path.Combine(
Path.GetDirectoryName(NMakeOutputPath.FullName),
Path.GetFileNameWithoutExtension(NMakeOutputPath.FullName) + "-armv7-es2.apk");
// string for <BuildXmlPath> and <AndroidManifestPath>
string BuildXmlPath = IntermediateDirectoryPath;
string AndroidManifestPath = Path.Combine(IntermediateDirectoryPath, "AndroidManifest.xml");
// string for <AdditionalLibraryDirectories>
string AdditionalLibDirs = "";
AdditionalLibDirs += IntermediateDirectoryPath + @"\obj\local\armeabi-v7a";
AdditionalLibDirs += ";" + IntermediateDirectoryPath + @"\obj\local\x86";
AdditionalLibDirs += @";$(AdditionalLibraryDirectories)";
PathsLines =
" <IncludePath />" + ProjectFileGenerator.NewLine +
" <ReferencePath />" + ProjectFileGenerator.NewLine +
" <LibraryPath />" + ProjectFileGenerator.NewLine +
" <LibraryWPath />" + ProjectFileGenerator.NewLine +
" <SourcePath />" + ProjectFileGenerator.NewLine +
" <ExcludePath />" + ProjectFileGenerator.NewLine +
" <AndroidAttach>False</AndroidAttach>" + ProjectFileGenerator.NewLine +
" <DebuggerFlavor>AndroidDebugger</DebuggerFlavor>" + ProjectFileGenerator.NewLine +
" <OverrideAPKPath>" + APKPath + "</OverrideAPKPath>" + ProjectFileGenerator.NewLine +
" <AdditionalLibraryDirectories>" + AdditionalLibDirs + "</AdditionalLibraryDirectories>" + ProjectFileGenerator.NewLine +
" <BuildXmlPath>" + BuildXmlPath + "</BuildXmlPath>" + ProjectFileGenerator.NewLine +
" <AndroidManifestPath>" + AndroidManifestPath + "</AndroidManifestPath>" + ProjectFileGenerator.NewLine;
}
else
{
PathsLines = base.GetVisualStudioPathsEntries(InPlatform, InConfiguration, TargetType, TargetRulesPath, ProjectFilePath, NMakeOutputPath, InProjectFileFormat);
}
return PathsLines;
}
/// <summary>
/// Return any custom property settings. These will be included right after Global properties to make values available to all other imports.
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <returns>string The custom property import lines for the project file; Empty string if it doesn't require one</returns>
public override string GetVisualStudioGlobalProperties(UnrealTargetPlatform InPlatform)
{
if (IsVSAndroidSupportInstalled())
{
return " <Import Project=\"$(AndroidTargetsPath)\\Android.Tools.props\"/>" + ProjectFileGenerator.NewLine;
}
return base.GetVisualStudioGlobalProperties(InPlatform);
}
/// <summary>
/// Return any custom property settings. These will be included in the ImportGroup section
/// </summary>
/// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
/// <returns>string The custom property import lines for the project file; Empty string if it doesn't require one</returns>
public override string GetVisualStudioImportGroupProperties(UnrealTargetPlatform InPlatform)
{
if (IsVSAndroidSupportInstalled())
{
return " <Import Project=\"VSAndroidUnreal.props\" /> " + ProjectFileGenerator.NewLine;
}
return base.GetVisualStudioImportGroupProperties(InPlatform);
}
/// <summary>
/// For Additional Project Property file VSAndroidUnreal.props file that need to be written out. This is currently used only on Android.
/// </summary>
public override void WriteAdditionalPropFile()
{
if(!IsVSAndroidSupportInstalled())
{
return;
}
//This file only needs to be written once and doesn't change.
if(VSPropsFileWritten)
{
return;
}
VSPropsFileWritten = true;
string FileName = "VSAndroidUnreal.props";
string FileText = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + ProjectFileGenerator.NewLine +
"<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">" + ProjectFileGenerator.NewLine +
" <ImportGroup Label=\"PropertySheets\" />" + ProjectFileGenerator.NewLine +
" <PropertyGroup Label=\"UserMacros\">" + ProjectFileGenerator.NewLine +
" <ANDROID_HOME>$(VS_AndroidHome)</ANDROID_HOME>" + ProjectFileGenerator.NewLine +
" <JAVA_HOME>$(VS_JavaHome)</JAVA_HOME>" + ProjectFileGenerator.NewLine +
" <ANT_HOME>$(VS_AntHome)</ANT_HOME>" + ProjectFileGenerator.NewLine +
" <NDKROOT>$(VS_NdkRoot)</NDKROOT>" + ProjectFileGenerator.NewLine +
" </PropertyGroup>" + ProjectFileGenerator.NewLine +
" <PropertyGroup />" + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup />" + ProjectFileGenerator.NewLine +
" <ItemGroup>" + ProjectFileGenerator.NewLine +
" <BuildMacro Include=\"ANDROID_HOME\">" + ProjectFileGenerator.NewLine +
" <Value>$(ANDROID_HOME)</Value>" + ProjectFileGenerator.NewLine +
" <EnvironmentVariable>true</EnvironmentVariable>" + ProjectFileGenerator.NewLine +
" </BuildMacro>" + ProjectFileGenerator.NewLine +
" <BuildMacro Include=\"JAVA_HOME\">" + ProjectFileGenerator.NewLine +
" <Value>$(JAVA_HOME)</Value>" + ProjectFileGenerator.NewLine +
" <EnvironmentVariable>true</EnvironmentVariable>" + ProjectFileGenerator.NewLine +
" </BuildMacro>" + ProjectFileGenerator.NewLine +
" <BuildMacro Include=\"ANT_HOME\">" + ProjectFileGenerator.NewLine +
" <Value>$(ANT_HOME)</Value>" + ProjectFileGenerator.NewLine +
" <EnvironmentVariable>true</EnvironmentVariable>" + ProjectFileGenerator.NewLine +
" </BuildMacro>" + ProjectFileGenerator.NewLine +
" <BuildMacro Include=\"NDKROOT\">" + ProjectFileGenerator.NewLine +
" <Value>$(NDKROOT)</Value>" + ProjectFileGenerator.NewLine +
" <EnvironmentVariable>true</EnvironmentVariable>" + ProjectFileGenerator.NewLine +
" </BuildMacro>" + ProjectFileGenerator.NewLine +
" </ItemGroup>" + ProjectFileGenerator.NewLine +
"</Project>";
ProjectFileGenerator.WriteFileIfChanged(ProjectFileGenerator.IntermediateProjectFilesPath + "\\" + FileName, FileText);
}
/// <summary>
/// For additional Project file *PROJECTNAME*-AndroidRun.androidproj.user that needs to be written out. This is currently used only on Android.
/// </summary>
/// <param name="ProjectFile">ProjectFile object</param>
public override void WriteAdditionalProjUserFile(ProjectFile ProjectFile)
{
if (!IsVSAndroidSupportInstalled() || ProjectFile.SourceFiles.Count == 0)
{
return;
}
string BaseDirectory = ProjectFile.SourceFiles[0].BaseFolder.FullName;
string ProjectName = ProjectFile.ProjectFilePath.GetFileNameWithoutExtension();
string FileName = ProjectName + "-AndroidRun.androidproj.user";
string FileText = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + ProjectFileGenerator.NewLine +
"<Project ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">" + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM\'\">" + ProjectFileGenerator.NewLine +
" <PackagePath>" + BaseDirectory + "\\Binaries\\Android\\" + ProjectName + "-armv7-es2.apk</PackagePath>" + ProjectFileGenerator.NewLine +
" <LaunchActivity>" + ProjectFileGenerator.NewLine +
" </LaunchActivity>" + ProjectFileGenerator.NewLine +
" <AdditionalSymbolSearchPaths>" + BaseDirectory + "\\Intermediate\\Android\\APK\\obj\\local\\armeabi-v7a;" + BaseDirectory + "\\Intermediate\\Android\\APK\\jni\\armeabi-v7a;" + BaseDirectory + "\\Binaries\\Android;$(AdditionalSymbolSearchPaths)</AdditionalSymbolSearchPaths>" + ProjectFileGenerator.NewLine +
" <DebuggerFlavor>AndroidDebugger</DebuggerFlavor>" + ProjectFileGenerator.NewLine +
" </PropertyGroup>" + ProjectFileGenerator.NewLine +
"</Project>";
ProjectFileGenerator.WriteFileIfChanged(ProjectFileGenerator.IntermediateProjectFilesPath + "\\" + FileName, FileText);
}
/// <summary>
/// For additional Project file *PROJECTNAME*-AndroidRun.androidproj that needs to be written out. This is currently used only on Android.
/// </summary>
/// <param name="ProjectFile">ProjectFile object</param>
public override Tuple<ProjectFile, string> WriteAdditionalProjFile(ProjectFile ProjectFile)
{
if (!IsVSAndroidSupportInstalled())
{
return null;
}
string ProjectName = ProjectFile.ProjectFilePath.GetFileNameWithoutExtension() + "-AndroidRun";
string FileName = ProjectName + ".androidproj";
string FileText = "<?xml version=\"1.0\" encoding=\"utf-8\"?> " + ProjectFileGenerator.NewLine +
"<Project DefaultTargets=\"Build\" ToolsVersion=\"14.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"> " + ProjectFileGenerator.NewLine +
" <ItemGroup Label=\"ProjectConfigurations\"> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Debug|ARM\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Debug</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>ARM</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Release|ARM\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Release</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>ARM</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Debug|ARM64\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Debug</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>ARM64</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Release|ARM64\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Release</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>ARM64</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Debug|x64\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Debug</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>x64</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Release|x64\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Release</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>x64</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Debug|x86\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Debug</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>x86</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" <ProjectConfiguration Include=\"Release|x86\"> " + ProjectFileGenerator.NewLine +
" <Configuration>Release</Configuration> " + ProjectFileGenerator.NewLine +
" <Platform>x86</Platform> " + ProjectFileGenerator.NewLine +
" </ProjectConfiguration> " + ProjectFileGenerator.NewLine +
" </ItemGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Label=\"Globals\"> " + ProjectFileGenerator.NewLine +
" <RootNamespace>" + ProjectName + "</RootNamespace> " + ProjectFileGenerator.NewLine +
" <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> " + ProjectFileGenerator.NewLine +
" <ProjectVersion>1.0</ProjectVersion> " + ProjectFileGenerator.NewLine +
//Set the project guid
" <ProjectGuid>" + System.Guid.NewGuid().ToString("B").ToUpper() + "</ProjectGuid> " + ProjectFileGenerator.NewLine +
" <ConfigurationType>Application</ConfigurationType> " + ProjectFileGenerator.NewLine +
" <_PackagingProjectWithoutNativeComponent>true</_PackagingProjectWithoutNativeComponent> " + ProjectFileGenerator.NewLine +
" <LaunchActivity Condition=\"\'$(LaunchActivity)\' == \'\'\">com." + ProjectName + "." + ProjectName + "</LaunchActivity> " + ProjectFileGenerator.NewLine +
" <JavaSourceRoots>src</JavaSourceRoots> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <Import Project=\"$(AndroidTargetsPath)\\Android.Default.props\" /> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>true</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|ARM\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>false</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM64\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>true</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|ARM64\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>false</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|x64\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>true</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x64\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>false</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|x86\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>true</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x86\'\" Label=\"Configuration\"> " + ProjectFileGenerator.NewLine +
" <UseDebugLibraries>false</UseDebugLibraries> " + ProjectFileGenerator.NewLine +
" <TargetName>$(RootNamespace)</TargetName> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <Import Project=\"$(AndroidTargetsPath)\\Android.props\" /> " + ProjectFileGenerator.NewLine +
" <ImportGroup Label=\"ExtensionSettings\" /> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Label=\"UserMacros\" /> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|ARM\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM64\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|ARM64\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|x64\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x64\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|x86\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x86\'\"> " + ProjectFileGenerator.NewLine +
" </PropertyGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|ARM\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|ARM64\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|ARM64\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|x64\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x64\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Debug|x86\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <ItemDefinitionGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x86\'\"> " + ProjectFileGenerator.NewLine +
" <AntPackage> " + ProjectFileGenerator.NewLine +
" <AndroidAppLibName /> " + ProjectFileGenerator.NewLine +
" </AntPackage> " + ProjectFileGenerator.NewLine +
" </ItemDefinitionGroup> " + ProjectFileGenerator.NewLine +
" <Import Project=\"$(AndroidTargetsPath)\\Android.targets\" /> " + ProjectFileGenerator.NewLine +
" <ImportGroup Label=\"ExtensionTargets\" /> " + ProjectFileGenerator.NewLine +
"</Project>";
bool Success = ProjectFileGenerator.WriteFileIfChanged(ProjectFileGenerator.IntermediateProjectFilesPath + "\\" + FileName, FileText);
FileReference ProjectFilePath = FileReference.Combine(ProjectFileGenerator.IntermediateProjectFilesPath, FileName);
AndroidDebugProjectFile Project = new AndroidDebugProjectFile(ProjectFilePath);
Project.ShouldBuildForAllSolutionTargets = false;
Project.ShouldBuildByDefaultForSolutionTargets = false;
return Success ? new Tuple<ProjectFile, string>(Project, "UE4 Android Debug Projects") : null;
}
}
/// <summary>
/// An Android Debug Project
/// </summary>
class AndroidDebugProjectFile : MSBuildProjectFile
{
/// <summary>
/// Constructs a new project file object
/// </summary>
/// <param name="InitFilePath">The path to the project file on disk</param>
public AndroidDebugProjectFile(FileReference InitFilePath)
: base(InitFilePath)
{
}
// This is the GUID that Visual Studio uses to identify an Android project file in the solution
public override string ProjectTypeGUID
{
get { return "{39E2626F-3545-4960-A6E8-258AD8476CE5}"; }
}
/// <summary>
/// The only valid configuration for these to be run in is Debug|ARM
/// </summary>
/// <param name="Platform">Actual platform</param>
/// <param name="Configuration">Actual configuration</param>
/// <param name="TargetConfigurationName">The configuration name from the target rules, or null if we don't have one</param>
/// <param name="ProjectPlatformName">Name of platform string to use for Visual Studio project</param>
/// <param name="ProjectConfigurationName">Name of configuration string to use for Visual Studio project</param>
public override void MakeProjectPlatformAndConfigurationNames(UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string TargetConfigurationName, out string ProjectPlatformName, out string ProjectConfigurationName)
{
ProjectConfigurationName = UnrealTargetConfiguration.Debug.ToString();
ProjectPlatformName = "ARM";
}
}
}