Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/ProjectFiles/Xcode/XcodeProject.cs
chris babcock 016d94e747 Copying //UE4/Dev-Mobile to //UE4/Dev-Main (Source: //UE4/Dev-Mobile [at] 4355761)
#lockdown Nick.Penwarden
#rb Jack.Porter

============================
  MAJOR FEATURES & CHANGES
============================

Change 4066430 by Nick.Shin

	HTML5 - fix merge stomping and add in missing SC.Metadatadir (null) object to last {if else} block

	#jira UE-58423  HTML5 Quicklaunch through UnrealFrontEnd fails on Stage Command: Error: System.NullReferenceExeception

Change 4067037 by Bogdan.Vasilache

	#jira UE-57406

	Shaders compiled for GLSL_ES2 with CFLAG_FeatureLevelES31 compiler flag will now shift to GLSL_ES3_1_ANDROID profile instead of GLSL_310_ES_EXT.

Change 4067649 by Jack.Porter

	Remove obsolete cvars from ini files
	#jira UE-54768

Change 4071833 by Bogdan.Vasilache

	#jira UE-57406

	ShaderVersion guid updated to reflect changes in the OpenGL shader compiler.

Change 4075162 by Bogdan.Vasilache

	#jira UE-53195

Change 4099176 by Jack.Porter

	Fix SpeedTree node not working on ES3_1 (Contributed by PicaroonX)

	#jira UE-59685
	PR #4761

Change 4124398 by Mi.Wang

	Add particle cutout support for feature level es31.

Change 4129400 by Sorin.Gradinaru

	UE-60226 Web Browser widget is completely white on Android

	#jira UE-60226
	#jira UE-53247
	#Android
	#4.21

	from Release-4.20 CL 4122319

	The URL from the sample app is malformed (http:www.google.com).
	Since the phone's default browser is able to correct this problem for http and https URLs, I've added this exception to the code that checks the URL prefix, re-writing the fix for UE-53247.

Change 4164212 by Nick.Shin

	minor fixes to merge from Main

	#jira none

Change 4165606 by Nick.Shin

	#jira UE-57006  QA-Promotion WebGL1 HTML5 Launch On has numerous graphical errors

	in order for UNROLL to work -- break statement needs to be removed

Change 4165823 by Nick.Shin

	HTML5 - split single large template file to smaller component (e.g. js & css) files

	custom template files are also supported on a per-project basis:

	copy
	.../Engine/Build/HTML5/GameX.*.template
	to
	<project>/Build/HTML5/.

	build will automatically pick it the project's path (otherwise fallback to the Engine's version)

	this is based on GitHub PR #4780

	#jira UE-60136  GitHub 4780 : Proposed HTML5 Changes

Change 4202481 by Sorin.Gradinaru

	UE-50492 OnUrlChanged does not fire on mobile

	#jira UE-50492
	#iOS
	#4.21

	Adding the events for load started & finished with errors

Change 4202484 by Sorin.Gradinaru

	UEMOB-454 Move the virtual keyboard out of Experimental and make it enabled by default

	#jira UEMOB-454
	#4.21

Change 4202583 by Bogdan.Vasilache

	[UE-53816] Allow texture sampling in vertex shaders for ES2 feature level
	#jira UE-53816

Change 4214064 by Nick.Shin

	Epic's GitHub policy is to treat "unknown" file extensions as "binary"

	changing filenames so that they will show up GitHub's repo

	this is in reference to GitHub PR #4780

	#jira UE-60136  GitHub 4780 : Proposed HTML5 Changes

Change 4224514 by Mi.Wang

	We should not Tick USceneCaptureComponent on DS by default.

Change 4230192 by Nick.Shin

	HTML5 READMEs

	updating old ones - and putting new ones in

	these originally came from (mostly) onboarding the chrome team on UE4 emails.  capturing most of that in markdown format.

	#jria UEMOB-255  HTML5 Multithreading

Change 4232460 by Nick.Shin

	HTML5 - fix UE_MakeHTTPDataRequest() crash

	#jira  UE-38351  ( Pri:1 - 4.21 )  Red and Blue color channels flipped on materials called from HTML5 server

Change 4234647 by Nick.Shin

	HTML5 - ERGBFormat::RGBA  vs  ERGBFormat::BGRA

	- make use of the enums in UAsyncTaskDownloadImage::HandleImageRequest()
	- enable RGBA  vs  BGRA options for JPG decoder

	#jira  UE-38351  ( Pri:1 - 4.21 )  Red and Blue color channels flipped on materials called from HTML5 server

Change 4240086 by Sorin.Gradinaru

	UE-61345 Decals in Remote Session are not rendering on some iOS devices

	#jira UE-61345
	#4.21
	#iOS

	Changed the texture compression from DXT5 to RGBA

Change 4240234 by Sorin.Gradinaru

	UE-61838 Android 'Launch On All' can't run during an existing launch on session on Windows

	#jira UE-61838
	#4.21

	Cancel previous sessions before launching the selected configuration.

Change 4244686 by Nick.Shin

	HTML5 - syncing build scripts

	#jria UEMOB-255  HTML5 Multithreading

Change 4246399 by Nick.Shin

	HTML5 - syncing PhysX build scripts

	#jria UEMOB-255  HTML5 Multithreading

Change 4267990 by Bogdan.Vasilache

	[UEMOB-405] - Mobile PIE polishing - Bezel & Rotation + related subtasks

	#jira UEMOB-405
	#jira UEMOB-458
	#jira UEMOB-459
	#jira UEMOB-460

Change 4280211 by Chris.Babcock

	Fix FD_SET macro invoke crash when Socket FD exceed 1023 (contributed by scahp)

	#jira UE-62290
	#PR #4912
	#ue4
	#android

Change 4300275 by Nick.Shin

	HTML5 - Unreal File Server - css response header fixes

	#jira UE-63009 HTML5 template page has non-centered viewport and loading banner stretches the entire screen

Change 4302328 by Nick.Shin

	#jira UE-63108  HTML5 RunMacHTML5LauncherHelper.command files do not have appropriate permissions to run on Mac

Change 4303428 by Jack.Porter

	Fixed crash during cooking for certain landscapes with collision data out of sync with render data.

Change 4307517 by Jack.Porter

	Fix warning on Mac/Linux

	#jira UE-62993

Change 4311437 by Nick.Shin

	HTML5 : re-enabling [ -s BINARYEN_TRAP_MODE='clamp'; ]

	warning: this is technically slower performing -- but, this fixes a lot of 64-bit issues (HTML5 is "only" 32-bits)

	#jira UE-63049  HTML5 Quicklaunch to Chrome crashes with RuntimeError: float unrepresentable in integer range

Change 4312602 by Chris.Babcock

	Allow some hardware buttons through if hardware keyboard disabled

	#jira UE-63260
	#ue4
	#android

Change 4312711 by Chris.Babcock

	Fix string formatting for some locales in GetMetaDataString Method (contributed by IlinAleksey)

	#jira UE-63252
	#PR #5026
	#ue4
	#android

Change 4321719 by Bogdan.Vasilache

	UE-63378 - Fixed static analysis warnings
	#jira UE-63378

Change 4331224 by Jack.Porter

	Fixed Mobile PIE resolution for iPhone 8 Plus

	#jira UE-63191

Change 4339446 by Jack.Porter

	Modified foliage thumbnail color to better show when it is inactive
	#jira UE-30824
	#5057

Change 4339458 by Dmitriy.Dyomin

	Fixed typos in glObjectPtrLabel type definitions (contributed by TheCodez)
	#4920
	#jira UE-62368

Change 4339460 by Dmitriy.Dyomin

	Fixed: bRenderInMainPass on SkeletalMeshes doesn't work on Mobile
	#jira UE-59077

Change 4339523 by Sorin.Gradinaru

	UE-61351 Error: Failed to send -1 bytes of data to RemoteConnection spammed in the editor log when closing RemoteSession on device during connection

	#jira UE-61351
	#4.21

	Not an real issue. The message is issued whenever the host (or the client) tries to send messages through an inactive channel. There is a "/ping" message sent back and forth between the host and the client, with high frequency (hence the spam) - if this message is no longer received, the host (or the client) decides to terminate the connection.

	"Downgrading" the message from Error to Log, to avoid spamming the log on release builds.

Change 4339590 by Sorin.Gradinaru

	UE-61554 Web Browser: No Transparency in 3D Widget Component on Mobile

	#jira UE-61554
	#Android
	#4.21

	Modified Web Texture Material's blend mode to "Translucent"

Change 4339595 by Sorin.Gradinaru

	[Build] UE4 Dev-Mobile - CL 4339590 - Incremental Editor Win64

Change 4339597 by Jack.Porter

	Fix static analysis CIS
	This function should be moved to SceneUtils.h and the dependency in AsyncTaskDownloadImage resolved another way.
	#jira UE-63378

Change 4339599 by Sorin.Gradinaru

	UE-56076 Android Launch On "Running..." toast intermittently doesn't appear
	#jira UE-56076
	#Android
	#4.21

	wait before getting the process list with "adb shell ps" - on some devices the list is not yet ready

Change 4339647 by Sorin.Gradinaru

	UE-54791 Planar Reflection gamma / brightness incorrect on Samsung Galaxy S5

	#jira UE-54791
	#Android
	#4.21

	The planar texture contains encoded data:
	- decode it immediately after sampling the texture
	- alpha channel was inverted during the PrefilterPlanarReflectionPS step

Change 4339654 by Sorin.Gradinaru

	UE-59697 WebBrowser SetVisibility not working on Android & iOS

	#jira UE-59697
	#4.21
	#iOS
	#Android

	SetVisibility implemented on iOS and Android's web browsers, by extending the implementation on Windows: use a list to store references to the webbrowsers in the scene , then in WebBrowserSingleton::Tick check if the cached web browsers windows or widgets ticked on the last frame

Change 4339656 by Sorin.Gradinaru

	Remove unnecessary comment in IOSPlatformWebBrowser.cpp

Change 4339666 by Bogdan.Vasilache

	[UEMOB-455] Make editor tool to dump out a device .json file for a connected Android device
	#jira UEMOB-455

Change 4339667 by Bogdan.Vasilache

	Mobile PIE bugfixes
	#jira UE-63288
	#jira UE-63282

Change 4339700 by Bogdan.Vasilache

	[bugfix] Accidentally disabled SetPreviewPlatform() call for mobile PIE simulation.

