UBTPlatformName

UBTPlatformName

#Overview

name: UBTPlatformName

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of UBTPlatformName is to identify the Unreal Build Tool (UBT) target platform for a specific platform configuration in Unreal Engine 5. It serves as a crucial identifier for various engine subsystems to determine platform-specific behavior and settings.

UBTPlatformName is primarily used by the following Unreal Engine subsystems and modules:

  1. LauncherServices
  2. TurnkeySupport
  3. UnrealEd (specifically the CookOnTheFlyServer)
  4. Core (DataDrivenPlatformInfoRegistry)

The value of this variable is typically set in the platform-specific configuration files and is loaded through the DataDrivenPlatformInfoRegistry. If not specified, it defaults to the INI platform name.

UBTPlatformName interacts with several other variables and systems:

  1. It’s used alongside IniPlatformName for platform identification.
  2. It’s used in conjunction with PlatformInfo and DataDrivenPlatformInfo structures.
  3. It’s used to determine if a platform has compiled target support.

Developers should be aware of the following when using this variable:

  1. UBTPlatformName is critical for correct platform identification across various engine systems.
  2. It’s used in SDK verification processes and when launching on specific platforms.
  3. It plays a role in determining whether to build a project for a specific platform.

Best practices when using this variable include:

  1. Ensure that the UBTPlatformName is correctly set in platform-specific configuration files.
  2. Use the UBTPlatformName when performing platform-specific operations or checks rather than relying on string comparisons of platform names.
  3. Be aware of the relationship between UBTPlatformName and other platform identifiers like IniPlatformName to avoid confusion.
  4. When adding support for new platforms, make sure to properly set and use the UBTPlatformName throughout the relevant systems.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:32, section: [DataDrivenPlatformInfo]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Developer/LauncherServices/Private/Profiles/LauncherProfile.h:1760

Scope (from outer to inner):

file
class        class FLauncherProfile final : public ILauncherProfile
function     bool FindAllPlatforms

Source code excerpt:

			// add the UBT platform name to the appropriate list
			TArray<FString>& Platforms = PlatformInfo->PlatformType == EBuildTargetType::Server ? ServerPlatforms : ClientPlatforms;
			Platforms.Add(PlatformInfo->DataDrivenPlatformInfo->UBTPlatformName.ToString());

			// Append any extra UAT flags specified for this platform flavor
			if (!PlatformInfo->UATCommandLine.IsEmpty())
			{
				OptionalParams += PlatformInfo->UATCommandLine;
			}

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeyEditorSupport.cpp:106

Scope (from outer to inner):

file
function     void FTurnkeyEditorSupport::LaunchRunningMap

Source code excerpt:

		}
					
		FString UBTPlatformName = PlatformInfo->DataDrivenPlatformInfo->UBTPlatformString;
		FString IniPlatformName = PlatformInfo->IniPlatformName.ToString();

		check(PlatformInfo);

		if (FInstalledPlatformInfo::Get().IsPlatformMissingRequiredFile(UBTPlatformName))
		{
			if (!FInstalledPlatformInfo::OpenInstallerOptions())
			{
				FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("MissingPlatformFilesLaunch", "Missing required files to launch on this platform."));
			}
			return;

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeyEditorSupport.cpp:140

Scope (from outer to inner):

file
function     void FTurnkeyEditorSupport::LaunchRunningMap

