You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #lockdown Nick.Penwarden ========================== MAJOR FEATURES + CHANGES ========================== Change 3345860 on 2017/03/14 by Daniel.Lamb Fixed crash when building DLC #test Cook paragon. Change 3347324 on 2017/03/15 by Gil.Gribb UE4 - Removed old code relating to FAsyncArchive, FAsyncIOSubsystemBase and package level compression. The editor now uses the lowest levels on the new async IO scheme. Change 3347331 on 2017/03/15 by Robert.Manuszewski Fix for a crash caused by GC killing BP class (due to no strong references) but its CDO is being kept alive because it was in the same cluster as the class and was not marked as pending kill. #jira UE-42732 Change 3347371 on 2017/03/15 by Graeme.Thornton Fix for runtime asset cache not invalidating files with an outdated version number Change 3349161 on 2017/03/16 by Steve.Robb Generated UFUNCTION FNames no longer exported. Misc refactors of code generation. Change 3349167 on 2017/03/16 by Steve.Robb Unused TBoolConstant removed (the more general TIntegralConstant should be used instead). Change 3349274 on 2017/03/16 by Gil.Gribb UE4 - Fix loading a package that is already loaded. Change 3349534 on 2017/03/16 by Ben.Marsh UBT: Check that the SN-DBS service is running before attempting to use it. Change 3349612 on 2017/03/16 by Gil.Gribb UE4 - Increased estimate of summary size. Change 3350021 on 2017/03/16 by Gil.Gribb UE4 - Fixed crash in signature checks when mounting pak files. Change 3350052 on 2017/03/16 by Ben.Marsh Remove invalid characters from macro names before passing as macro values. Prevents compile errors for projects which have apostrophes in the name. Change 3350360 on 2017/03/16 by Ben.Marsh UAT: Fix non-threadsafe access of ExeToTimeInMs when spawning external processes. Change 3351670 on 2017/03/17 by Ben.Marsh UBT: Ignore all default libraries when creating import libs. Sometimes #pragma comment(lib, ...) directives can add force additional libraries onto the linker/librarian command line. We don't want or need these included when generating import libraries, but they can cause errors due to search paths not being able to find them. Change 3352289 on 2017/03/17 by Ben.Marsh Fix issues working with > 2GB archives caused by truncation of the return value from FArchive::Tell() down to 32-bits. Change 3352390 on 2017/03/17 by Ben.Marsh Remove unused/out of date binaries for CrashReporter. Change 3352392 on 2017/03/17 by Ben.Marsh Remove UnrealDocTool binaries. This is distributed through a Visual Studio plugin now. Change 3352410 on 2017/03/17 by Ben.Marsh Remove P4ChangeReporter. I don't believe this is used any more. Change 3352450 on 2017/03/17 by Ben.Marsh Disable including CrashReporter by default when packaging projects. This is only useful with a CrashReporter backend set up, which only usually applies to Epic internal projects. Change 3352455 on 2017/03/17 by Ben.Marsh Remove RegisterPII and TranslatedWordsCountEstimator executables. Don't believe these are used any more. Change 3352940 on 2017/03/17 by Wes.Hunt Update CRP to not send Slack queue size updates unless the waiting time is greater than 1 minute. #codereview: jin.zhang Change 3353658 on 2017/03/20 by Steve.Robb Fix for crash when importing a BP which has a populated TMap with an enum class key. Change 3354056 on 2017/03/20 by Steve.Robb TAssetPtr<T> can now be constructed from a nullptr without a full definition of T. Change 3356111 on 2017/03/21 by Graeme.Thornton Fix for UE-34131 - Support double and fname stat types in UFE stat export to CSV #jira UE-34131 Change 3358584 on 2017/03/22 by Daniel.Lamb Fixed the garbage collection keep flags when cleaning the sandbox for iterative cooking. #test Cook shootergame Change 3360379 on 2017/03/23 by Gil.Gribb UE4 - Avoid adding a linker annotation if it actually hasn't changed. Improves ConditionalBeginDestroy performance. Change 3360623 on 2017/03/23 by Gil.Gribb UE4 - Change from MarcA to avoid a redudnant removal of PrimitiveComponent from the streaming managers during ConditionalBeginDestroy. Change 3360627 on 2017/03/23 by Gil.Gribb UE4 - Optimized UObject hash tables for speed and space. Change 3361183 on 2017/03/23 by Gil.Gribb UE4 - Fixed change to NotifyPrimitiveDetached so that it works in the editor. Change 3361906 on 2017/03/23 by Steve.Robb Fix for a bad hint index when instantiating map property subobjects when the defaults has fewer but non-zero elements. #jira UE-43272 Change 3362839 on 2017/03/24 by Gil.Gribb UE4 - Fixed hash table lock optimization. Change 3367348 on 2017/03/28 by Robert.Manuszewski Making sure streamed-in SoundWaves get added to GC clusters. Change 3367386 on 2017/03/28 by Ben.Marsh EC: Pass the Semaphores property from a build type as a parameter to new build jobs. Change 3367422 on 2017/03/28 by Ben.Marsh EC: Allow limiting the number of scheduled jobs that will be automatically run at a particular time. Each build type can have a 'Semaphores' property in the branch settings file, which will be copied to newly created jobs. Before scheduling new jobs, EC is queried for the 'Semaphores' property on any running jobs, and build types with existing semaphores will be skipped. Does not prevent jobs from being run manually. Change 3367469 on 2017/03/28 by Ben.Marsh EC: Prevent multiple incremental jobs running at once. Change 3367640 on 2017/03/28 by Ben.Marsh Plugins: Add an optional EngineVersion field back into the plugin descriptor. If set, the engine will warn if the plugin is not compatible with the current engine version. Plugins will set this field by default when packaging; pass -Unversioned to override. Change 3367836 on 2017/03/28 by Uriel.Doyon Improved handled of references in the streaming manager Change 3369354 on 2017/03/29 by Graeme.Thornton Added AES encrypt/decrypt functions that take a byte array for the key Change 3369804 on 2017/03/29 by Ben.Marsh Remove incorrect "EngineVersion" settings from plugin descriptors. Change 3370462 on 2017/03/29 by Ben.Marsh Editor: Install Visual Studio 2017 by default, instead of Visual Studio 2015. Changed to use ExecElevatedProcess() to prevent installer failing to run if the current user is not already an administrator. #jira UE-43467 Change 3371598 on 2017/03/30 by Ben.Marsh UBT: Fix message for missing toolchain in VS2017. Change 3372827 on 2017/03/30 by Ben.Marsh BuildGraph: Output an error at the end of each step if any previous build products have been modified. Change 3372947 on 2017/03/30 by Ben.Marsh [Merge] Always add the host editor platform as supported in an installed build. Not doing so prevents the build platform being registered in UBT, which prevents doing any platform-specific staging operations in UAT. Change 3372958 on 2017/03/30 by Ben.Marsh [Merge] Simplify log output for cooks. Suppress additional timestamps from the editor when running through UAT. Change 3372981 on 2017/03/30 by Ben.Marsh [Merge] Modular game fixes for UAT * Store list of executable names from the receipts instead of generating them from Target/Platform/Config/Architecture combination * Get full list of staged executables from receipts instead of assuming only non-code projects are in Engine * Always pass short project name as Bootstrap argument, so that modular game exe knows which project to start Change 3373024 on 2017/03/30 by Ben.Marsh [Merge] Add an option to UAT (-CookOutputDir=...) and the cooker (-OutputDir=...) which allows overriding the output directory for cooked files, and fix situations where the directory becomes too deep. Change 3373041 on 2017/03/30 by Ben.Marsh [Merge] Added UAT script to replace assets with another source Renamed ReplaceAssetsCommandlet to GenerateAssetsManifest as it now outputs a list of files and has nothing specific about replacing files Change 3373052 on 2017/03/30 by Ben.Marsh [Merge] Changed CopyUsingDistillFileSet command so that it can use a pre-existing manifest file instead of running commandlet Change 3373092 on 2017/03/30 by Ben.Marsh [Merge] Fixed crash attempting to load cooked static mesh in editor Change 3373112 on 2017/03/30 by Ben.Marsh [Merge] Fixed crash caused by loading cooked StaticMesh in editor that didn't have any SourceModels Change 3373132 on 2017/03/30 by Ben.Marsh [Merge] Added Additional Maps that are always cooked to the GenerateDistillFileSetsCommandlet Change 3373138 on 2017/03/30 by Ben.Marsh [Merge] Fixed code issue with playback of cooked SoundCues Skip over code using editor only data when editor data has been stripped Change 3373143 on 2017/03/30 by Ben.Marsh [Merge] Fixed crash when attempting to open multiple cooked assets Change 3373156 on 2017/03/30 by Ben.Marsh [Merge] Added commandlet to replace game assets with those from another source (intended for cooked asset replacement) Change 3373161 on 2017/03/30 by Ben.Marsh [Merge] Prevented crash by not attempting to Load Mips again if a package has cooked data Change 3373168 on 2017/03/30 by Ben.Marsh [Merge] Fix output path for DLC pak file, so it can be discovered by the engine and automatically mounted (and to stop it colliding with the main game pak file). Change 3373204 on 2017/03/30 by Ben.Marsh [Merge] Fix crash when switching levels in PIE, due to bulk data already having been discarded for cooked assets. Cooking sets BULKDATA_SingleUse for textures, but PIEing needs to keep bulk data around. Change 3373209 on 2017/03/30 by Ben.Marsh [Merge] Fix missing material in mod editor for cooked assets. Change 3373388 on 2017/03/30 by Ben.Marsh [Merge] Various improvements to the plugin browser and new plugin wizard from Robo Recall. Change 3374200 on 2017/03/31 by Ben.Marsh [Merge] Latest OdinEditor plugin from //Odin/Main, to fix build failures. Re-made change to OdinUnrealEdEngine to remove dependencies on analytics. Change 3374279 on 2017/03/31 by Ben.Marsh PR #3441: Invalid JSON in FeaturePacks (Contributed by projectgheist) Change 3374331 on 2017/03/31 by Ben.Marsh UBT: Disable warning pragmas on Mono; not supported on current compiler. #jira UE-43451 Change 3375108 on 2017/03/31 by Ben.Marsh Removing another plugin EngineVersion property. Change 3375126 on 2017/03/31 by Ben.Marsh Fix incorrect executable paths being generated for Windows. Change 3375159 on 2017/03/31 by Graeme.Thornton Pak Index Encryption - Added "-encryptindex" option to unrealpak which will encrypt the pak index, making the pak file unreadable without the associated decryption key - Added "-encryptpakindex" option to UAT to force on index encryption - Added "bEncryptPakIndex" setting to project packaging settings so pak encryption can be controlled via the editor Change 3375197 on 2017/03/31 by Graeme.Thornton Enable pak index encryption in shootergame Change 3375377 on 2017/03/31 by Ben.Marsh Add build node to submit updated UnrealPak binaries for Win64, Mac and Linux. Currently has to be run via a custom build on EC, with the target set to "Submit UnrealPak Binaries". Change 3376418 on 2017/04/03 by Ben.Marsh BuildGraph: Always clear the cached node state when running locally without having to manually specify the -ClearHistory argument. The -Resume argument allows the previous behavior of continuing a previous build. Change 3376447 on 2017/04/03 by Ben.Marsh Build: Remove some unused stream settings Change 3376469 on 2017/04/03 by Ben.Marsh Build: Add a customizable field for the script to use for custom builds in every branch. Change 3376654 on 2017/04/03 by Ben.Marsh Add a fatal error message containing the module with an outstanding reference when trying to unload it. #jira UE-42423 Change 3376747 on 2017/04/03 by Gil.Gribb UE4 - Fixed crash relating to FGenericAsyncReadFileHandle when not using the EDL. Change 3377173 on 2017/04/03 by Ben.Marsh Make sure callstacks are written to stdout following a crash on a background thread. Change 3377183 on 2017/04/03 by Ben.Marsh Removing support for building VS2013 targets. Ability to generate VS2013 project files is still allowed, but unsupported (via the -2013unsupported command line argument). Change 3377280 on 2017/04/03 by Ben.Marsh Build: Post UGS badges for all UE4 development streams, with the project set to $(Branch)/... Change3377311on 2017/04/03 by Ben.Marsh Build: Set the 'Semaphores' parameter for any jobs started from a schedule. Change 3377326 on 2017/04/03 by Ben.Marsh UGS: Show badges which match an entire subtree if the project field ends with "...". Change 3377392 on 2017/04/03 by Ben.Marsh Add badges to UE4/Main and UE4/Release streams, and change the names of the builds in development streams to distinguish them. Change 3377895 on 2017/04/03 by Ben.Marsh EC: Send notification emails whenever UAT fails to compile. Change 3377923 on 2017/04/03 by Ben.Marsh Build: Use a different semaphore for the common editors build target to the incremental compile build target. Change 3378297 on 2017/04/04 by Graeme.Thornton Fix incorrect generation of UE_ENGINE_DIRECTORY in UBT Change 3378301 on 2017/04/04 by Ben.Marsh UBT: Try enabling bAdaptiveUnityDisablesPCH by default, to reduce the number of build failures we see due to missing includes. Change 3378460 on 2017/04/04 by Graeme.Thornton Remove dependency preloading system from sync and async loading paths Change 3378535 on 2017/04/04 by Robert.Manuszewski Fix for audio crash when launching Ocean PIE after removing the audio chunk allocation in CL #3347324 #jira UE-43544 Change 3378575 on 2017/04/04 by Robert.Manuszewski Making sure actor clusters are not created in non-cooked builds #jira UE-43617 #jira UE-43614 Change 3378589 on 2017/04/04 by Robert.Manuszewski Disabling debug GC cluster logging #jira UE-43617 Change 3379118 on 2017/04/04 by Robert.Manuszewski Disabling actor clustering by default, keeping it on in Orion and Ocean Change 3379815 on 2017/04/04 by Ben.Marsh Revert change to derive executable names from target receipts. While a better solution than making them up, Android relies on having the base executable names for supporting multiple architectures. Change 3380811 on 2017/04/05 by Gil.Gribb UE4 - Put the special boot order things into baseengine.ini so that licensees and games can add to it. Change 3383313 on 2017/04/06 by Uriel.Doyon Integrated CL 3372436 33727653373272from Dev-Rendering #JIRA UE-43669 Change 3383531 on 2017/04/06 by Ben.Marsh UGS: Ignore failures when querying whether paths exist. Permissions can cause this folder to fail, even if it will succeed at a parent directory. Change 3383786 on 2017/04/06 by Ben.Zeigler Back out changelist 3382694 and replace with CL #3383757 from bob.tellez: Fix memory stomping issue caused by removing a FFortProfileSynchronizeRequest from SynchronizeRequests in UFortRegisteredPlayerInfo::UpdateSynchronizeRequest before SynchronizeProfile had finished executing Change 3385089 on 2017/04/07 by Gil.Gribb UE4 - Critical. Fixed memory leak in pak precacher. [CL 3386123 by Ben Marsh in Main branch]
1081 lines
45 KiB
C#
1081 lines
45 KiB
C#
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Xml.Linq;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
/// <summary>
|
|
/// Represents a folder within the master project (e.g. Visual Studio solution)
|
|
/// </summary>
|
|
class VisualStudioSolutionFolder : MasterProjectFolder
|
|
{
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public VisualStudioSolutionFolder(ProjectFileGenerator InitOwnerProjectFileGenerator, string InitFolderName)
|
|
: base(InitOwnerProjectFileGenerator, InitFolderName)
|
|
{
|
|
// Generate a unique GUID for this folder
|
|
// NOTE: When saving generated project files, we ignore differences in GUIDs if every other part of the file
|
|
// matches identically with the pre-existing file
|
|
FolderGUID = Guid.NewGuid();
|
|
}
|
|
|
|
|
|
/// GUID for this folder
|
|
public Guid FolderGUID
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
}
|
|
|
|
enum VCProjectFileFormat
|
|
{
|
|
Default, // Default to the best installed version, but allow SDKs to override
|
|
VisualStudio2012, // Unsupported
|
|
VisualStudio2013, // Unsupported
|
|
VisualStudio2015,
|
|
VisualStudio2017,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Visual C++ project file generator implementation
|
|
/// </summary>
|
|
class VCProjectFileGenerator : ProjectFileGenerator
|
|
{
|
|
/// <summary>
|
|
/// The version of Visual Studio to generate project files for.
|
|
/// </summary>
|
|
[XmlConfigFile(Name = "Version")]
|
|
VCProjectFileFormat ProjectFileFormat = VCProjectFileFormat.Default;
|
|
|
|
/// <summary>
|
|
/// Whether to add the -FastPDB option to build command lines by default
|
|
/// </summary>
|
|
[XmlConfigFile(Category = "BuildConfiguration")]
|
|
bool bAddFastPDBToProjects = false;
|
|
|
|
/// <summary>
|
|
/// Whether to generate per-file intellisense data
|
|
/// </summary>
|
|
[XmlConfigFile(Category = "BuildConfiguration")]
|
|
bool bUsePerFileIntellisense = false;
|
|
|
|
/// <summary>
|
|
/// Whether to include a dependency on ShaderCompileWorker when generating project files for the editor.
|
|
/// </summary>
|
|
[XmlConfigFile(Category = "BuildConfiguration")]
|
|
bool bEditorDependsOnShaderCompileWorker = true;
|
|
|
|
/// <summary>
|
|
/// Override for the build tool to use in generated projects. If the compiler version is specified on the command line, we use the same argument on the
|
|
/// command line for generated projects.
|
|
/// </summary>
|
|
string BuildToolOverride;
|
|
|
|
/// Default constructor
|
|
public VCProjectFileGenerator(FileReference InOnlyGameProject, string[] Arguments)
|
|
: base(InOnlyGameProject)
|
|
{
|
|
XmlConfig.ApplyTo(this);
|
|
|
|
foreach(string Argument in Arguments)
|
|
{
|
|
if(Argument.Equals("-2012unsupported", StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
ProjectFileFormat = VCProjectFileFormat.VisualStudio2012;
|
|
}
|
|
else if (Argument.Equals("-2013unsupported", StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
ProjectFileFormat = VCProjectFileFormat.VisualStudio2013;
|
|
}
|
|
else if(Argument == "-2015")
|
|
{
|
|
ProjectFileFormat = VCProjectFileFormat.VisualStudio2015;
|
|
BuildToolOverride = " -2015";
|
|
}
|
|
else if(Argument == "-2017")
|
|
{
|
|
ProjectFileFormat = VCProjectFileFormat.VisualStudio2017;
|
|
BuildToolOverride = " -2017";
|
|
}
|
|
}
|
|
}
|
|
|
|
/// File extension for project files we'll be generating (e.g. ".vcxproj")
|
|
override public string ProjectFileExtension
|
|
{
|
|
get
|
|
{
|
|
return ".vcxproj";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// </summary>
|
|
public override void CleanProjectFiles(DirectoryReference InMasterProjectDirectory, string InMasterProjectName, DirectoryReference InIntermediateProjectFilesDirectory)
|
|
{
|
|
FileReference MasterProjectFile = FileReference.Combine(InMasterProjectDirectory, InMasterProjectName);
|
|
FileReference MasterProjDeleteFilename = MasterProjectFile + ".sln";
|
|
if (FileReference.Exists(MasterProjDeleteFilename))
|
|
{
|
|
FileReference.Delete(MasterProjDeleteFilename);
|
|
}
|
|
MasterProjDeleteFilename = MasterProjectFile + ".sdf";
|
|
if (FileReference.Exists(MasterProjDeleteFilename))
|
|
{
|
|
FileReference.Delete(MasterProjDeleteFilename);
|
|
}
|
|
MasterProjDeleteFilename = MasterProjectFile + ".suo";
|
|
if (FileReference.Exists(MasterProjDeleteFilename))
|
|
{
|
|
FileReference.Delete(MasterProjDeleteFilename);
|
|
}
|
|
MasterProjDeleteFilename = MasterProjectFile + ".v11.suo";
|
|
if (FileReference.Exists(MasterProjDeleteFilename))
|
|
{
|
|
FileReference.Delete(MasterProjDeleteFilename);
|
|
}
|
|
MasterProjDeleteFilename = MasterProjectFile + ".v12.suo";
|
|
if (FileReference.Exists(MasterProjDeleteFilename))
|
|
{
|
|
FileReference.Delete(MasterProjDeleteFilename);
|
|
}
|
|
|
|
// Delete the project files folder
|
|
if (DirectoryReference.Exists(InIntermediateProjectFilesDirectory))
|
|
{
|
|
try
|
|
{
|
|
DirectoryReference.Delete(InIntermediateProjectFilesDirectory, true);
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
Log.TraceInformation("Error while trying to clean project files path {0}. Ignored.", InIntermediateProjectFilesDirectory);
|
|
Log.TraceInformation("\t" + Ex.Message);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Allocates a generator-specific project file object
|
|
/// </summary>
|
|
/// <param name="InitFilePath">Path to the project file</param>
|
|
/// <returns>The newly allocated project file object</returns>
|
|
protected override ProjectFile AllocateProjectFile(FileReference InitFilePath)
|
|
{
|
|
return new VCProjectFile(InitFilePath, OnlyGameProject, ProjectFileFormat, bAddFastPDBToProjects, bUsePerFileIntellisense, BuildToolOverride);
|
|
}
|
|
|
|
|
|
/// ProjectFileGenerator interface
|
|
public override MasterProjectFolder AllocateMasterProjectFolder(ProjectFileGenerator InitOwnerProjectFileGenerator, string InitFolderName)
|
|
{
|
|
return new VisualStudioSolutionFolder(InitOwnerProjectFileGenerator, InitFolderName);
|
|
}
|
|
|
|
/// "4.0", "12.0", or "14.0", etc...
|
|
static public string GetProjectFileToolVersionString(VCProjectFileFormat ProjectFileFormat)
|
|
{
|
|
switch (ProjectFileFormat)
|
|
{
|
|
case VCProjectFileFormat.VisualStudio2012:
|
|
return "4.0";
|
|
case VCProjectFileFormat.VisualStudio2013:
|
|
return "12.0";
|
|
case VCProjectFileFormat.VisualStudio2015:
|
|
return "14.0";
|
|
case VCProjectFileFormat.VisualStudio2017:
|
|
return "15.0";
|
|
}
|
|
return string.Empty;
|
|
}
|
|
|
|
/// for instance: <PlatformToolset>v110</PlatformToolset>
|
|
static public string GetProjectFilePlatformToolsetVersionString(VCProjectFileFormat ProjectFileFormat)
|
|
{
|
|
switch (ProjectFileFormat)
|
|
{
|
|
case VCProjectFileFormat.VisualStudio2012:
|
|
return "v110";
|
|
case VCProjectFileFormat.VisualStudio2013:
|
|
return "v120";
|
|
case VCProjectFileFormat.VisualStudio2015:
|
|
return "v140";
|
|
case VCProjectFileFormat.VisualStudio2017:
|
|
return "v141";
|
|
}
|
|
return string.Empty;
|
|
}
|
|
|
|
/// This is the platform name that Visual Studio is always guaranteed to support. We'll use this as
|
|
/// a platform for any project configurations where our actual platform is not supported by the
|
|
/// installed version of Visual Studio (e.g, "iOS")
|
|
public const string DefaultPlatformName = "Win32";
|
|
|
|
/// The platform name that must be used for .NET projects
|
|
public const string DotNetPlatformName = "AnyCPU";
|
|
|
|
|
|
/// <summary>
|
|
/// Configures project generator based on command-line options
|
|
/// </summary>
|
|
/// <param name="Arguments">Arguments passed into the program</param>
|
|
/// <param name="IncludeAllPlatforms">True if all platforms should be included</param>
|
|
protected override void ConfigureProjectFileGeneration(String[] Arguments, ref bool IncludeAllPlatforms)
|
|
{
|
|
// Call parent implementation first
|
|
base.ConfigureProjectFileGeneration(Arguments, ref IncludeAllPlatforms);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Adds Extra files that are specific to Visual Studio projects
|
|
/// </summary>
|
|
/// <param name="EngineProject">Project to add files to</param>
|
|
protected override void AddEngineExtrasFiles(ProjectFile EngineProject)
|
|
{
|
|
base.AddEngineExtrasFiles(EngineProject);
|
|
|
|
// Add our UE4.natvis file
|
|
FileReference NatvisFilePath = FileReference.Combine(UnrealBuildTool.EngineDirectory, "Extras", "VisualStudioDebugging", "UE4.natvis");
|
|
if (FileReference.Exists(NatvisFilePath))
|
|
{
|
|
EngineProject.AddFileToProject(NatvisFilePath, UnrealBuildTool.EngineDirectory);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selects which platforms and build configurations we want in the project file
|
|
/// </summary>
|
|
/// <param name="IncludeAllPlatforms">True if we should include ALL platforms that are supported on this machine. Otherwise, only desktop platforms will be included.</param>
|
|
/// <param name="SupportedPlatformNames">Output string for supported platforms, returned as comma-separated values.</param>
|
|
protected override void SetupSupportedPlatformsAndConfigurations(bool IncludeAllPlatforms, out string SupportedPlatformNames)
|
|
{
|
|
// Call parent implementation to figure out the actual platforms
|
|
base.SetupSupportedPlatformsAndConfigurations(IncludeAllPlatforms, out SupportedPlatformNames);
|
|
|
|
// If we're generating project files for a specific game project, check the user's editor setting for preferred source code accessor - we can generate project files to match.
|
|
if (ProjectFileFormat == VCProjectFileFormat.Default && OnlyGameProject != null)
|
|
{
|
|
ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.EditorPerProjectUserSettings, DirectoryReference.FromFile(OnlyGameProject), UnrealTargetPlatform.Win64);
|
|
|
|
string PreferredAccessor;
|
|
if (Ini.GetString("/Script/SourceCodeAccess.SourceCodeAccessSettings", "PreferredAccessor", out PreferredAccessor))
|
|
{
|
|
VCProjectFileFormat PreferredProjectFileFormat;
|
|
if (Enum.TryParse(PreferredAccessor, out PreferredProjectFileFormat))
|
|
{
|
|
// Get the corresponding compiler version
|
|
WindowsCompiler Compiler = WindowsCompiler.Default;
|
|
if(PreferredProjectFileFormat == VCProjectFileFormat.VisualStudio2015)
|
|
{
|
|
Compiler = WindowsCompiler.VisualStudio2015;
|
|
}
|
|
else if(PreferredProjectFileFormat == VCProjectFileFormat.VisualStudio2017)
|
|
{
|
|
Compiler = WindowsCompiler.VisualStudio2017;
|
|
}
|
|
|
|
// Check the compiler is installed
|
|
if (Compiler != WindowsCompiler.Default)
|
|
{
|
|
DirectoryReference VCInstallDir;
|
|
if (WindowsPlatform.TryGetVCInstallDir(Compiler, out VCInstallDir))
|
|
{
|
|
ProjectFileFormat = PreferredProjectFileFormat;
|
|
}
|
|
else
|
|
{
|
|
Log.TraceWarning("Preferred Visual C++ installation ({0}) not found - ignoring.", PreferredProjectFileFormat);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Certain platforms override the project file format because their debugger add-ins may not yet support the latest
|
|
// version of Visual Studio. This is their chance to override that.
|
|
// ...but only if the user didn't override this via the command-line.
|
|
if (ProjectFileFormat == VCProjectFileFormat.Default)
|
|
{
|
|
// Pick the best platform installed by default
|
|
DirectoryReference VCInstallDir;
|
|
if (WindowsPlatform.TryGetVCInstallDir(WindowsCompiler.VisualStudio2015, out VCInstallDir))
|
|
{
|
|
ProjectFileFormat = VCProjectFileFormat.VisualStudio2015;
|
|
}
|
|
else if (WindowsPlatform.TryGetVCInstallDir(WindowsCompiler.VisualStudio2017, out VCInstallDir))
|
|
{
|
|
ProjectFileFormat = VCProjectFileFormat.VisualStudio2017;
|
|
}
|
|
|
|
// Allow the SDKs to override
|
|
foreach (UnrealTargetPlatform SupportedPlatform in SupportedPlatforms)
|
|
{
|
|
UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(SupportedPlatform, true);
|
|
if (BuildPlatform != null)
|
|
{
|
|
// Don't worry about platforms that we're missing SDKs for
|
|
if (BuildPlatform.HasRequiredSDKsInstalled() == SDKStatus.Valid)
|
|
{
|
|
VCProjectFileFormat ProposedFormat = ProjectFileFormat;
|
|
|
|
// Reduce the Visual Studio version to the max supported by each platform we plan to include.
|
|
if (ProjectFileFormat == VCProjectFileFormat.Default || ProposedFormat < ProjectFileFormat)
|
|
{
|
|
ProjectFileFormat = ProposedFormat;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Used to sort VC solution config names along with the config and platform values
|
|
/// </summary>
|
|
class VCSolutionConfigCombination
|
|
{
|
|
/// Visual Studio solution configuration name for this config+platform
|
|
public string VCSolutionConfigAndPlatformName;
|
|
|
|
/// Configuration name
|
|
public UnrealTargetConfiguration Configuration;
|
|
|
|
/// Platform name
|
|
public UnrealTargetPlatform Platform;
|
|
|
|
/// The target configuration name
|
|
public string TargetConfigurationName;
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("{0}={1} {2} {3}", VCSolutionConfigAndPlatformName, Configuration, Platform, TargetConfigurationName);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Composes a string to use for the Visual Studio solution configuration, given a build configuration and target rules configuration name
|
|
/// </summary>
|
|
/// <param name="Configuration">The build configuration</param>
|
|
/// <param name="TargetConfigurationName">The target rules configuration name</param>
|
|
/// <returns>The generated solution configuration name</returns>
|
|
string MakeSolutionConfigurationName(UnrealTargetConfiguration Configuration, string TargetConfigurationName)
|
|
{
|
|
string SolutionConfigName = Configuration.ToString();
|
|
|
|
// Don't bother postfixing "Game" or "Program" -- that will be the default when using "Debug", "Development", etc.
|
|
// Also don't postfix "RocketGame" when we're building Rocket game projects. That's the only type of game there is in that case!
|
|
if (!TargetConfigurationName.Equals(TargetType.Game.ToString(), StringComparison.InvariantCultureIgnoreCase) &&
|
|
!TargetConfigurationName.Equals(TargetType.Program.ToString(), StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
SolutionConfigName += " " + TargetConfigurationName;
|
|
}
|
|
|
|
return SolutionConfigName;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Writes the project files to disk
|
|
/// </summary>
|
|
/// <returns>True if successful</returns>
|
|
protected override bool WriteProjectFiles()
|
|
{
|
|
if(!base.WriteProjectFiles())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// Write AutomationReferences file
|
|
if (AutomationProjectFiles.Any())
|
|
{
|
|
XNamespace NS = XNamespace.Get("http://schemas.microsoft.com/developer/msbuild/2003");
|
|
|
|
DirectoryReference AutomationToolDir = DirectoryReference.Combine(UnrealBuildTool.EngineSourceDirectory, "Programs", "AutomationTool");
|
|
new XDocument(
|
|
new XElement(NS + "Project",
|
|
new XAttribute("ToolsVersion", VCProjectFileGenerator.GetProjectFileToolVersionString(ProjectFileFormat)),
|
|
new XAttribute("DefaultTargets", "Build"),
|
|
new XElement(NS + "ItemGroup",
|
|
from AutomationProject in AutomationProjectFiles
|
|
select new XElement(NS + "ProjectReference",
|
|
new XAttribute("Include", AutomationProject.ProjectFilePath.MakeRelativeTo(AutomationToolDir)),
|
|
new XElement(NS + "Project", (AutomationProject as VCSharpProjectFile).ProjectGUID.ToString("B")),
|
|
new XElement(NS + "Name", AutomationProject.ProjectFilePath.GetFileNameWithoutExtension()),
|
|
new XElement(NS + "Private", "false")
|
|
)
|
|
)
|
|
)
|
|
).Save(FileReference.Combine(AutomationToolDir, "AutomationTool.csproj.References").FullName);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
protected override bool WriteMasterProjectFile(ProjectFile UBTProject)
|
|
{
|
|
bool bSuccess = true;
|
|
|
|
string SolutionFileName = MasterProjectName + ".sln";
|
|
|
|
// Setup solution file content
|
|
StringBuilder VCSolutionFileContent = new StringBuilder();
|
|
|
|
const string VersionTag = "# UnrealEngineGeneratedSolutionVersion=1.0";
|
|
|
|
// Solution file header
|
|
if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2017)
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
ProjectFileGenerator.NewLine +
|
|
"Microsoft Visual Studio Solution File, Format Version 12.00" + ProjectFileGenerator.NewLine +
|
|
"# Visual Studio 15" + ProjectFileGenerator.NewLine +
|
|
"VisualStudioVersion = 15.0.25807.0" + ProjectFileGenerator.NewLine +
|
|
"MinimumVisualStudioVersion = 10.0.40219.1" + ProjectFileGenerator.NewLine);
|
|
}
|
|
else if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2015)
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
ProjectFileGenerator.NewLine +
|
|
"Microsoft Visual Studio Solution File, Format Version 12.00" + ProjectFileGenerator.NewLine +
|
|
"# Visual Studio 14" + ProjectFileGenerator.NewLine +
|
|
"VisualStudioVersion = 14.0.22310.1" + ProjectFileGenerator.NewLine +
|
|
"MinimumVisualStudioVersion = 10.0.40219.1" + ProjectFileGenerator.NewLine);
|
|
}
|
|
else if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2013)
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
ProjectFileGenerator.NewLine +
|
|
"Microsoft Visual Studio Solution File, Format Version 12.00" + ProjectFileGenerator.NewLine +
|
|
"# Visual Studio 2013" + ProjectFileGenerator.NewLine +
|
|
VersionTag + ProjectFileGenerator.NewLine);
|
|
}
|
|
else if (ProjectFileFormat == VCProjectFileFormat.VisualStudio2012)
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
ProjectFileGenerator.NewLine +
|
|
"Microsoft Visual Studio Solution File, Format Version 12.00" + ProjectFileGenerator.NewLine +
|
|
"# Visual Studio 2012" + ProjectFileGenerator.NewLine +
|
|
VersionTag + ProjectFileGenerator.NewLine);
|
|
}
|
|
else
|
|
{
|
|
throw new BuildException("Unexpected ProjectFileFormat");
|
|
}
|
|
|
|
// Find the projects for ShaderCompileWorker and UnrealLightmass
|
|
ProjectFile ShaderCompileWorkerProject = null;
|
|
ProjectFile UnrealLightmassProject = null;
|
|
foreach (ProjectFile Project in AllProjectFiles)
|
|
{
|
|
if (Project.ProjectTargets.Count == 1)
|
|
{
|
|
FileReference TargetFilePath = Project.ProjectTargets[0].TargetFilePath;
|
|
if (TargetFilePath != null)
|
|
{
|
|
string TargetFileName = TargetFilePath.GetFileNameWithoutAnyExtensions();
|
|
if (TargetFileName.Equals("ShaderCompileWorker", StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
ShaderCompileWorkerProject = Project;
|
|
}
|
|
else if (TargetFileName.Equals("UnrealLightmass", StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
UnrealLightmassProject = Project;
|
|
}
|
|
}
|
|
if (ShaderCompileWorkerProject != null
|
|
&& UnrealLightmassProject != null)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Solution folders, files and project entries
|
|
{
|
|
// This the GUID that Visual Studio uses to identify a solution folder
|
|
string SolutionFolderEntryGUID = "{2150E333-8FDC-42A3-9474-1A3956D46DE8}";
|
|
|
|
// Solution folders
|
|
{
|
|
List<MasterProjectFolder> AllSolutionFolders = new List<MasterProjectFolder>();
|
|
System.Action<List<MasterProjectFolder> /* Folders */ > GatherFoldersFunction = null;
|
|
GatherFoldersFunction = FolderList =>
|
|
{
|
|
AllSolutionFolders.AddRange(FolderList);
|
|
foreach (MasterProjectFolder CurSubFolder in FolderList)
|
|
{
|
|
GatherFoldersFunction(CurSubFolder.SubFolders);
|
|
}
|
|
};
|
|
GatherFoldersFunction(RootFolder.SubFolders);
|
|
|
|
foreach (VisualStudioSolutionFolder CurFolder in AllSolutionFolders)
|
|
{
|
|
string FolderGUIDString = CurFolder.FolderGUID.ToString("B").ToUpperInvariant();
|
|
VCSolutionFileContent.Append(
|
|
"Project(\"" + SolutionFolderEntryGUID + "\") = \"" + CurFolder.FolderName + "\", \"" + CurFolder.FolderName + "\", \"" + FolderGUIDString + "\"" + ProjectFileGenerator.NewLine);
|
|
|
|
// Add any files that are inlined right inside the solution folder
|
|
if (CurFolder.Files.Count > 0)
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" ProjectSection(SolutionItems) = preProject" + ProjectFileGenerator.NewLine);
|
|
foreach (string CurFile in CurFolder.Files)
|
|
{
|
|
// Syntax is: <relative file path> = <relative file path>
|
|
VCSolutionFileContent.Append(
|
|
" " + CurFile + " = " + CurFile + ProjectFileGenerator.NewLine);
|
|
}
|
|
VCSolutionFileContent.Append(
|
|
" EndProjectSection" + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
VCSolutionFileContent.Append(
|
|
"EndProject" + ProjectFileGenerator.NewLine
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
// Project files
|
|
foreach (MSBuildProjectFile CurProject in AllProjectFiles)
|
|
{
|
|
// Visual Studio uses different GUID types depending on the project type
|
|
string ProjectTypeGUID = CurProject.ProjectTypeGUID;
|
|
|
|
// NOTE: The project name in the solution doesn't actually *have* to match the project file name on disk. However,
|
|
// we prefer it when it does match so we use the actual file name here.
|
|
string ProjectNameInSolution = CurProject.ProjectFilePath.GetFileNameWithoutExtension();
|
|
|
|
// Use the existing project's GUID that's already known to us
|
|
string ProjectGUID = CurProject.ProjectGUID.ToString("B").ToUpperInvariant();
|
|
|
|
VCSolutionFileContent.Append(
|
|
"Project(\"" + ProjectTypeGUID + "\") = \"" + ProjectNameInSolution + "\", \"" + CurProject.ProjectFilePath.MakeRelativeTo(ProjectFileGenerator.MasterProjectPath) + "\", \"" + ProjectGUID + "\"" + ProjectFileGenerator.NewLine);
|
|
|
|
// Setup dependency on UnrealBuildTool, if we need that. This makes sure that UnrealBuildTool is
|
|
// freshly compiled before kicking off any build operations on this target project
|
|
if (!CurProject.IsStubProject)
|
|
{
|
|
List<ProjectFile> Dependencies = new List<ProjectFile>();
|
|
if (CurProject.IsGeneratedProject && UBTProject != null && CurProject != UBTProject)
|
|
{
|
|
Dependencies.Add(UBTProject);
|
|
Dependencies.AddRange(UBTProject.DependsOnProjects);
|
|
}
|
|
if (bEditorDependsOnShaderCompileWorker && CurProject.IsGeneratedProject && ShaderCompileWorkerProject != null && CurProject.ProjectTargets.Any(x => x.TargetRules != null && x.TargetRules.Type == TargetType.Editor))
|
|
{
|
|
Dependencies.Add(ShaderCompileWorkerProject);
|
|
}
|
|
Dependencies.AddRange(CurProject.DependsOnProjects);
|
|
|
|
if (Dependencies.Count > 0)
|
|
{
|
|
VCSolutionFileContent.Append("\tProjectSection(ProjectDependencies) = postProject" + ProjectFileGenerator.NewLine);
|
|
|
|
// Setup any addition dependencies this project has...
|
|
foreach (ProjectFile DependsOnProject in Dependencies)
|
|
{
|
|
string DependsOnProjectGUID = ((MSBuildProjectFile)DependsOnProject).ProjectGUID.ToString("B").ToUpperInvariant();
|
|
VCSolutionFileContent.Append("\t\t" + DependsOnProjectGUID + " = " + DependsOnProjectGUID + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
VCSolutionFileContent.Append("\tEndProjectSection" + ProjectFileGenerator.NewLine);
|
|
}
|
|
}
|
|
|
|
VCSolutionFileContent.Append(
|
|
"EndProject" + ProjectFileGenerator.NewLine
|
|
);
|
|
}
|
|
}
|
|
|
|
// Solution configuration platforms. This is just a list of all of the platforms and configurations that
|
|
// appear in Visual Studio's build configuration selector.
|
|
List<VCSolutionConfigCombination> SolutionConfigCombinations = new List<VCSolutionConfigCombination>();
|
|
|
|
// The "Global" section has source control, solution configurations, project configurations,
|
|
// preferences, and project hierarchy data
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
"Global" + ProjectFileGenerator.NewLine);
|
|
{
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" GlobalSection(SolutionConfigurationPlatforms) = preSolution" + ProjectFileGenerator.NewLine);
|
|
|
|
Dictionary<string, Tuple<UnrealTargetConfiguration, string>> SolutionConfigurationsValidForProjects = new Dictionary<string, Tuple<UnrealTargetConfiguration, string>>();
|
|
HashSet<UnrealTargetPlatform> PlatformsValidForProjects = new HashSet<UnrealTargetPlatform>();
|
|
|
|
foreach (UnrealTargetConfiguration CurConfiguration in SupportedConfigurations)
|
|
{
|
|
if (UnrealBuildTool.IsValidConfiguration(CurConfiguration))
|
|
{
|
|
foreach (UnrealTargetPlatform CurPlatform in SupportedPlatforms)
|
|
{
|
|
if (UnrealBuildTool.IsValidPlatform(CurPlatform))
|
|
{
|
|
foreach (ProjectFile CurProject in AllProjectFiles)
|
|
{
|
|
if (!CurProject.IsStubProject)
|
|
{
|
|
if (CurProject.ProjectTargets.Count == 0)
|
|
{
|
|
throw new BuildException("Expecting project '" + CurProject.ProjectFilePath + "' to have at least one ProjectTarget associated with it!");
|
|
}
|
|
|
|
// Figure out the set of valid target configuration names
|
|
foreach (ProjectTarget ProjectTarget in CurProject.ProjectTargets)
|
|
{
|
|
if (VCProjectFile.IsValidProjectPlatformAndConfiguration(ProjectTarget, CurPlatform, CurConfiguration))
|
|
{
|
|
PlatformsValidForProjects.Add(CurPlatform);
|
|
|
|
// Default to a target configuration name of "Game", since that will collapse down to an empty string
|
|
string TargetConfigurationName = TargetType.Game.ToString();
|
|
if (ProjectTarget.TargetRules != null)
|
|
{
|
|
TargetConfigurationName = ProjectTarget.TargetRules.Type.ToString();
|
|
}
|
|
|
|
string SolutionConfigName = MakeSolutionConfigurationName(CurConfiguration, TargetConfigurationName);
|
|
SolutionConfigurationsValidForProjects[SolutionConfigName] = new Tuple<UnrealTargetConfiguration, string>(CurConfiguration, TargetConfigurationName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (UnrealTargetPlatform CurPlatform in PlatformsValidForProjects)
|
|
{
|
|
foreach (KeyValuePair<string, Tuple<UnrealTargetConfiguration, string>> SolutionConfigKeyValue in SolutionConfigurationsValidForProjects)
|
|
{
|
|
// e.g. "Development|Win64 = Development|Win64"
|
|
string SolutionConfigName = SolutionConfigKeyValue.Key;
|
|
UnrealTargetConfiguration Configuration = SolutionConfigKeyValue.Value.Item1;
|
|
string TargetConfigurationName = SolutionConfigKeyValue.Value.Item2;
|
|
|
|
string SolutionPlatformName = CurPlatform.ToString();
|
|
|
|
string SolutionConfigAndPlatformPair = SolutionConfigName + "|" + SolutionPlatformName;
|
|
SolutionConfigCombinations.Add(
|
|
new VCSolutionConfigCombination
|
|
{
|
|
VCSolutionConfigAndPlatformName = SolutionConfigAndPlatformPair,
|
|
Configuration = Configuration,
|
|
Platform = CurPlatform,
|
|
TargetConfigurationName = TargetConfigurationName
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
// Sort the list of solution platform strings alphabetically (Visual Studio prefers it)
|
|
SolutionConfigCombinations.Sort(
|
|
new Comparison<VCSolutionConfigCombination>(
|
|
(x, y) => { return String.Compare(x.VCSolutionConfigAndPlatformName, y.VCSolutionConfigAndPlatformName, StringComparison.InvariantCultureIgnoreCase); }
|
|
)
|
|
);
|
|
|
|
HashSet<string> AppendedSolutionConfigAndPlatformNames = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
|
foreach (VCSolutionConfigCombination SolutionConfigCombination in SolutionConfigCombinations)
|
|
{
|
|
// We alias "Game" and "Program" to both have the same solution configuration, so we're careful not to add the same combination twice.
|
|
if (!AppendedSolutionConfigAndPlatformNames.Contains(SolutionConfigCombination.VCSolutionConfigAndPlatformName))
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" " + SolutionConfigCombination.VCSolutionConfigAndPlatformName + " = " + SolutionConfigCombination.VCSolutionConfigAndPlatformName + ProjectFileGenerator.NewLine);
|
|
AppendedSolutionConfigAndPlatformNames.Add(SolutionConfigCombination.VCSolutionConfigAndPlatformName);
|
|
}
|
|
}
|
|
|
|
VCSolutionFileContent.Append(
|
|
" EndGlobalSection" + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
|
|
// Assign each project's "project configuration" to our "solution platform + configuration" pairs. This
|
|
// also sets up which projects are actually built when building the solution.
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" GlobalSection(ProjectConfigurationPlatforms) = postSolution" + ProjectFileGenerator.NewLine);
|
|
|
|
List<VCSolutionConfigCombination> CombinationsThatWereMatchedToProjects = new List<VCSolutionConfigCombination>();
|
|
|
|
foreach (MSBuildProjectFile CurProject in AllProjectFiles)
|
|
{
|
|
// NOTE: We don't emit solution configuration entries for "stub" projects. Those projects are only
|
|
// built using UnrealBuildTool and don't require a presence in the solution project list
|
|
|
|
// NOTE: We also process projects that were "imported" here, hoping to match those to our solution
|
|
// configurations. In some cases this may not be successful though. Imported projects
|
|
// should always be carefully setup to match our project generator's solution configs.
|
|
if (!CurProject.IsStubProject)
|
|
{
|
|
if (CurProject.ProjectTargets.Count == 0)
|
|
{
|
|
throw new BuildException("Expecting project '" + CurProject.ProjectFilePath + "' to have at least one ProjectTarget associated with it!");
|
|
}
|
|
bool IsProgramProject = CurProject.ProjectTargets[0].TargetRules != null && CurProject.ProjectTargets[0].TargetRules.Type == TargetType.Program;
|
|
|
|
HashSet<string> GameOrProgramConfigsAlreadyMapped = new HashSet<string>();
|
|
foreach (VCSolutionConfigCombination SolutionConfigCombination in SolutionConfigCombinations)
|
|
{
|
|
// Handle aliasing of Program and Game target configuration names
|
|
if ((IsProgramProject && GameOrProgramConfigsAlreadyMapped.Add(SolutionConfigCombination.VCSolutionConfigAndPlatformName)) ||
|
|
IsProgramProject && SolutionConfigCombination.TargetConfigurationName != TargetType.Game.ToString() ||
|
|
!IsProgramProject && SolutionConfigCombination.TargetConfigurationName != TargetType.Program.ToString())
|
|
{
|
|
string TargetConfigurationName = SolutionConfigCombination.TargetConfigurationName;
|
|
if (IsProgramProject)
|
|
{
|
|
TargetConfigurationName = TargetType.Program.ToString();
|
|
}
|
|
|
|
// Now, we want to find a target in this project that maps to the current solution config combination. Only up to one target should
|
|
// and every solution config combination should map to at least one target in one project (otherwise we shouldn't have added it!).
|
|
ProjectTarget MatchingProjectTarget = null;
|
|
foreach (ProjectTarget ProjectTarget in CurProject.ProjectTargets)
|
|
{
|
|
bool IsMatchingCombination = VCProjectFile.IsValidProjectPlatformAndConfiguration(ProjectTarget, SolutionConfigCombination.Platform, SolutionConfigCombination.Configuration);
|
|
if (ProjectTarget.TargetRules != null)
|
|
{
|
|
if (TargetConfigurationName != ProjectTarget.TargetRules.Type.ToString())
|
|
{
|
|
// Solution configuration name for this combination doesn't match this target's configuration name. It's not buildable.
|
|
IsMatchingCombination = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// UBT gets a pass because it is a dependency of every single configuration combination
|
|
if (CurProject != UBTProject &&
|
|
!CurProject.ShouldBuildForAllSolutionTargets &&
|
|
TargetConfigurationName != TargetType.Game.ToString())
|
|
{
|
|
// Can't build non-generated project in configurations except for the default (Game)
|
|
IsMatchingCombination = false;
|
|
}
|
|
}
|
|
|
|
if (IsMatchingCombination)
|
|
{
|
|
if (MatchingProjectTarget != null)
|
|
{
|
|
// Not expecting more than one target to match a single solution configuration per project!
|
|
throw new BuildException("Not expecting more than one target for project " + CurProject.ProjectFilePath + " to match solution configuration " + SolutionConfigCombination.VCSolutionConfigAndPlatformName);
|
|
}
|
|
|
|
MatchingProjectTarget = ProjectTarget;
|
|
|
|
// NOTE: For faster perf, we could "break" here and bail out early, but that would circumvent the error checking
|
|
// for multiple targets within a project that may map to a single solution configuration.
|
|
}
|
|
}
|
|
|
|
UnrealTargetConfiguration SolutionConfiguration = SolutionConfigCombination.Configuration;
|
|
UnrealTargetPlatform SolutionPlatform = SolutionConfigCombination.Platform;
|
|
|
|
|
|
if (MatchingProjectTarget == null)
|
|
{
|
|
// The current configuration/platform and target configuration name doesn't map to anything our project actually supports.
|
|
// We'll map it to a default config.
|
|
SolutionConfiguration = UnrealTargetConfiguration.Development;
|
|
|
|
// Prefer using Win64 as the default, but fall back to a platform the project file actually supports if needed. This is for
|
|
// projects that can never be compiled in Windows, such as UnrealLaunchDaemon which is an iOS-only program
|
|
SolutionPlatform = UnrealTargetPlatform.Win64;
|
|
if (CurProject.ProjectTargets[0].TargetRules != null)
|
|
{
|
|
if (!CurProject.ProjectTargets[0].SupportedPlatforms.Contains(SolutionPlatform))
|
|
{
|
|
SolutionPlatform = CurProject.ProjectTargets[0].SupportedPlatforms[0];
|
|
}
|
|
}
|
|
|
|
|
|
if (IsProgramProject)
|
|
{
|
|
TargetConfigurationName = TargetType.Program.ToString();
|
|
}
|
|
else
|
|
{
|
|
TargetConfigurationName = TargetType.Game.ToString();
|
|
}
|
|
}
|
|
|
|
|
|
// If the project wants to always build in "Development", regardless of what the solution
|
|
// configuration is set to, then we'll do that here. This is used for projects like
|
|
// UnrealBuildTool and ShaderCompileWorker
|
|
if (MatchingProjectTarget != null)
|
|
{
|
|
if (MatchingProjectTarget.ForceDevelopmentConfiguration)
|
|
{
|
|
SolutionConfiguration = UnrealTargetConfiguration.Development;
|
|
}
|
|
}
|
|
|
|
// Always allow SCW and UnrealLighmass to build in editor configurations
|
|
if (MatchingProjectTarget == null && SolutionConfigCombination.TargetConfigurationName == TargetType.Editor.ToString() && SolutionConfigCombination.Platform == UnrealTargetPlatform.Win64)
|
|
{
|
|
if (CurProject == ShaderCompileWorkerProject)
|
|
{
|
|
MatchingProjectTarget = ShaderCompileWorkerProject.ProjectTargets[0];
|
|
}
|
|
else if (CurProject == UnrealLightmassProject)
|
|
{
|
|
MatchingProjectTarget = UnrealLightmassProject.ProjectTargets[0];
|
|
}
|
|
}
|
|
|
|
string ProjectConfigName;
|
|
string ProjectPlatformName;
|
|
if (CurProject.IsStubProject)
|
|
{
|
|
if (SolutionPlatform != UnrealTargetPlatform.Unknown || SolutionConfiguration != UnrealTargetConfiguration.Unknown)
|
|
{
|
|
throw new BuildException("Stub project was expecting platform and configuration type to be set to Unknown");
|
|
}
|
|
ProjectPlatformName = MSBuildProjectFile.StubProjectPlatformName;
|
|
ProjectConfigName = MSBuildProjectFile.StubProjectConfigurationName;
|
|
}
|
|
else
|
|
{
|
|
CurProject.MakeProjectPlatformAndConfigurationNames(SolutionPlatform, SolutionConfiguration, TargetConfigurationName, out ProjectPlatformName, out ProjectConfigName);
|
|
}
|
|
|
|
string ProjectConfigAndPlatformPair = ProjectConfigName.ToString() + "|" + ProjectPlatformName.ToString();
|
|
|
|
// e.g. "{4232C52C-680F-4850-8855-DC39419B5E9B}.Debug|iOS.ActiveCfg = iOS_Debug|Win32"
|
|
string CurProjectGUID = CurProject.ProjectGUID.ToString("B").ToUpperInvariant();
|
|
VCSolutionFileContent.Append(
|
|
" " + CurProjectGUID + "." + SolutionConfigCombination.VCSolutionConfigAndPlatformName + ".ActiveCfg = " + ProjectConfigAndPlatformPair + ProjectFileGenerator.NewLine);
|
|
|
|
|
|
// Set whether this project configuration should be built when the user initiates "build solution"
|
|
if (MatchingProjectTarget != null && CurProject.ShouldBuildByDefaultForSolutionTargets)
|
|
{
|
|
// Some targets are "dummy targets"; they only exist to show user friendly errors in VS. Weed them out here, and don't set them to build by default.
|
|
List<UnrealTargetPlatform> SupportedPlatforms = null;
|
|
if (MatchingProjectTarget.TargetRules != null)
|
|
{
|
|
SupportedPlatforms = new List<UnrealTargetPlatform>();
|
|
SupportedPlatforms.AddRange(MatchingProjectTarget.SupportedPlatforms);
|
|
}
|
|
if (SupportedPlatforms == null || SupportedPlatforms.Contains(SolutionConfigCombination.Platform))
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" " + CurProjectGUID + "." + SolutionConfigCombination.VCSolutionConfigAndPlatformName + ".Build.0 = " + ProjectConfigAndPlatformPair + ProjectFileGenerator.NewLine);
|
|
|
|
UEPlatformProjectGenerator ProjGen = UEPlatformProjectGenerator.GetPlatformProjectGenerator(SolutionConfigCombination.Platform, true);
|
|
if (MatchingProjectTarget.ProjectDeploys ||
|
|
((ProjGen != null) && (ProjGen.GetVisualStudioDeploymentEnabled(SolutionPlatform, SolutionConfiguration) == true)))
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" " + CurProjectGUID + "." + SolutionConfigCombination.VCSolutionConfigAndPlatformName + ".Deploy.0 = " + ProjectConfigAndPlatformPair + ProjectFileGenerator.NewLine);
|
|
}
|
|
}
|
|
}
|
|
|
|
CombinationsThatWereMatchedToProjects.Add(SolutionConfigCombination);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Check for problems
|
|
foreach (VCSolutionConfigCombination SolutionConfigCombination in SolutionConfigCombinations)
|
|
{
|
|
if (!CombinationsThatWereMatchedToProjects.Contains(SolutionConfigCombination))
|
|
{
|
|
throw new BuildException("Unable to find a ProjectTarget that matches the solution configuration/platform mapping: " + SolutionConfigCombination.Configuration.ToString() + ", " + SolutionConfigCombination.Platform.ToString() + ", " + SolutionConfigCombination.TargetConfigurationName);
|
|
}
|
|
}
|
|
VCSolutionFileContent.Append(
|
|
" EndGlobalSection" + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
|
|
// Setup other solution properties
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" GlobalSection(SolutionProperties) = preSolution" + ProjectFileGenerator.NewLine);
|
|
|
|
// HideSolutionNode sets whether or not the top-level solution entry is completely hidden in the UI.
|
|
// We don't want that, as we need users to be able to right click on the solution tree item.
|
|
VCSolutionFileContent.Append(
|
|
" HideSolutionNode = FALSE" + ProjectFileGenerator.NewLine);
|
|
|
|
VCSolutionFileContent.Append(
|
|
" EndGlobalSection" + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
|
|
|
|
// Solution directory hierarchy
|
|
{
|
|
VCSolutionFileContent.Append(
|
|
" GlobalSection(NestedProjects) = preSolution" + ProjectFileGenerator.NewLine);
|
|
|
|
// Every entry in this section is in the format "Guid1 = Guid2". Guid1 is the child project (or solution
|
|
// filter)'s GUID, and Guid2 is the solution filter directory to parent the child project (or solution
|
|
// filter) to. This sets up the hierarchical solution explorer tree for all solution folders and projects.
|
|
|
|
System.Action<StringBuilder /* VCSolutionFileContent */, List<MasterProjectFolder> /* Folders */ > FolderProcessorFunction = null;
|
|
FolderProcessorFunction = (LocalVCSolutionFileContent, LocalMasterProjectFolders) =>
|
|
{
|
|
foreach (VisualStudioSolutionFolder CurFolder in LocalMasterProjectFolders)
|
|
{
|
|
string CurFolderGUIDString = CurFolder.FolderGUID.ToString("B").ToUpperInvariant();
|
|
|
|
foreach (MSBuildProjectFile ChildProject in CurFolder.ChildProjects)
|
|
{
|
|
// e.g. "{BF6FB09F-A2A6-468F-BE6F-DEBE07EAD3EA} = {C43B6BB5-3EF0-4784-B896-4099753BCDA9}"
|
|
LocalVCSolutionFileContent.Append(
|
|
" " + ChildProject.ProjectGUID.ToString("B").ToUpperInvariant() + " = " + CurFolderGUIDString + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
foreach (VisualStudioSolutionFolder SubFolder in CurFolder.SubFolders)
|
|
{
|
|
// e.g. "{BF6FB09F-A2A6-468F-BE6F-DEBE07EAD3EA} = {C43B6BB5-3EF0-4784-B896-4099753BCDA9}"
|
|
LocalVCSolutionFileContent.Append(
|
|
" " + SubFolder.FolderGUID.ToString("B").ToUpperInvariant() + " = " + CurFolderGUIDString + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
// Recurse into subfolders
|
|
FolderProcessorFunction(LocalVCSolutionFileContent, CurFolder.SubFolders);
|
|
}
|
|
};
|
|
FolderProcessorFunction(VCSolutionFileContent, RootFolder.SubFolders);
|
|
|
|
VCSolutionFileContent.Append(
|
|
" EndGlobalSection" + ProjectFileGenerator.NewLine);
|
|
}
|
|
}
|
|
|
|
VCSolutionFileContent.Append(
|
|
"EndGlobal" + ProjectFileGenerator.NewLine);
|
|
}
|
|
|
|
|
|
// Save the solution file
|
|
if (bSuccess)
|
|
{
|
|
string SolutionFilePath = FileReference.Combine(MasterProjectPath, SolutionFileName).FullName;
|
|
bSuccess = WriteFileIfChanged(SolutionFilePath, VCSolutionFileContent.ToString());
|
|
}
|
|
|
|
|
|
// Save a solution config file which selects the development editor configuration by default.
|
|
if (bSuccess)
|
|
{
|
|
// Figure out the filename for the SUO file. VS will automatically import the options from earlier versions if necessary.
|
|
FileReference SolutionOptionsFileName;
|
|
switch (ProjectFileFormat)
|
|
{
|
|
case VCProjectFileFormat.VisualStudio2012:
|
|
SolutionOptionsFileName = FileReference.Combine(MasterProjectPath, Path.ChangeExtension(SolutionFileName, "v11.suo"));
|
|
break;
|
|
case VCProjectFileFormat.VisualStudio2013:
|
|
SolutionOptionsFileName = FileReference.Combine(MasterProjectPath, Path.ChangeExtension(SolutionFileName, "v12.suo"));
|
|
break;
|
|
case VCProjectFileFormat.VisualStudio2015:
|
|
SolutionOptionsFileName = FileReference.Combine(MasterProjectPath, ".vs", Path.GetFileNameWithoutExtension(SolutionFileName), "v14", ".suo");
|
|
break;
|
|
case VCProjectFileFormat.VisualStudio2017:
|
|
SolutionOptionsFileName = FileReference.Combine(MasterProjectPath, ".vs", Path.GetFileNameWithoutExtension(SolutionFileName), "v15", ".suo");
|
|
break;
|
|
default:
|
|
throw new BuildException("Unsupported Visual Studio version");
|
|
}
|
|
|
|
// Check it doesn't exist before overwriting it. Since these files store the user's preferences, it'd be bad form to overwrite them.
|
|
if (!FileReference.Exists(SolutionOptionsFileName))
|
|
{
|
|
DirectoryReference.CreateDirectory(SolutionOptionsFileName.Directory);
|
|
|
|
VCSolutionOptions Options = new VCSolutionOptions();
|
|
|
|
// Set the default configuration and startup project
|
|
VCSolutionConfigCombination DefaultConfig = SolutionConfigCombinations.Find(x => x.Configuration == UnrealTargetConfiguration.Development && x.Platform == UnrealTargetPlatform.Win64 && x.TargetConfigurationName == "Editor");
|
|
if (DefaultConfig != null)
|
|
{
|
|
List<VCBinarySetting> Settings = new List<VCBinarySetting>();
|
|
Settings.Add(new VCBinarySetting("ActiveCfg", DefaultConfig.VCSolutionConfigAndPlatformName));
|
|
if (DefaultProject != null)
|
|
{
|
|
Settings.Add(new VCBinarySetting("StartupProject", ((MSBuildProjectFile)DefaultProject).ProjectGUID.ToString("B")));
|
|
}
|
|
Options.SetConfiguration(Settings);
|
|
}
|
|
|
|
// Mark all the projects as closed by default, apart from the startup project
|
|
VCSolutionExplorerState ExplorerState = new VCSolutionExplorerState();
|
|
foreach (ProjectFile ProjectFile in AllProjectFiles)
|
|
{
|
|
string ProjectName = ProjectFile.ProjectFilePath.GetFileNameWithoutExtension();
|
|
if (ProjectFile == DefaultProject)
|
|
{
|
|
ExplorerState.OpenProjects.Add(new Tuple<string, string[]>(ProjectName, new string[] { ProjectName }));
|
|
}
|
|
else
|
|
{
|
|
ExplorerState.OpenProjects.Add(new Tuple<string, string[]>(ProjectName, new string[] { }));
|
|
}
|
|
}
|
|
if (IncludeEnginePrograms)
|
|
{
|
|
ExplorerState.OpenProjects.Add(new Tuple<string, string[]>("Automation", new string[0]));
|
|
}
|
|
Options.SetExplorerState(ExplorerState);
|
|
|
|
// Write the file
|
|
if (Options.Sections.Count > 0)
|
|
{
|
|
Options.Write(SolutionOptionsFileName.FullName);
|
|
}
|
|
}
|
|
}
|
|
|
|
return bSuccess;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Takes a string and "cleans it up" to make it parsable by the Visual Studio source control provider's file format
|
|
/// </summary>
|
|
/// <param name="Str">String to clean up</param>
|
|
/// <returns>The cleaned up string</returns>
|
|
public string CleanupStringForSCC(string Str)
|
|
{
|
|
string Cleaned = Str;
|
|
|
|
// SCC is expecting paths to contain only double-backslashes for path separators. It's a bit weird but we need to do it.
|
|
Cleaned = Cleaned.Replace(Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString());
|
|
Cleaned = Cleaned.Replace(Path.AltDirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar.ToString());
|
|
|
|
// SCC is expecting not to see spaces in these strings, so we'll replace spaces with "\u0020"
|
|
Cleaned = Cleaned.Replace(" ", "\\u0020");
|
|
|
|
return Cleaned;
|
|
}
|
|
|
|
}
|
|
|
|
}
|