Change 4339733 by Sorin.Gradinaru

	UE-59381 Ios application default orientation

	#jira UE-59381
	#iOS
	#4.21

	- added Initial interface orientation in the generated Plist file (UIInterfaceOrientation key)
	- implemented preferredInterfaceOrientationForPresentation in the IOSViewController
	- re-arranged the orientation list in the Plist file

Change 4339781 by Sorin.Gradinaru

	UE-60716 Show cursor in Editor text boxes when focused on Android

	#jira UE-60716
	#Android
	#4.21

	Updating the widget's cursor position from the native code.
	This also overrides the fix for UE49124 Cursor in virtual keyboard and UMG don't match - initially the solution was to hide the widget's cursor.

Change 4340037 by Jack.Porter

	Added an Android Project Settings checkbox to enable detection of Vulkan device support by default. If unchecked, the -detectvulkan command line parameter can be used.

Change 4340076 by Jack.Porter

	Fix warning seen by CIS

	#jira UE-63377

Change 4340212 by Sorin.Gradinaru

	UE-63224 Android DLC profile in Project Launcher fails if there is a space in the path for the destination directory

	#jira UE-63224
	#4.21
	#Android

	Avoid enclosing path arguments in double quotes (""<path>""). MakePathSafeToUseWithCommandLine(<path>) already adds quotes when needed.

Change 4340721 by Andrew.Grant

	Fixed -vsmac argument not working with GenerateProjectFiles

	#jira nojira

Change 4340822 by Andrew.Grant

	Replaced default iOS splashcreens with UE logo
	Added missing resolutions (iPhone 5 portrait, iPad 10.5")
	Removed custom splash images from RemoteSessionApp

	#jira UE-59864, UE-61939

Change 4340857 by Chris.Babcock

	Fix virtual keyboard crashes on Android

	#jira none

Change 4341047 by Andrew.Grant

	Prevent Xcode upgrade warnings for >9.0 versions

Change 4343797 by Cosmin.Sulea

	iOS - iPhonePackager ExportCertificate command failing 100%

Change 4343823 by Sorin.Gradinaru

	UE-63334 Unreal Remote 2 does not send information about motion control

	#jira UE-63334
	#iOS
	#Android

	The functionality was commented out. Tested it for performance and it seems OK (despite the high frequency of /motion signals)

Change 4343824 by Sorin.Gradinaru

	UEMOB-185 Implement the equivalent of FAndroidJSScripting for iOS
	UE-59488 FWebBrowserWindow::UnbindUObject of IOSPlatformWebBrowser.cpp is not implemented yet

	#jira UEMOB-185
	#jira UE-59488
	#4.21
	#iOS

	New methods (using WebKit, matching the Android implementation):
	- Go back/forward
	- HandlePageLoading (loading/didCommitNavigation, loaded/didFinishNavigation)
	- HandleReceivedError (didFailNavigation)
	- execute JS code
	- controlling the client using JS commands (WKWebViewConfiguration & WKUserContentController):
		- in Android we using shouldInterceptRequest to intercept a custom resource URL (JS: XMLHttpRequest.send, document.location)
		- iOS will register handlers (JS: window.webkit.messageHandlers.<FMobileJSScripting::JSMessageHandler>.postMessage)

Change 4343845 by Sorin.Gradinaru

	Adding the signatures for FJavaWrapper's CallLongMethod, CallFloatMethod and CallDoubleMethod in the AndroidJNI.h

	#4.21
	#Android

Change 4343893 by Cosmin.Sulea

	UEMOB-465 - Add Device Output Log support for iOS
	#jira UEMOB-465

Change 4343895 by Dmitriy.Dyomin

	Fixed: DepthFade does not work in mobile emulation while MobileMSAA enabled
	#jira UE-60404

Change 4343899 by Dmitriy.Dyomin

	GitHub 4851 : Fix layer info property bNoWeightBlend not being saved after tiled landscape import (contributed by cmp-)
	#4851
	#jira UE-61437

Change 4343906 by Bogdan.Vasilache

	Editor's feature level is now saved and restored between sessions
	#jira UE-55506
	#jira UE-59688

Change 4346729 by Jack.Porter

	Fix CIS
	#jira UE-63716

Change 4347811 by Jack.Porter

	Fix dependency chain while including PIEPreviewDeviceSpecification
	#jira UE-63755

Change 4348580 by Jack.Porter

	Fix CIS issues in IOSPlatformWebBrowser
	#jira UE-63809

Change 4350092 by Jack.Porter

	Fix null pointer exception in iPhonePackager when a matching certificate cannot be found

	#jira UE-63821

Change 4350968 by Jack.Porter

	Update binaries for deployment server
	#jira UEMOB-332

Change 4353925 by Jack.Porter

	Merging //UE4/Dev-Main to Dev-Mobile (//UE4/Dev-Mobile)
	Rework PR 4912 from CL 4280211

	#jira UE-62290

Change 4354034 by Jack.Porter

	Rebuilt deployment server after backing out changes

	#jira UE-63826

Change 4354338 by Ben.Marsh

	Attempted fix for incorrect certificate errors when compiling remotely.

	* Overloaded meaning of the -Certificate argument (ie. as the output path rather than as the desired certificate when selecting a provision) was causing certificate name check to fail. Now uses a different parameter to specify the output path.
	* TVOS argument was not being passed when exporting the certificate, also causing the wrong provision/certificate pair to be selected.
	* Add support for the -bundlename argument, though it shouldn't be necessary when invoked from UBT since the UUID discovered in a previous invocation of IPP is explicitly specified.

	Since the provision UUID is already being specified to IPP, it should be able to identify the correct provision on phase -1 using this info.

	#jira UE-63859

Change 4354459 by Chris.Babcock

	Fix issue with Android PCH include files

	#jira UE-63909
	#ue4
	#android

Change 4255761 by Peter.Sauerbrei

	fix for space in manifest name
	#jira UE-63868

#ROBOMERGE-OWNER: jason.bestimt
#ROBOMERGE-SOURCE: CL 4356719 in //UE4/Main/...
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 4356730 by chris babcock in Dev-VR branch]
2018-09-10 21:28:08 -04:00