Source code excerpt:

			{
				const FString& RealDeviceName = TargetDeviceId.GetDeviceName();
				const bool bSkipPlatformCheck = VerifiedPlatformsAndDevices.Contains(UBTPlatformName);
				const bool bSkipDeviceCheck = VerifiedPlatformsAndDevices.Contains(RealDeviceName);

				FString CommandLine;
				if (bSkipPlatformCheck && bSkipDeviceCheck)
				{
					GUnrealEd->RequestPlaySession(SessionParams);

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeyEditorSupport.cpp:151

Scope (from outer to inner):

file
function     void FTurnkeyEditorSupport::LaunchRunningMap

Source code excerpt:

				else if (bSkipPlatformCheck && !bSkipDeviceCheck)
				{
					CommandLine = FString::Printf(TEXT("Turnkey -command=VerifySdk -UpdateIfNeeded -platform=%s -SkipPlatform -noturnkeyvariables -device=%s -utf8output -WaitForUATMutex %s %s"), *UBTPlatformName, *RealDeviceName, *PlatformInfo->UATCommandLine, *ITurnkeyIOModule::Get().GetUATParams());
				}
				else
				{
					CommandLine = FString::Printf(TEXT("Turnkey -command=VerifySdk -UpdateIfNeeded -platform=%s -noturnkeyvariables -device=%s -utf8output -WaitForUATMutex %s %s"), *UBTPlatformName, *RealDeviceName, *PlatformInfo->UATCommandLine, *ITurnkeyIOModule::Get().GetUATParams());
				}
				
				if (!ProjectPath.IsEmpty())
				{
					CommandLine = FString::Printf(TEXT(" -ScriptsForProject=\"%s\" %s -project=\"%s\""), *ProjectPath, *CommandLine, *ProjectPath);
				}

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeyEditorSupport.cpp:165

Scope (from outer to inner):

file
function     void FTurnkeyEditorSupport::LaunchRunningMap
lambda-function

Source code excerpt:


				IUATHelperModule::Get().CreateUatTask(CommandLine, FText::FromString(IniPlatformName), TaskName, TaskName, FAppStyle::Get().GetBrush(TEXT("MainFrame.PackageProject")), nullptr,
					[SessionParams, RealDeviceName, UBTPlatformName](FString Result, double)
					{
						// unfortunate string comparison for success
						bool bWasSuccessful = Result == TEXT("Completed");
						AsyncTask(ENamedThreads::GameThread, [SessionParams, bWasSuccessful, RealDeviceName, UBTPlatformName]()
							{
								if (bWasSuccessful)
								{
									GUnrealEd->RequestPlaySession(SessionParams);
									VerifiedPlatformsAndDevices.Add(RealDeviceName);
									VerifiedPlatformsAndDevices.Add(UBTPlatformName);
								}
								else
								{
									TSharedRef<SWindow> Win = OpenMsgDlgInt_NonModal(EAppMsgType::YesNo, LOCTEXT("SDKCheckFailed", "SDK Verification failed. Would you like to attempt the Launch On anyway?"), LOCTEXT("SDKCheckFailedTitle", "SDK Verification"),
										FOnMsgDlgResult::CreateLambda([SessionParams](const TSharedRef<SWindow>&, EAppReturnType::Type Choice)
											{

#Loc: <Workspace>/Engine/Source/Editor/TurnkeySupport/Private/TurnkeySupportModule.cpp:196

Scope (from outer to inner):

file
class        class FTurnkeySupportCallbacks
function     static bool ShouldBuildProject

Source code excerpt:


				// Check if the receipt is for a matching promoted target
				FString UBTPlatformName = TargetPlatform->GetTargetPlatformInfo().DataDrivenPlatformInfo->UBTPlatformString;

				extern LAUNCHERSERVICES_API bool HasPromotedTarget(const TCHAR * BaseDir, const TCHAR * TargetName, const TCHAR * Platform, EBuildConfiguration Configuration, const TCHAR * Architecture);
				if (HasPromotedTarget(*BaseDir, *TargetName, *UBTPlatformName, ConfigurationInfo.Configuration, nullptr))
				{
					bBuild = false;
				}
			}
		}
		else if (PackagingSettings->Build == EProjectPackagingBuild::IfEditorWasBuiltLocally)

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/CookOnTheFlyServer.cpp:10921

Scope (from outer to inner):

file
namespace    UE::Cook
function     void FBeginCookConfigSettings::LoadNeverCookLocal

Source code excerpt:

		for (const ITargetPlatform* Platform : BeginContext.TargetPlatforms)
		{
			FString UBTPlatformName;
			Platform->GetPlatformInfo().UBTPlatformName.ToString(UBTPlatformName);
			UBTPlatformStrings.Emplace(MoveTemp(UBTPlatformName));
		}

		BeginContext.COTFS.DiscoverPlatformSpecificNeverCookPackages(BeginContext.TargetPlatforms, UBTPlatformStrings, *this);
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Misc/DataDrivenPlatformInfoRegistry.cpp:390

Scope (from outer to inner):

file
function     static void LoadDDPIIniSettings

Source code excerpt:

	DDPIGetBool(IniFile, TEXT("bIsEnabled"), Info.bEnabledForUse);

	DDPIGetName(IniFile, TEXT("UBTPlatformName"), Info.UBTPlatformName);
	// if unspecified, use the ini platform name (only Win64 breaks this)
	if (Info.UBTPlatformName == NAME_None)
	{
		Info.UBTPlatformName = PlatformName;
	}
	Info.UBTPlatformString = Info.UBTPlatformName.ToString();
		
	GCommandLinePrefix = TEXT("");

	// now that we have all targetplatforms in a single TP module per platform, just look for it (or a ShaderFormat for other tools that may want this)
	// we could look for Platform*, but then platforms that are a substring of another one could return a false positive (Windows* would find Windows31TargetPlatform)
	Info.bHasCompiledTargetSupport = FDataDrivenPlatformInfoRegistry::HasCompiledSupportForPlatform(PlatformName, FDataDrivenPlatformInfoRegistry::EPlatformNameType::TargetPlatform);

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Misc/DataDrivenPlatformInfoRegistry.cpp:614

Scope (from outer to inner):

file
function     bool FDataDrivenPlatformInfoRegistry::HasCompiledSupportForPlatform

Source code excerpt:

		{
			// if this platform matches the UBT platform name, check it's Ini name
			if (Pair.Value.UBTPlatformName == PlatformName)
			{
				return HasCompiledSupportForPlatform(Pair.Key, EPlatformNameType::Ini);
			}
		}

		return false;

#Loc: <Workspace>/Engine/Source/Runtime/Core/Public/Misc/DataDrivenPlatformInfoRegistry.h:201

Scope: file

Source code excerpt:


	/** An identifier that corresponds to UBT's UnrealTargetPlatform enum (and by proxy, FGenericPlatformMisc::GetUBTPlatform()), as well as the directory Binaries are placed under */
	FName UBTPlatformName;
	FString UBTPlatformString;

	/** Whether or not the platform can use Crash Reporter */
	bool bCanUseCrashReporter;

	/** Enabled for use */