1463 lines
76 KiB
C#

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Linq;
using System.Linq;
using System.Text;
using Tools.DotNETCommon;
namespace UnrealBuildTool
{
/// <summary>
/// Info needed to make a file a member of specific group
/// </summary>
class XcodeSourceFile : ProjectFile.SourceFile
{
/// <summary>
/// Constructor
/// </summary>
public XcodeSourceFile(FileReference InitFilePath, DirectoryReference InitRelativeBaseFolder)
: base(InitFilePath, InitRelativeBaseFolder)
{
FileGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
FileRefGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
}
/// <summary>
/// File Guid for use in Xcode project
/// </summary>
public string FileGuid
{
get;
private set;
}
public void ReplaceGuids(string NewFileGuid, string NewFileRefGuid)
{
FileGuid = NewFileGuid;
FileRefGuid = NewFileRefGuid;
}
/// <summary>
/// File reference Guid for use in Xcode project
/// </summary>
public string FileRefGuid
{
get;
private set;
}
}
/// <summary>
/// Represents a group of files shown in Xcode's project navigator as a folder
/// </summary>
class XcodeFileGroup
{
public XcodeFileGroup(string InName, string InPath, bool InIsReference = false)
{
GroupName = InName;
GroupPath = InPath;
GroupGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
bIsReference = InIsReference;
}
public string GroupGuid;
public string GroupName;
public string GroupPath;
public Dictionary<string, XcodeFileGroup> Children = new Dictionary<string, XcodeFileGroup>();
public List<XcodeSourceFile> Files = new List<XcodeSourceFile>();
public bool bIsReference;
}
class XcodeProjectFile : ProjectFile
{
FileReference OnlyGameProject;
Dictionary<string, XcodeFileGroup> Groups = new Dictionary<string, XcodeFileGroup>();
/// <summary>
/// Constructs a new project file object
/// </summary>
/// <param name="InitFilePath">The path to the project file on disk</param>
/// <param name="InOnlyGameProject"></param>
public XcodeProjectFile(FileReference InitFilePath, FileReference InOnlyGameProject)
: base(InitFilePath)
{
OnlyGameProject = InOnlyGameProject;
}
public override string ToString()
{
return ProjectFilePath.GetFileNameWithoutExtension();
}
/// <summary>
/// Gets Xcode file category based on its extension
/// </summary>
private string GetFileCategory(string Extension)
{
// @todo Mac: Handle more categories
switch (Extension)
{
case ".framework":
return "Frameworks";
default:
return "Sources";
}
}
/// <summary>
/// Gets Xcode file type based on its extension
/// </summary>
private string GetFileType(string Extension)
{
// @todo Mac: Handle more file types
switch (Extension)
{
case ".c":
case ".m":
return "sourcecode.c.objc";
case ".cc":
case ".cpp":
case ".mm":
return "sourcecode.cpp.objcpp";
case ".h":
case ".inl":
case ".pch":
return "sourcecode.c.h";
case ".framework":
return "wrapper.framework";
case ".plist":
return "text.plist.xml";
case ".png":
return "image.png";
case ".icns":
return "image.icns";
default:
return "file.text";
}
}
/// <summary>
/// Returns true if Extension is a known extension for files containing source code
/// </summary>
private bool IsSourceCode(string Extension)
{
return Extension == ".c" || Extension == ".cc" || Extension == ".cpp" || Extension == ".m" || Extension == ".mm";
}
private bool ShouldIncludeFileInBuildPhaseSection(XcodeSourceFile SourceFile)
{
string FileExtension = SourceFile.Reference.GetExtension();
if (IsSourceCode(FileExtension))
{
foreach (string PlatformName in Enum.GetNames(typeof(UnrealTargetPlatform)))
{
string AltName = PlatformName == "Win32" || PlatformName == "Win64" ? "windows" : PlatformName.ToLower();
if ((SourceFile.Reference.FullName.ToLower().Contains("/" + PlatformName.ToLower() + "/") || SourceFile.Reference.FullName.ToLower().Contains("/" + AltName + "/"))
&& PlatformName != "Mac" && PlatformName != "IOS" && PlatformName != "TVOS")
{
// Build phase is used for indexing only and indexing currently works only with files that can be compiled for Mac, so skip files for other platforms
return false;
}
}
return true;
}
return false;
}
/// <summary>
/// Returns a project navigator group to which the file should belong based on its path.
/// Creates a group tree if it doesn't exist yet.
/// </summary>
public XcodeFileGroup FindGroupByAbsolutePath(ref Dictionary<string, XcodeFileGroup> Groups, string AbsolutePath)
{
string[] Parts = AbsolutePath.Split(Path.DirectorySeparatorChar);
string CurrentPath = "/";
Dictionary<string, XcodeFileGroup> CurrentSubGroups = Groups;
for (int Index = 1; Index < Parts.Count(); ++Index)
{
string Part = Parts[Index];
if (CurrentPath.Length > 1)
{
CurrentPath += Path.DirectorySeparatorChar;
}
CurrentPath += Part;
XcodeFileGroup CurrentGroup;
if (!CurrentSubGroups.ContainsKey(CurrentPath))
{
CurrentGroup = new XcodeFileGroup(Path.GetFileName(CurrentPath), CurrentPath);
CurrentSubGroups.Add(CurrentPath, CurrentGroup);
}
else
{
CurrentGroup = CurrentSubGroups[CurrentPath];
}
if (CurrentPath == AbsolutePath)
{
return CurrentGroup;
}
CurrentSubGroups = CurrentGroup.Children;
}
return null;
}
/// <summary>
/// Convert all paths to Apple/Unix format (with forward slashes)
/// </summary>
/// <param name="InPath">The path to convert</param>
/// <returns>The normalized path</returns>
private static string ConvertPath(string InPath)
{
return InPath.Replace("\\", "/");
}
/// <summary>
/// Allocates a generator-specific source file object
/// </summary>
/// <param name="InitFilePath">Path to the source file on disk</param>
/// <param name="InitProjectSubFolder">Optional sub-folder to put the file in. If empty, this will be determined automatically from the file's path relative to the project file</param>
/// <returns>The newly allocated source file object</returns>
public override SourceFile AllocSourceFile(FileReference InitFilePath, DirectoryReference InitProjectSubFolder)
{
if (InitFilePath.GetFileName().StartsWith("."))
{
return null;
}
return new XcodeSourceFile(InitFilePath, InitProjectSubFolder);
}
/// <summary>
/// Generates bodies of all sections that contain a list of source files plus a dictionary of project navigator groups.
/// </summary>
private void GenerateSectionsWithSourceFiles(StringBuilder PBXBuildFileSection, StringBuilder PBXFileReferenceSection, StringBuilder PBXSourcesBuildPhaseSection, string TargetAppGuid, string TargetName)
{
SourceFiles.Sort((x, y) => { return x.Reference.FullName.CompareTo(y.Reference.FullName); });
foreach (SourceFile CurSourceFile in SourceFiles)
{
XcodeSourceFile SourceFile = CurSourceFile as XcodeSourceFile;
string FileName = SourceFile.Reference.GetFileName();
string FileExtension = Path.GetExtension(FileName);
string FilePath = SourceFile.Reference.MakeRelativeTo(ProjectFilePath.Directory);
string FilePathMac = Utils.CleanDirectorySeparators(FilePath, '/');
if (IsGeneratedProject)
{
PBXBuildFileSection.Append(string.Format("\t\t{0} /* {1} in {2} */ = {{isa = PBXBuildFile; fileRef = {3} /* {1} */; }};" + ProjectFileGenerator.NewLine,
SourceFile.FileGuid,
FileName,
GetFileCategory(FileExtension),
SourceFile.FileRefGuid));
}
PBXFileReferenceSection.Append(string.Format("\t\t{0} /* {1} */ = {{isa = PBXFileReference; explicitFileType = {2}; name = \"{1}\"; path = \"{3}\"; sourceTree = SOURCE_ROOT; }};" + ProjectFileGenerator.NewLine,
SourceFile.FileRefGuid,
FileName,
GetFileType(FileExtension),
FilePathMac));
if (ShouldIncludeFileInBuildPhaseSection(SourceFile))
{
PBXSourcesBuildPhaseSection.Append("\t\t\t\t" + SourceFile.FileGuid + " /* " + FileName + " in Sources */," + ProjectFileGenerator.NewLine);
}
XcodeFileGroup Group = FindGroupByAbsolutePath(ref Groups, CurSourceFile.Reference.Directory.FullName);
if (Group != null)
{
Group.Files.Add(SourceFile);
}
}
PBXFileReferenceSection.Append(string.Format("\t\t{0} /* {1} */ = {{isa = PBXFileReference; explicitFileType = wrapper.application; path = {1}; sourceTree = BUILT_PRODUCTS_DIR; }};" + ProjectFileGenerator.NewLine, TargetAppGuid, TargetName));
}
private void AppendGroup(XcodeFileGroup Group, StringBuilder Content)
{
if (!Group.bIsReference)
{
Content.Append(string.Format("\t\t{0} = {{{1}", Group.GroupGuid, ProjectFileGenerator.NewLine));
Content.Append("\t\t\tisa = PBXGroup;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tchildren = (" + ProjectFileGenerator.NewLine);
foreach (XcodeFileGroup ChildGroup in Group.Children.Values)
{
Content.Append(string.Format("\t\t\t\t{0} /* {1} */,{2}", ChildGroup.GroupGuid, ChildGroup.GroupName, ProjectFileGenerator.NewLine));
}
foreach (XcodeSourceFile File in Group.Files)
{
Content.Append(string.Format("\t\t\t\t{0} /* {1} */,{2}", File.FileRefGuid, File.Reference.GetFileName(), ProjectFileGenerator.NewLine));
}
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + Group.GroupName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tpath = \"" + Group.GroupPath + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tsourceTree = \"<absolute>\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
foreach (XcodeFileGroup ChildGroup in Group.Children.Values)
{
AppendGroup(ChildGroup, Content);
}
}
}
private void AppendBuildFileSection(StringBuilder Content, StringBuilder SectionContent)
{
Content.Append("/* Begin PBXBuildFile section */" + ProjectFileGenerator.NewLine);
Content.Append(SectionContent);
Content.Append("/* End PBXBuildFile section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendFileReferenceSection(StringBuilder Content, StringBuilder SectionContent)
{
Content.Append("/* Begin PBXFileReference section */" + ProjectFileGenerator.NewLine);
Content.Append(SectionContent);
Content.Append("/* End PBXFileReference section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendSourcesBuildPhaseSection(StringBuilder Content, StringBuilder SectionContent, string SourcesBuildPhaseGuid)
{
Content.Append("/* Begin PBXSourcesBuildPhase section */" + ProjectFileGenerator.NewLine);
Content.Append(string.Format("\t\t{0} = {{{1}", SourcesBuildPhaseGuid, ProjectFileGenerator.NewLine));
Content.Append("\t\t\tisa = PBXSourcesBuildPhase;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildActionMask = 2147483647;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tfiles = (" + ProjectFileGenerator.NewLine);
Content.Append(SectionContent);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\trunOnlyForDeploymentPostprocessing = 0;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXSourcesBuildPhase section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private XcodeFileGroup FindRootFileGroup(Dictionary<string, XcodeFileGroup> GroupsDict)
{
foreach (XcodeFileGroup Group in GroupsDict.Values)
{
if (Group.Children.Count > 1 || Group.Files.Count > 0)
{
return Group;
}
else
{
XcodeFileGroup Found = FindRootFileGroup(Group.Children);
if (Found != null)
{
return Found;
}
}
}
return null;
}
private void AppendGroupSection(StringBuilder Content, string MainGroupGuid, string ProductRefGroupGuid, string TargetAppGuid, string TargetName)
{
XcodeFileGroup RootGroup = FindRootFileGroup(Groups);
if (RootGroup == null)
{
return;
}
Content.Append("/* Begin PBXGroup section */" + ProjectFileGenerator.NewLine);
// Main group
Content.Append(string.Format("\t\t{0} = {{{1}", MainGroupGuid, ProjectFileGenerator.NewLine));
Content.Append("\t\t\tisa = PBXGroup;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tchildren = (" + ProjectFileGenerator.NewLine);
foreach (XcodeFileGroup Group in RootGroup.Children.Values)
{
Content.Append(string.Format("\t\t\t\t{0} /* {1} */,{2}", Group.GroupGuid, Group.GroupName, ProjectFileGenerator.NewLine));
}
foreach (XcodeSourceFile File in RootGroup.Files)
{
Content.Append(string.Format("\t\t\t\t{0} /* {1} */,{2}", File.FileRefGuid, File.Reference.GetFileName(), ProjectFileGenerator.NewLine));
}
Content.Append(string.Format("\t\t\t\t{0} /* Products */,{1}", ProductRefGroupGuid, ProjectFileGenerator.NewLine));
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tsourceTree = \"<group>\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
// Sources groups
foreach (XcodeFileGroup Group in RootGroup.Children.Values)
{
AppendGroup(Group, Content);
}
// Products group
Content.Append(string.Format("\t\t{0} /* Products */ = {{{1}", ProductRefGroupGuid, ProjectFileGenerator.NewLine));
Content.Append("\t\t\tisa = PBXGroup;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tchildren = (" + ProjectFileGenerator.NewLine);
Content.Append(string.Format("\t\t\t\t{0} /* {1} */,{2}", TargetAppGuid, TargetName, ProjectFileGenerator.NewLine));
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = Products;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tsourceTree = \"<group>\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXGroup section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendLegacyTargetSection(StringBuilder Content, string TargetName, string TargetGuid, string TargetBuildConfigGuid, FileReference UProjectPath, bool bHasEditorConfiguration)
{
string UE4Dir = ConvertPath(Path.GetFullPath(Directory.GetCurrentDirectory() + "../../.."));
string BuildToolPath = UE4Dir + "/Engine/Build/BatchFiles/Mac/Build.sh";
Content.Append("/* Begin PBXLegacyTarget section */" + ProjectFileGenerator.NewLine);
Content.Append("\t\t" + TargetGuid + " /* " + TargetName + " */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = PBXLegacyTarget;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildArgumentsString = \"$(ACTION) $(UE_BUILD_TARGET_NAME) $(PLATFORM_NAME) $(UE_BUILD_TARGET_CONFIG)" + (UProjectPath == null ? "" : " \\\"" + UProjectPath.FullName + "\\\"") + (bHasEditorConfiguration ? " -buildscw" : "") + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildConfigurationList = " + TargetBuildConfigGuid + " /* Build configuration list for PBXLegacyTarget \"" + TargetName + "\" */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildPhases = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildToolPath = \"" + BuildToolPath + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildWorkingDirectory = \"" + UE4Dir + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tdependencies = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tpassBuildSettingsInEnvironment = 1;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductName = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXLegacyTarget section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendRunTargetSection(StringBuilder Content, string TargetName, string TargetGuid, string TargetBuildConfigGuid, string TargetDependencyGuid, string TargetAppGuid)
{
Content.Append("/* Begin PBXNativeTarget section */" + ProjectFileGenerator.NewLine);
Content.Append("\t\t" + TargetGuid + " /* " + TargetName + " */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = PBXNativeTarget;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildConfigurationList = " + TargetBuildConfigGuid + " /* Build configuration list for PBXNativeTarget \"" + TargetName + "\" */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildPhases = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tdependencies = (" + ProjectFileGenerator.NewLine);
if (!XcodeProjectFileGenerator.bGeneratingRunIOSProject && !XcodeProjectFileGenerator.bGeneratingRunTVOSProject)
{
Content.Append("\t\t\t\t" + TargetDependencyGuid + " /* PBXTargetDependency */," + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tpassBuildSettingsInEnvironment = 1;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductName = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductReference = \"" + TargetAppGuid + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductType = \"com.apple.product-type.application\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXNativeTarget section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendIndexTargetSection(StringBuilder Content, string TargetName, string TargetGuid, string TargetBuildConfigGuid, string SourcesBuildPhaseGuid)
{
Content.Append("/* Begin PBXNativeTarget section */" + ProjectFileGenerator.NewLine);
Content.Append("\t\t" + TargetGuid + " /* " + TargetName + " */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = PBXNativeTarget;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildConfigurationList = " + TargetBuildConfigGuid + " /* Build configuration list for PBXNativeTarget \"" + TargetName + "\" */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildPhases = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t" + SourcesBuildPhaseGuid + " /* Sources */," + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tdependencies = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tpassBuildSettingsInEnvironment = 1;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductName = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductType = \"com.apple.product-type.library.static\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXNativeTarget section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendProjectSection(StringBuilder Content, string TargetName, string TargetGuid, string BuildTargetName, string BuildTargetGuid, string IndexTargetName, string IndexTargetGuid, string MainGroupGuid, string ProductRefGroupGuid, string ProjectGuid, string ProjectBuildConfigGuid, FileReference ProjectFile)
{
Content.Append("/* Begin PBXProject section */" + ProjectFileGenerator.NewLine);
Content.Append("\t\t" + ProjectGuid + " /* Project object */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = PBXProject;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tattributes = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tLastUpgradeCheck = 2000;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tORGANIZATIONNAME = \"Epic Games, Inc.\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tTargetAttributes = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\t" + TargetGuid + " = {" + ProjectFileGenerator.NewLine);
bool bAutomaticSigning = false;
if (InstalledPlatformInfo.IsValidPlatform(UnrealTargetPlatform.IOS, EProjectType.Code))
{
IOSPlatform IOSPlatform = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.IOS));
IOSProjectSettings ProjectSettings = IOSPlatform.ReadProjectSettings(ProjectFile);
bAutomaticSigning = ProjectSettings.bAutomaticSigning;
}
if (InstalledPlatformInfo.IsValidPlatform(UnrealTargetPlatform.TVOS, EProjectType.Code))
{
TVOSPlatform TVOSPlatform = ((TVOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.TVOS));
TVOSProjectSettings ProjectSettings = TVOSPlatform.ReadProjectSettings(ProjectFile);
TVOSProvisioningData ProvisioningData = TVOSPlatform.ReadProvisioningData(ProjectSettings);
bAutomaticSigning = ProjectSettings.bAutomaticSigning;
}
if (bAutomaticSigning)
{
Content.Append("\t\t\t\t\t\tProvisioningStyle = Automatic;" + ProjectFileGenerator.NewLine);
}
else
{
Content.Append("\t\t\t\t\t\tProvisioningStyle = Manual;" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildConfigurationList = " + ProjectBuildConfigGuid + " /* Build configuration list for PBXProject \"" + TargetName + "\" */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tcompatibilityVersion = \"Xcode 8.0\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tdevelopmentRegion = English;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\thasScannedForEncodings = 0;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tknownRegions = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\ten" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tmainGroup = " + MainGroupGuid + ";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproductRefGroup = " + ProductRefGroupGuid + ";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tprojectDirPath = \"\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tprojectRoot = \"\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\ttargets = (" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t" + TargetGuid + " /* " + TargetName + " */," + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t" + BuildTargetGuid + " /* " + BuildTargetName + " */," + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t" + IndexTargetGuid + " /* " + IndexTargetName + " */," + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXProject section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendContainerItemProxySection(StringBuilder Content, string TargetName, string TargetGuid, string TargetProxyGuid, string ProjectGuid)
{
Content.Append("/* Begin PBXContainerItemProxy section */" + ProjectFileGenerator.NewLine);
Content.Append("\t\t" + TargetProxyGuid + " /* PBXContainerItemProxy */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = PBXContainerItemProxy;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tcontainerPortal = " + ProjectGuid + " /* Project object */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tproxyType = 1;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tremoteGlobalIDString = " + TargetGuid + ";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tremoteInfo = \"" + TargetName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXContainerItemProxy section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendTargetDependencySection(StringBuilder Content, string TargetName, string TargetGuid, string TargetDependencyGuid, string TargetProxyGuid)
{
Content.Append("/* Begin PBXTargetDependency section */" + ProjectFileGenerator.NewLine);
Content.Append("\t\t" + TargetDependencyGuid + " /* PBXTargetDependency */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = PBXTargetDependency;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\ttarget = " + TargetGuid + " /* " + TargetName + " */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\ttargetProxy = " + TargetProxyGuid + " /* PBXContainerItemProxy */;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("/* End PBXTargetDependency section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendProjectBuildConfiguration(StringBuilder Content, string ConfigName, string ConfigGuid)
{
Content.Append("\t\t" + ConfigGuid + " /* \"" + ConfigName + "\" */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = XCBuildConfiguration;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildSettings = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (" + ProjectFileGenerator.NewLine);
foreach (string Definition in IntelliSensePreprocessorDefinitions)
{
Content.Append("\t\t\t\t\t\"" + Definition.Replace("\"", "").Replace("\\", "") + "\"," + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\t\t\"__INTELLISENSE__\"," + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\t\"MONOLITHIC_BUILD=1\"," + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tHEADER_SEARCH_PATHS = (" + ProjectFileGenerator.NewLine);
foreach (string SearchPath in IntelliSenseSystemIncludeSearchPaths)
{
string Path = SearchPath.Contains(" ") ? "\\\"" + SearchPath + "\\\"" : SearchPath;
Content.Append("\t\t\t\t\t\"" + Path + "\"," + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tUSER_HEADER_SEARCH_PATHS = (" + ProjectFileGenerator.NewLine);
foreach (string SearchPath in IntelliSenseIncludeSearchPaths)
{
string Path = SearchPath.Contains(" ") ? "\\\"" + SearchPath + "\\\"" : SearchPath;
Content.Append("\t\t\t\t\t\"" + Path + "\"," + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\t);" + ProjectFileGenerator.NewLine);
if (ConfigName == "Debug")
{
Content.Append("\t\t\t\tONLY_ACTIVE_ARCH = YES;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tENABLE_TESTABILITY = YES;" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"c++14\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tGCC_ENABLE_CPP_RTTI = NO;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tGCC_WARN_CHECK_SWITCH_STATEMENTS = NO;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tUSE_HEADERMAP = NO;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + ConfigName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
}
private void AppendNativeTargetBuildConfiguration(StringBuilder Content, XcodeBuildConfig Config, string ConfigGuid, bool bIsAGame, FileReference ProjectFile)
{
bool bMacOnly = true;
if (Config.ProjectTarget.TargetRules != null && XcodeProjectFileGenerator.ProjectFilePlatform.HasFlag(XcodeProjectFileGenerator.XcodeProjectFilePlatform.iOS))
{
if (Config.ProjectTarget.SupportedPlatforms.Contains(UnrealTargetPlatform.IOS))
{
bMacOnly = false;
}
}
Content.Append("\t\t" + ConfigGuid + " /* \"" + Config.DisplayName + "\" */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = XCBuildConfiguration;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildSettings = {" + ProjectFileGenerator.NewLine);
string UE4Dir = ConvertPath(Path.GetFullPath(Directory.GetCurrentDirectory() + "../../.."));
string MacExecutableDir = ConvertPath(Config.MacExecutablePath.Directory.FullName);
string MacExecutableFileName = Config.MacExecutablePath.GetFileName();
if (bMacOnly)
{
Content.Append("\t\t\t\tVALID_ARCHS = \"x86_64\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tSUPPORTED_PLATFORMS = \"macosx\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tPRODUCT_NAME = \"" + MacExecutableFileName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tCONFIGURATION_BUILD_DIR = \"" + MacExecutableDir + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;" + ProjectFileGenerator.NewLine);
}
else
{
string IOSRunTimeVersion = null;
string IOSRunTimeDevices = null;
string TVOSRunTimeVersion = null;
string TVOSRunTimeDevices = null;
string ValidArchs = "x86_64";
string SupportedPlatforms = "macosx";
bool bAutomaticSigning = false;
string UUID_IOS = "";
string UUID_TVOS = "";
string TEAM_IOS = "";
string TEAM_TVOS = "";
string IOS_CERT = "iPhone Developer";
string TVOS_CERT = "iPhone Developer";
if (InstalledPlatformInfo.IsValidPlatform(UnrealTargetPlatform.IOS, EProjectType.Code))
{
IOSPlatform IOSPlatform = ((IOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.IOS));
IOSProjectSettings ProjectSettings = IOSPlatform.ReadProjectSettings(ProjectFile);
IOSProvisioningData ProvisioningData = IOSPlatform.ReadProvisioningData(ProjectSettings);
IOSRunTimeVersion = ProjectSettings.RuntimeVersion;
IOSRunTimeDevices = ProjectSettings.RuntimeDevices;
ValidArchs += " arm64 armv7 armv7s";
SupportedPlatforms += " iphoneos";
bAutomaticSigning = ProjectSettings.bAutomaticSigning;
if (!bAutomaticSigning)
{
UUID_IOS = ProvisioningData.MobileProvisionUUID;
IOS_CERT = ProvisioningData.SigningCertificate;
}
TEAM_IOS = ProvisioningData.TeamUUID;
}
if (InstalledPlatformInfo.IsValidPlatform(UnrealTargetPlatform.TVOS, EProjectType.Code))
{
TVOSPlatform TVOSPlatform = ((TVOSPlatform)UEBuildPlatform.GetBuildPlatform(UnrealTargetPlatform.TVOS));
TVOSProjectSettings ProjectSettings = TVOSPlatform.ReadProjectSettings(ProjectFile);
TVOSProvisioningData ProvisioningData = TVOSPlatform.ReadProvisioningData(ProjectSettings);
TVOSRunTimeVersion = ProjectSettings.RuntimeVersion;
TVOSRunTimeDevices = ProjectSettings.RuntimeDevices;
if (ValidArchs == "x86_64")
{
ValidArchs += " arm64 armv7 armv7s";
}
SupportedPlatforms += " appletvos";
if (!bAutomaticSigning)
{
UUID_TVOS = ProvisioningData.MobileProvisionUUID;
TVOS_CERT = ProvisioningData.SigningCertificate;
}
TEAM_TVOS = ProvisioningData.TeamUUID;
}
Content.Append("\t\t\t\tVALID_ARCHS = \"" + ValidArchs + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tSUPPORTED_PLATFORMS = \"" + SupportedPlatforms + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"PRODUCT_NAME[sdk=macosx*]\" = \"" + MacExecutableFileName + "\";" + ProjectFileGenerator.NewLine);
if (IOSRunTimeVersion != null)
{
Content.Append("\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = " + IOSRunTimeVersion + ";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"PRODUCT_NAME[sdk=iphoneos*]\" = \"" + Config.BuildTarget + "\";" + ProjectFileGenerator.NewLine); // @todo: change to Path.GetFileName(Config.IOSExecutablePath) when we stop using payload
Content.Append("\t\t\t\t\"TARGETED_DEVICE_FAMILY[sdk=iphoneos*]\" = \"" + IOSRunTimeDevices + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"SDKROOT[sdk=iphoneos]\" = iphoneos;" + ProjectFileGenerator.NewLine);
if (!string.IsNullOrEmpty(TEAM_IOS))
{
Content.Append("\t\t\t\t\"DEVELOPMENT_TEAM[sdk=iphoneos*]\" = " + TEAM_IOS + ";" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"" + IOS_CERT + "\";" + ProjectFileGenerator.NewLine);
if (!bAutomaticSigning && !string.IsNullOrEmpty(UUID_IOS))
{
Content.Append("\t\t\t\t\"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]\" = \"" + UUID_IOS + "\";" + ProjectFileGenerator.NewLine);
}
}
if (TVOSRunTimeVersion != null)
{
Content.Append("\t\t\t\tTVOS_DEPLOYMENT_TARGET = " + TVOSRunTimeVersion + ";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"PRODUCT_NAME[sdk=appletvos*]\" = \"" + Config.BuildTarget + "\";" + ProjectFileGenerator.NewLine); // @todo: change to Path.GetFileName(Config.TVOSExecutablePath) when we stop using payload
Content.Append("\t\t\t\t\"TARGETED_DEVICE_FAMILY[sdk=appletvos*]\" = \"" + TVOSRunTimeDevices + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"SDKROOT[sdk=appletvos]\" = appletvos;" + ProjectFileGenerator.NewLine);
if (!string.IsNullOrEmpty(TEAM_TVOS))
{
Content.Append("\t\t\t\t\"DEVELOPMENT_TEAM[sdk=appletvos*]\" = " + TEAM_TVOS + ";" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=appletvos*]\" = \"" + TVOS_CERT + "\";" + ProjectFileGenerator.NewLine);
if (!bAutomaticSigning && !string.IsNullOrEmpty(UUID_TVOS))
{
Content.Append("\t\t\t\t\"PROVISIONING_PROFILE_SPECIFIER[sdk=appletvos*]\" = \"" + UUID_TVOS + "\";" + ProjectFileGenerator.NewLine);
}
}
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=macosx*]\" = \"" + MacExecutableDir + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"SDKROOT[sdk=macosx]\" = macosx;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tINFOPLIST_OUTPUT_FORMAT = xml;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tCOMBINE_HIDPI_IMAGES = YES;" + ProjectFileGenerator.NewLine);
bool bIsUE4Game = Config.BuildTarget.Equals("UE4Game", StringComparison.InvariantCultureIgnoreCase);
bool bIsUE4Client = Config.BuildTarget.Equals("UE4Client", StringComparison.InvariantCultureIgnoreCase);
DirectoryReference GameDir = ProjectFile != null ? ProjectFile.Directory : null;
string GamePath = GameDir != null ? ConvertPath(GameDir.FullName) : null;
string IOSInfoPlistPath = null;
string TVOSInfoPlistPath = null;
string MacInfoPlistPath = null;
string IOSEntitlementPath = null;
if (bIsUE4Game)
{
IOSInfoPlistPath = UE4Dir + "/Engine/Intermediate/IOS/" + Config.BuildTarget + "-Info.plist";
TVOSInfoPlistPath = UE4Dir + "/Engine/Intermediate/TVOS/" + Config.BuildTarget + "-Info.plist";
MacInfoPlistPath = UE4Dir + "/Engine/Intermediate/Mac/" + MacExecutableFileName + "-Info.plist";
IOSEntitlementPath = "";
if (IOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=iphoneos*]\" = \"" + UE4Dir + "/Engine/Binaries/IOS/Payload\";" + ProjectFileGenerator.NewLine);
}
if (TVOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=appletvos*]\" = \"" + UE4Dir + "/Engine/Binaries/TVOS/Payload\";" + ProjectFileGenerator.NewLine);
}
}
else if (bIsUE4Client)
{
IOSInfoPlistPath = UE4Dir + "/Engine/Intermediate/IOS/UE4Game-Info.plist";
TVOSInfoPlistPath = UE4Dir + "/Engine/Intermediate/TVOS/UE4Game-Info.plist";
MacInfoPlistPath = UE4Dir + "/Engine/Intermediate/Mac/" + MacExecutableFileName + "-Info.plist";
IOSEntitlementPath = "";
if (IOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=iphoneos*]\" = \"" + UE4Dir + "/Engine/Binaries/IOS/Payload\";" + ProjectFileGenerator.NewLine);
}
if (TVOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=appletvos*]\" = \"" + UE4Dir + "/Engine/Binaries/TVOS/Payload\";" + ProjectFileGenerator.NewLine);
}
}
else if (bIsAGame)
{
IOSInfoPlistPath = GamePath + "/Intermediate/IOS/" + Config.BuildTarget + "-Info.plist";
TVOSInfoPlistPath = GamePath + "/Intermediate/TVOS/" + Config.BuildTarget + "-Info.plist";
MacInfoPlistPath = GamePath + "/Intermediate/Mac/" + MacExecutableFileName + "-Info.plist";
IOSEntitlementPath = GamePath + "/Intermediate/IOS/" + Config.BuildTarget + ".entitlements";
if (IOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=iphoneos*]\" = \"" + GamePath + "/Binaries/IOS/Payload\";" + ProjectFileGenerator.NewLine);
}
if (TVOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=appletvos*]\" = \"" + GamePath + "/Binaries/TVOS/Payload\";" + ProjectFileGenerator.NewLine);
}
}
else
{
if (GamePath == null)
{
IOSInfoPlistPath = UE4Dir + "/Engine/Intermediate/IOS/" + Config.BuildTarget + "-Info.plist";
TVOSInfoPlistPath = UE4Dir + "/Engine/Intermediate/TVOS/" + Config.BuildTarget + "-Info.plist";
MacInfoPlistPath = UE4Dir + "/Engine/Intermediate/Mac/" + MacExecutableFileName + "-Info.plist";
}
else
{
IOSInfoPlistPath = GamePath + "/Intermediate/IOS/" + Config.BuildTarget + "-Info.plist";
TVOSInfoPlistPath = GamePath + "/Intermediate/TVOS/" + Config.BuildTarget + "-Info.plist";
MacInfoPlistPath = GamePath + "/Intermediate/Mac/" + MacExecutableFileName + "-Info.plist";
}
if (IOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=iphoneos*]\" = \"" + UE4Dir + "/Engine/Binaries/IOS/Payload\";" + ProjectFileGenerator.NewLine);
}
if (TVOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"CONFIGURATION_BUILD_DIR[sdk=appletvos*]\" = \"" + UE4Dir + "/Engine/Binaries/TVOS/Payload\";" + ProjectFileGenerator.NewLine);
}
}
if (XcodeProjectFileGenerator.bGeneratingRunIOSProject)
{
Content.Append("\t\t\t\tINFOPLIST_FILE = \"" + IOSInfoPlistPath + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tCODE_SIGN_ENTITLEMENTS = \"" + IOSEntitlementPath + "\";" + ProjectFileGenerator.NewLine);
}
else if (XcodeProjectFileGenerator.bGeneratingRunTVOSProject)
{
Content.Append("\t\t\t\tINFOPLIST_FILE = \"" + TVOSInfoPlistPath + "\";" + ProjectFileGenerator.NewLine);
}
else
{
Content.Append("\t\t\t\t\"INFOPLIST_FILE[sdk=macosx*]\" = \"" + MacInfoPlistPath + "\";" + ProjectFileGenerator.NewLine);
if (IOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"INFOPLIST_FILE[sdk=iphoneos*]\" = \"" + IOSInfoPlistPath + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\t\"CODE_SIGN_ENTITLEMENTS[sdk=iphoneos*]\" = \"" + IOSEntitlementPath + "\";" + ProjectFileGenerator.NewLine);
}
if (TVOSRunTimeVersion != null)
{
Content.Append("\t\t\t\t\"INFOPLIST_FILE[sdk=appletvos*]\" = \"" + TVOSInfoPlistPath + "\";" + ProjectFileGenerator.NewLine);
}
}
// Prepare a temp Info.plist file so Xcode has some basic info about the target immediately after opening the project.
// This is needed for the target to pass the settings validation before code signing. UBT will overwrite this plist file later, with proper contents.
if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Mac)
{
bool bCreateMacInfoPlist = !File.Exists(MacInfoPlistPath);
bool bCreateIOSInfoPlist = !File.Exists(IOSInfoPlistPath) && IOSRunTimeVersion != null;
bool bCreateTVOSInfoPlist = !File.Exists(TVOSInfoPlistPath) && TVOSRunTimeVersion != null;
if (bCreateMacInfoPlist || bCreateIOSInfoPlist || bCreateTVOSInfoPlist)
{
DirectoryReference ProjectPath = GameDir;
DirectoryReference EngineDir = DirectoryReference.Combine(new DirectoryReference(UE4Dir), "Engine");
string GameName = Config.BuildTarget;
if (ProjectPath == null)
{
ProjectPath = EngineDir;
}
if (bIsUE4Game)
{
ProjectPath = EngineDir;
GameName = "UE4Game";
}
if (bCreateMacInfoPlist)
{
Directory.CreateDirectory(Path.GetDirectoryName(MacInfoPlistPath));
UEDeployMac.GeneratePList(ProjectPath.FullName, bIsUE4Game, GameName, Config.BuildTarget, EngineDir.FullName, MacExecutableFileName);
}
if (bCreateIOSInfoPlist)
{
// get the receipt
FileReference ReceiptFilename;
if (bIsUE4Game)
{
ReceiptFilename = TargetReceipt.GetDefaultPath(UnrealBuildTool.EngineDirectory, "UE4Game", UnrealTargetPlatform.IOS, Config.BuildConfig, "");
}
else
{
ReceiptFilename = TargetReceipt.GetDefaultPath(ProjectPath, GameName, UnrealTargetPlatform.IOS, Config.BuildConfig, "");
}
Directory.CreateDirectory(Path.GetDirectoryName(IOSInfoPlistPath));
bool bSupportPortrait, bSupportLandscape, bSkipIcons;
UEDeployIOS.GenerateIOSPList(ProjectFile, Config.BuildConfig, ProjectPath.FullName, bIsUE4Game, GameName, Config.BuildTarget, EngineDir.FullName, ProjectPath + "/Binaries/IOS/Payload", ReceiptFilename, out bSupportPortrait, out bSupportLandscape, out bSkipIcons);
}
if (bCreateTVOSInfoPlist)
{
Directory.CreateDirectory(Path.GetDirectoryName(TVOSInfoPlistPath));
UEDeployTVOS.GenerateTVOSPList(ProjectPath.FullName, bIsUE4Game, GameName, Config.BuildTarget, EngineDir.FullName, ProjectPath + "/Binaries/TVOS/Payload");
}
}
}
}
Content.Append("\t\t\t\tMACOSX_DEPLOYMENT_TARGET = " + MacToolChain.Settings.MacOSVersion + ";" + ProjectFileGenerator.NewLine);
//#jira UE-50382 Xcode Address Sanitizer feature does not work on iOS
// address sanitizer dylib loader depends on the SDKROOT parameter. For macosx or default (missing, translated as macosx), the path is incorrect for iphone/appletv
if (XcodeProjectFileGenerator.bGeneratingRunIOSProject)
{
Content.Append("\t\t\t\tSDKROOT = iphoneos;" + ProjectFileGenerator.NewLine);
}
else if (XcodeProjectFileGenerator.bGeneratingRunTVOSProject)
{
Content.Append("\t\t\t\tSDKROOT = appletvos;" + ProjectFileGenerator.NewLine);
}
else
{
Content.Append("\t\t\t\tSDKROOT = macosx;" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\tGCC_PRECOMPILE_PREFIX_HEADER = YES;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tGCC_PREFIX_HEADER = \"" + UE4Dir + "/Engine/Source/Editor/UnrealEd/Public/UnrealEd.h\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + Config.DisplayName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
}
private void AppendLegacyTargetBuildConfiguration(StringBuilder Content, XcodeBuildConfig Config, string ConfigGuid)
{
bool bMacOnly = true;
if (Config.ProjectTarget.TargetRules != null && XcodeProjectFileGenerator.ProjectFilePlatform.HasFlag(XcodeProjectFileGenerator.XcodeProjectFilePlatform.iOS))
{
if (Config.ProjectTarget.SupportedPlatforms.Contains(UnrealTargetPlatform.IOS))
{
bMacOnly = false;
}
}
Content.Append("\t\t" + ConfigGuid + " /* \"" + Config.DisplayName + "\" */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = XCBuildConfiguration;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildSettings = {" + ProjectFileGenerator.NewLine);
if (bMacOnly)
{
Content.Append("\t\t\t\tVALID_ARCHS = \"x86_64\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tSUPPORTED_PLATFORMS = \"macosx\";" + ProjectFileGenerator.NewLine);
}
else
{
string ValidArchs = "x86_64";
string SupportedPlatforms = "macosx";
if (InstalledPlatformInfo.IsValidPlatform(UnrealTargetPlatform.IOS, EProjectType.Code))
{
ValidArchs += " arm64 armv7 armv7s";
SupportedPlatforms += " iphoneos";
}
if (InstalledPlatformInfo.IsValidPlatform(UnrealTargetPlatform.TVOS, EProjectType.Code))
{
if (ValidArchs == "x86_64")
{
ValidArchs += " arm64 armv7 armv7s";
}
SupportedPlatforms += " appletvos";
}
Content.Append("\t\t\t\tVALID_ARCHS = \"" + ValidArchs + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tSUPPORTED_PLATFORMS = \"" + SupportedPlatforms + "\";" + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t\tUE_BUILD_TARGET_NAME = \"" + Config.BuildTarget + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t\tUE_BUILD_TARGET_CONFIG = \"" + Config.BuildConfig + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t};" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tname = \"" + Config.DisplayName + "\";" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
}
private void AppendXCBuildConfigurationSection(StringBuilder Content, Dictionary<string, XcodeBuildConfig> ProjectBuildConfigs, Dictionary<string, XcodeBuildConfig> TargetBuildConfigs,
Dictionary<string, XcodeBuildConfig> BuildTargetBuildConfigs, Dictionary<string, XcodeBuildConfig> IndexTargetBuildConfigs, bool bIsAGame, FileReference GameProjectPath)
{
Content.Append("/* Begin XCBuildConfiguration section */" + ProjectFileGenerator.NewLine);
foreach (KeyValuePair<string, XcodeBuildConfig> Config in ProjectBuildConfigs)
{
AppendProjectBuildConfiguration(Content, Config.Value.DisplayName, Config.Key);
}
foreach (KeyValuePair<string, XcodeBuildConfig> Config in TargetBuildConfigs)
{
AppendNativeTargetBuildConfiguration(Content, Config.Value, Config.Key, bIsAGame, GameProjectPath);
}
foreach (KeyValuePair<string, XcodeBuildConfig> Config in BuildTargetBuildConfigs)
{
AppendLegacyTargetBuildConfiguration(Content, Config.Value, Config.Key);
}
foreach (KeyValuePair<string, XcodeBuildConfig> Config in IndexTargetBuildConfigs)
{
AppendNativeTargetBuildConfiguration(Content, Config.Value, Config.Key, bIsAGame, GameProjectPath);
}
Content.Append("/* End XCBuildConfiguration section */" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
}
private void AppendXCConfigurationList(StringBuilder Content, string TypeName, string TargetName, string ConfigListGuid, Dictionary<string, XcodeBuildConfig> BuildConfigs)
{
Content.Append("\t\t" + ConfigListGuid + " /* Build configuration list for " + TypeName + " \"" + TargetName + "\" */ = {" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tisa = XCConfigurationList;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tbuildConfigurations = (" + ProjectFileGenerator.NewLine);
foreach (KeyValuePair<string, XcodeBuildConfig> Config in BuildConfigs)
{
Content.Append("\t\t\t\t" + Config.Key + " /* \"" + Config.Value.DisplayName + "\" */," + ProjectFileGenerator.NewLine);
}
Content.Append("\t\t\t);" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tdefaultConfigurationIsVisible = 0;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\tdefaultConfigurationName = Development;" + ProjectFileGenerator.NewLine);
Content.Append("\t\t};" + ProjectFileGenerator.NewLine);
}
private void AppendXCConfigurationListSection(StringBuilder Content, string TargetName, string BuildTargetName, string IndexTargetName, string ProjectConfigListGuid,
Dictionary<string, XcodeBuildConfig> ProjectBuildConfigs, string TargetConfigListGuid, Dictionary<string, XcodeBuildConfig> TargetBuildConfigs,
string BuildTargetConfigListGuid, Dictionary<string, XcodeBuildConfig> BuildTargetBuildConfigs,
string IndexTargetConfigListGuid, Dictionary<string, XcodeBuildConfig> IndexTargetBuildConfigs)
{
Content.Append("/* Begin XCConfigurationList section */" + ProjectFileGenerator.NewLine);
AppendXCConfigurationList(Content, "PBXProject", TargetName, ProjectConfigListGuid, ProjectBuildConfigs);
AppendXCConfigurationList(Content, "PBXLegacyTarget", BuildTargetName, BuildTargetConfigListGuid, BuildTargetBuildConfigs);
AppendXCConfigurationList(Content, "PBXNativeTarget", TargetName, TargetConfigListGuid, TargetBuildConfigs);
AppendXCConfigurationList(Content, "PBXNativeTarget", IndexTargetName, IndexTargetConfigListGuid, IndexTargetBuildConfigs);
Content.Append("/* End XCConfigurationList section */" + ProjectFileGenerator.NewLine);
}
public struct XcodeBuildConfig
{
public XcodeBuildConfig(string InDisplayName, string InBuildTarget, FileReference InMacExecutablePath, FileReference InIOSExecutablePath, FileReference InTVOSExecutablePath,
ProjectTarget InProjectTarget, UnrealTargetConfiguration InBuildConfig)
{
DisplayName = InDisplayName;
MacExecutablePath = InMacExecutablePath;
IOSExecutablePath = InIOSExecutablePath;
TVOSExecutablePath = InTVOSExecutablePath;
BuildTarget = InBuildTarget;
ProjectTarget = InProjectTarget;
BuildConfig = InBuildConfig;
}
public string DisplayName;
public FileReference MacExecutablePath;
public FileReference IOSExecutablePath;
public FileReference TVOSExecutablePath;
public string BuildTarget;
public ProjectTarget ProjectTarget;
public UnrealTargetConfiguration BuildConfig;
};
private List<XcodeBuildConfig> GetSupportedBuildConfigs(List<UnrealTargetPlatform> Platforms, List<UnrealTargetConfiguration> Configurations)
{
List<XcodeBuildConfig> BuildConfigs = new List<XcodeBuildConfig>();
string ProjectName = ProjectFilePath.GetFileNameWithoutExtension();
foreach (UnrealTargetConfiguration Configuration in Configurations)
{
if (InstalledPlatformInfo.IsValidConfiguration(Configuration, EProjectType.Code))
{
foreach (UnrealTargetPlatform Platform in Platforms)
{
if (InstalledPlatformInfo.IsValidPlatform(Platform, EProjectType.Code) && (Platform == UnrealTargetPlatform.Mac || Platform == UnrealTargetPlatform.IOS)) // @todo support other platforms
{
UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform, true);
if ((BuildPlatform != null) && (BuildPlatform.HasRequiredSDKsInstalled() == SDKStatus.Valid))
{
// Now go through all of the target types for this project
if (ProjectTargets.Count == 0)
{
throw new BuildException("Expecting at least one ProjectTarget to be associated with project '{0}' in the TargetProjects list ", ProjectFilePath);
}
foreach (ProjectTarget ProjectTarget in ProjectTargets)
{
if (MSBuildProjectFile.IsValidProjectPlatformAndConfiguration(ProjectTarget, Platform, Configuration))
{
// Figure out if this is a monolithic build
bool bShouldCompileMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(Platform);
bShouldCompileMonolithic |= (ProjectTarget.CreateRulesDelegate(Platform, Configuration).LinkType == TargetLinkType.Monolithic);
string ConfigName = Configuration.ToString();
if (ProjectTarget.TargetRules.Type != TargetType.Game && ProjectTarget.TargetRules.Type != TargetType.Program)
{
ConfigName += " " + ProjectTarget.TargetRules.Type.ToString();
}
if (BuildConfigs.Where(Config => Config.DisplayName == ConfigName).ToList().Count == 0)
{
string TargetName = ProjectTarget.TargetFilePath.GetFileNameWithoutAnyExtensions();
// Get the output directory
DirectoryReference RootDirectory = UnrealBuildTool.EngineDirectory;
if ((ProjectTarget.TargetRules.Type == TargetType.Game || ProjectTarget.TargetRules.Type == TargetType.Client || ProjectTarget.TargetRules.Type == TargetType.Server) && bShouldCompileMonolithic)
{
if(ProjectTarget.UnrealProjectFilePath != null)
{
RootDirectory = ProjectTarget.UnrealProjectFilePath.Directory;
}
}
if(ProjectTarget.TargetRules.Type == TargetType.Program && ProjectTarget.UnrealProjectFilePath != null)
{
RootDirectory = ProjectTarget.UnrealProjectFilePath.Directory;
}
// Get the output directory
DirectoryReference OutputDirectory = DirectoryReference.Combine(RootDirectory, "Binaries");
string ExeName = TargetName;
if (!bShouldCompileMonolithic && ProjectTarget.TargetRules.Type != TargetType.Program)
{
// Figure out what the compiled binary will be called so that we can point the IDE to the correct file
if (ProjectTarget.TargetRules.Type != TargetType.Game)
{
ExeName = "UE4" + ProjectTarget.TargetRules.Type.ToString();
}
}
if (BuildPlatform.Platform == UnrealTargetPlatform.Mac)
{
string MacExecutableName = MakeExecutableFileName(ExeName, UnrealTargetPlatform.Mac, Configuration, ProjectTarget.TargetRules.Architecture, ProjectTarget.TargetRules.UndecoratedConfiguration);
string IOSExecutableName = MacExecutableName.Replace("-Mac-", "-IOS-");
string TVOSExecutableName = MacExecutableName.Replace("-Mac-", "-TVOS-");
BuildConfigs.Add(new XcodeBuildConfig(ConfigName, TargetName, FileReference.Combine(OutputDirectory, "Mac", MacExecutableName), FileReference.Combine(OutputDirectory, "IOS", IOSExecutableName), FileReference.Combine(OutputDirectory, "TVOS", TVOSExecutableName), ProjectTarget, Configuration));
}
else if (BuildPlatform.Platform == UnrealTargetPlatform.IOS)
{
string IOSExecutableName = MakeExecutableFileName(ExeName, UnrealTargetPlatform.IOS, Configuration, ProjectTarget.TargetRules.Architecture, ProjectTarget.TargetRules.UndecoratedConfiguration);
string TVOSExecutableName = IOSExecutableName.Replace("-IOS-", "-TVOS-");
string MacExecutableName = IOSExecutableName.Replace("-IOS-", "-Mac-");
BuildConfigs.Add(new XcodeBuildConfig(ConfigName, TargetName, FileReference.Combine(OutputDirectory, "Mac", IOSExecutableName), FileReference.Combine(OutputDirectory, "IOS", IOSExecutableName), FileReference.Combine(OutputDirectory, "TVOS", TVOSExecutableName), ProjectTarget, Configuration));
}
}
}
}
}
}
}
}
}
return BuildConfigs;
}
private static string MakeExecutableFileName(string BinaryName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string Architecture, UnrealTargetConfiguration UndecoratedConfiguration)
{
StringBuilder Result = new StringBuilder();
Result.Append(BinaryName);
if (Configuration != UndecoratedConfiguration)
{
Result.AppendFormat("-{0}-{1}", Platform.ToString(), Configuration.ToString());
}
UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);
if(BuildPlatform.RequiresArchitectureSuffix())
{
Result.Append(Architecture);
}
return Result.ToString();
}
private void WriteSchemeFile(string TargetName, string TargetGuid, string BuildTargetGuid, string IndexTargetGuid, bool bHasEditorConfiguration, string GameProjectPath)
{
DirectoryReference SchemesDir = new DirectoryReference(ProjectFilePath.FullName + "/xcshareddata/xcschemes");
if (!DirectoryReference.Exists(SchemesDir))
{
DirectoryReference.CreateDirectory(SchemesDir);
}
string SchemeFilePath = SchemesDir + "/" + TargetName + ".xcscheme";
string OldCommandLineArguments = null;
if (File.Exists(SchemeFilePath))
{
string OldContents = File.ReadAllText(SchemeFilePath);
int OldCommandLineArgumentsStart = OldContents.IndexOf("<CommandLineArguments>") + "<CommandLineArguments>".Length;
int OldCommandLineArgumentsEnd = OldContents.IndexOf("</CommandLineArguments>");
if (OldCommandLineArgumentsStart != -1 && OldCommandLineArgumentsEnd != -1)
{
OldCommandLineArguments = OldContents.Substring(OldCommandLineArgumentsStart, OldCommandLineArgumentsEnd - OldCommandLineArgumentsStart);
}
}
string DefaultConfiguration = bHasEditorConfiguration && !XcodeProjectFileGenerator.bGeneratingRunIOSProject && !XcodeProjectFileGenerator.bGeneratingRunTVOSProject ? "Development Editor" : "Development";
StringBuilder Content = new StringBuilder();
Content.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + ProjectFileGenerator.NewLine);
Content.Append("<Scheme" + ProjectFileGenerator.NewLine);
Content.Append(" LastUpgradeVersion = \"2000\"" + ProjectFileGenerator.NewLine);
Content.Append(" version = \"1.3\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildAction" + ProjectFileGenerator.NewLine);
Content.Append(" parallelizeBuildables = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" buildImplicitDependencies = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildActionEntries>" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildActionEntry" + ProjectFileGenerator.NewLine);
Content.Append(" buildForTesting = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" buildForRunning = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" buildForProfiling = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" buildForArchiving = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" buildForAnalyzing = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildableReference" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableIdentifier = \"primary\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintIdentifier = \"" + TargetGuid + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableName = \"" + TargetName + ".app\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintName = \"" + TargetName + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" ReferencedContainer = \"container:" + TargetName + ".xcodeproj\">" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildableReference>" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildActionEntry>" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildActionEntries>" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildAction>" + ProjectFileGenerator.NewLine);
Content.Append(" <TestAction" + ProjectFileGenerator.NewLine);
Content.Append(" buildConfiguration = \"" + DefaultConfiguration + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"" + ProjectFileGenerator.NewLine);
Content.Append(" selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"" + ProjectFileGenerator.NewLine);
Content.Append(" shouldUseLaunchSchemeArgsEnv = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" <Testables>" + ProjectFileGenerator.NewLine);
Content.Append(" </Testables>" + ProjectFileGenerator.NewLine);
Content.Append(" <MacroExpansion>" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildableReference" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableIdentifier = \"primary\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintIdentifier = \"" + TargetGuid + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableName = \"" + TargetName + ".app\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintName = \"" + TargetName + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" ReferencedContainer = \"container:" + TargetName + ".xcodeproj\">" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildableReference>" + ProjectFileGenerator.NewLine);
Content.Append(" </MacroExpansion>" + ProjectFileGenerator.NewLine);
Content.Append(" <AdditionalOptions>" + ProjectFileGenerator.NewLine);
Content.Append(" </AdditionalOptions>" + ProjectFileGenerator.NewLine);
Content.Append(" </TestAction>" + ProjectFileGenerator.NewLine);
Content.Append(" <LaunchAction" + ProjectFileGenerator.NewLine);
Content.Append(" buildConfiguration = \"" + DefaultConfiguration + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"" + ProjectFileGenerator.NewLine);
Content.Append(" selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"" + ProjectFileGenerator.NewLine);
Content.Append(" launchStyle = \"0\"" + ProjectFileGenerator.NewLine);
Content.Append(" useCustomWorkingDirectory = \"NO\"" + ProjectFileGenerator.NewLine);
Content.Append(" ignoresPersistentStateOnLaunch = \"NO\"" + ProjectFileGenerator.NewLine);
Content.Append(" debugDocumentVersioning = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" debugServiceExtension = \"internal\"" + ProjectFileGenerator.NewLine);
Content.Append(" allowLocationSimulation = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildableProductRunnable" + ProjectFileGenerator.NewLine);
Content.Append(" runnableDebuggingMode = \"0\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildableReference" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableIdentifier = \"primary\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintIdentifier = \"" + TargetGuid + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableName = \"" + TargetName + ".app\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintName = \"" + TargetName + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" ReferencedContainer = \"container:" + TargetName + ".xcodeproj\">" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildableReference>" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildableProductRunnable>" + ProjectFileGenerator.NewLine);
if (string.IsNullOrEmpty(OldCommandLineArguments))
{
if (bHasEditorConfiguration && TargetName != "UE4")
{
Content.Append(" <CommandLineArguments>" + ProjectFileGenerator.NewLine);
if (IsForeignProject)
{
Content.Append(" <CommandLineArgument" + ProjectFileGenerator.NewLine);
Content.Append(" argument = \"&quot;" + GameProjectPath + "&quot;\"" + ProjectFileGenerator.NewLine);
Content.Append(" isEnabled = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" </CommandLineArgument>" + ProjectFileGenerator.NewLine);
}
else
{
Content.Append(" <CommandLineArgument" + ProjectFileGenerator.NewLine);
Content.Append(" argument = \"" + TargetName + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" isEnabled = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" </CommandLineArgument>" + ProjectFileGenerator.NewLine);
}
// Always add a configuration argument
Content.Append(" <CommandLineArgument" + ProjectFileGenerator.NewLine);
Content.Append(" argument = \"-RunConfig=$(Configuration)\"" + ProjectFileGenerator.NewLine);
Content.Append(" isEnabled = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" </CommandLineArgument>" + ProjectFileGenerator.NewLine);
Content.Append(" </CommandLineArguments>" + ProjectFileGenerator.NewLine);
}
}
else
{
Content.Append(" <CommandLineArguments>" + OldCommandLineArguments + "</CommandLineArguments>");
}
Content.Append(" <AdditionalOptions>" + ProjectFileGenerator.NewLine);
Content.Append(" </AdditionalOptions>" + ProjectFileGenerator.NewLine);
Content.Append(" </LaunchAction>" + ProjectFileGenerator.NewLine);
Content.Append(" <ProfileAction" + ProjectFileGenerator.NewLine);
Content.Append(" buildConfiguration = \"" + DefaultConfiguration + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" shouldUseLaunchSchemeArgsEnv = \"YES\"" + ProjectFileGenerator.NewLine);
Content.Append(" savedToolIdentifier = \"\"" + ProjectFileGenerator.NewLine);
Content.Append(" useCustomWorkingDirectory = \"NO\"" + ProjectFileGenerator.NewLine);
Content.Append(" debugDocumentVersioning = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildableProductRunnable" + ProjectFileGenerator.NewLine);
Content.Append(" runnableDebuggingMode = \"0\">" + ProjectFileGenerator.NewLine);
Content.Append(" <BuildableReference" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableIdentifier = \"primary\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintIdentifier = \"" + TargetGuid + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" BuildableName = \"" + TargetName + ".app\"" + ProjectFileGenerator.NewLine);
Content.Append(" BlueprintName = \"" + TargetName + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" ReferencedContainer = \"container:" + TargetName + ".xcodeproj\">" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildableReference>" + ProjectFileGenerator.NewLine);
Content.Append(" </BuildableProductRunnable>" + ProjectFileGenerator.NewLine);
Content.Append(" </ProfileAction>" + ProjectFileGenerator.NewLine);
Content.Append(" <AnalyzeAction" + ProjectFileGenerator.NewLine);
Content.Append(" buildConfiguration = \"" + DefaultConfiguration + "\">" + ProjectFileGenerator.NewLine);
Content.Append(" </AnalyzeAction>" + ProjectFileGenerator.NewLine);
Content.Append(" <ArchiveAction" + ProjectFileGenerator.NewLine);
Content.Append(" buildConfiguration = \"" + DefaultConfiguration + "\"" + ProjectFileGenerator.NewLine);
Content.Append(" revealArchiveInOrganizer = \"YES\">" + ProjectFileGenerator.NewLine);
Content.Append(" </ArchiveAction>" + ProjectFileGenerator.NewLine);
Content.Append("</Scheme>" + ProjectFileGenerator.NewLine);
File.WriteAllText(SchemeFilePath, Content.ToString(), new UTF8Encoding());
Content.Clear();
Content.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + ProjectFileGenerator.NewLine);
Content.Append("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" + ProjectFileGenerator.NewLine);
Content.Append("<plist version=\"1.0\">" + ProjectFileGenerator.NewLine);
Content.Append("<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t<key>SchemeUserState</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<key>" + TargetName + ".xcscheme_^#shared#^_</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<key>orderHint</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<integer>1</integer>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t</dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t</dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t<key>SuppressBuildableAutocreation</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<key>" + TargetGuid + "</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<key>primary</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<true/>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t</dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<key>" + BuildTargetGuid + "</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<key>primary</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<true/>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t</dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<key>" + IndexTargetGuid + "</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t<dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<key>primary</key>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t\t<true/>" + ProjectFileGenerator.NewLine);
Content.Append("\t\t</dict>" + ProjectFileGenerator.NewLine);
Content.Append("\t</dict>" + ProjectFileGenerator.NewLine);
Content.Append("</dict>" + ProjectFileGenerator.NewLine);
Content.Append("</plist>" + ProjectFileGenerator.NewLine);
DirectoryReference ManagementFileDir = new DirectoryReference(ProjectFilePath.FullName + "/xcuserdata/" + Environment.UserName + ".xcuserdatad/xcschemes");
if (!DirectoryReference.Exists(ManagementFileDir))
{
DirectoryReference.CreateDirectory(ManagementFileDir);
}
string ManagementFilePath = ManagementFileDir + "/xcschememanagement.plist";
File.WriteAllText(ManagementFilePath, Content.ToString(), new UTF8Encoding());
}
/// Implements Project interface
public override bool WriteProjectFile(List<UnrealTargetPlatform> InPlatforms, List<UnrealTargetConfiguration> InConfigurations)
{
bool bSuccess = true;
string TargetName = ProjectFilePath.GetFileNameWithoutExtension();
string TargetGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string TargetConfigListGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string TargetDependencyGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string TargetProxyGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string TargetAppGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string BuildTargetName = TargetName + "_Build";
string BuildTargetGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string BuildTargetConfigListGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string IndexTargetName = TargetName + "_Index";
string IndexTargetGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string IndexTargetConfigListGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string ProjectGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string ProjectConfigListGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string MainGroupGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string ProductRefGroupGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
string SourcesBuildPhaseGuid = XcodeProjectFileGenerator.MakeXcodeGuid();
// Figure out all the desired configurations
List<XcodeBuildConfig> BuildConfigs = GetSupportedBuildConfigs(InPlatforms, InConfigurations);
if (BuildConfigs.Count == 0)
{
return true;
}
bool bIsAGame = false;
FileReference GameProjectPath = null;
foreach(ProjectTarget Target in ProjectTargets)
{
if(Target.UnrealProjectFilePath != null)
{
bIsAGame = true;
GameProjectPath = Target.UnrealProjectFilePath;
break;
}
}
bool bHasEditorConfiguration = false;
Dictionary<string, XcodeBuildConfig> ProjectBuildConfigs = new Dictionary<string, XcodeBuildConfig>();
Dictionary<string, XcodeBuildConfig> TargetBuildConfigs = new Dictionary<string, XcodeBuildConfig>();
Dictionary<string, XcodeBuildConfig> BuildTargetBuildConfigs = new Dictionary<string, XcodeBuildConfig>();
Dictionary<string, XcodeBuildConfig> IndexTargetBuildConfigs = new Dictionary<string, XcodeBuildConfig>();
foreach (XcodeBuildConfig Config in BuildConfigs)
{
ProjectBuildConfigs[XcodeProjectFileGenerator.MakeXcodeGuid()] = Config;
TargetBuildConfigs[XcodeProjectFileGenerator.MakeXcodeGuid()] = Config;
BuildTargetBuildConfigs[XcodeProjectFileGenerator.MakeXcodeGuid()] = Config;
IndexTargetBuildConfigs[XcodeProjectFileGenerator.MakeXcodeGuid()] = Config;
if (Config.ProjectTarget.TargetRules.Type == TargetType.Editor)
{
bHasEditorConfiguration = true;
}
}
StringBuilder PBXBuildFileSection = new StringBuilder();
StringBuilder PBXFileReferenceSection = new StringBuilder();
StringBuilder PBXSourcesBuildPhaseSection = new StringBuilder();
GenerateSectionsWithSourceFiles(PBXBuildFileSection, PBXFileReferenceSection, PBXSourcesBuildPhaseSection, TargetAppGuid, TargetName);
StringBuilder ProjectFileContent = new StringBuilder();
ProjectFileContent.Append("// !$*UTF8*$!" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("{" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("\tarchiveVersion = 1;" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("\tclasses = {" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("\t};" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("\tobjectVersion = 46;" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("\tobjects = {" + ProjectFileGenerator.NewLine + ProjectFileGenerator.NewLine);
AppendBuildFileSection(ProjectFileContent, PBXBuildFileSection);
AppendFileReferenceSection(ProjectFileContent, PBXFileReferenceSection);
AppendSourcesBuildPhaseSection(ProjectFileContent, PBXSourcesBuildPhaseSection, SourcesBuildPhaseGuid);
AppendContainerItemProxySection(ProjectFileContent, BuildTargetName, BuildTargetGuid, TargetProxyGuid, ProjectGuid);
if (!XcodeProjectFileGenerator.bGeneratingRunIOSProject)
{
AppendTargetDependencySection(ProjectFileContent, BuildTargetName, BuildTargetGuid, TargetDependencyGuid, TargetProxyGuid);
}
AppendGroupSection(ProjectFileContent, MainGroupGuid, ProductRefGroupGuid, TargetAppGuid, TargetName);
AppendLegacyTargetSection(ProjectFileContent, BuildTargetName, BuildTargetGuid, BuildTargetConfigListGuid, GameProjectPath, bHasEditorConfiguration);
AppendRunTargetSection(ProjectFileContent, TargetName, TargetGuid, TargetConfigListGuid, TargetDependencyGuid, TargetAppGuid);
AppendIndexTargetSection(ProjectFileContent, IndexTargetName, IndexTargetGuid, IndexTargetConfigListGuid, SourcesBuildPhaseGuid);
AppendProjectSection(ProjectFileContent, TargetName, TargetGuid, BuildTargetName, BuildTargetGuid, IndexTargetName, IndexTargetGuid, MainGroupGuid, ProductRefGroupGuid, ProjectGuid, ProjectConfigListGuid, GameProjectPath);
AppendXCBuildConfigurationSection(ProjectFileContent, ProjectBuildConfigs, TargetBuildConfigs, BuildTargetBuildConfigs, IndexTargetBuildConfigs, bIsAGame, GameProjectPath);
AppendXCConfigurationListSection(ProjectFileContent, TargetName, BuildTargetName, IndexTargetName, ProjectConfigListGuid, ProjectBuildConfigs,
TargetConfigListGuid, TargetBuildConfigs, BuildTargetConfigListGuid, BuildTargetBuildConfigs, IndexTargetConfigListGuid, IndexTargetBuildConfigs);
ProjectFileContent.Append("\t};" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("\trootObject = " + ProjectGuid + " /* Project object */;" + ProjectFileGenerator.NewLine);
ProjectFileContent.Append("}" + ProjectFileGenerator.NewLine);
if (bSuccess)
{
FileReference PBXProjFilePath = ProjectFilePath + "/project.pbxproj";
bSuccess = ProjectFileGenerator.WriteFileIfChanged(PBXProjFilePath.FullName, ProjectFileContent.ToString(), new UTF8Encoding());
}
if (bSuccess)
{
WriteSchemeFile(TargetName, TargetGuid, BuildTargetGuid, IndexTargetGuid, bHasEditorConfiguration, GameProjectPath != null ? GameProjectPath.FullName : "");
}
return bSuccess;
}
}
}