Files
UnrealEngineUWP/Engine/Source/Developer/DesktopPlatform/Private/PlatformInfo.cpp
Ankit Khare 35252ac72f UEPLAT-131 Enable Rocket builds for HTML5.
(Currently just on Win64 host)

#codereview kellan.carr, ben.marsh

[CL 2411843 by Ankit Khare in Main branch]
2015-01-20 01:29:07 -05:00

200 lines
19 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "DesktopPlatformPrivatePCH.h"
#include "PlatformInfo.h"
#define LOCTEXT_NAMESPACE "PlatformInfo"
namespace PlatformInfo
{
namespace
{
FPlatformInfo BuildPlatformInfo(const FName& InPlatformInfoName, const FName& InTargetPlatformName, const FText& InDisplayName, const EPlatformType InPlatformType, const EPlatformFlags::Flags InPlatformFlags, const FPlatformIconPaths& InIconPaths, const FString& InUATCommandLine, const FString& InAutoSDKPath, EPlatformSDKStatus InStatus, const FString& InTutorial, bool InEnabled, bool InBinary)
{
FPlatformInfo PlatformInfo;
PlatformInfo.PlatformInfoName = InPlatformInfoName;
PlatformInfo.TargetPlatformName = InTargetPlatformName;
// See if this name also contains a flavor
const FString InPlatformInfoNameString = InPlatformInfoName.ToString();
{
int32 UnderscoreLoc;
if(InPlatformInfoNameString.FindChar(TEXT('_'), UnderscoreLoc))
{
PlatformInfo.VanillaPlatformName = *InPlatformInfoNameString.Mid(0, UnderscoreLoc);
PlatformInfo.PlatformFlavor = *InPlatformInfoNameString.Mid(UnderscoreLoc + 1);
}
else
{
PlatformInfo.VanillaPlatformName = InPlatformInfoName;
}
}
PlatformInfo.DisplayName = InDisplayName;
PlatformInfo.PlatformType = InPlatformType;
PlatformInfo.PlatformFlags = InPlatformFlags;
PlatformInfo.IconPaths = InIconPaths;
PlatformInfo.UATCommandLine = InUATCommandLine;
PlatformInfo.AutoSDKPath = InAutoSDKPath;
// Generate the icon style names for FEditorStyle
PlatformInfo.IconPaths.NormalStyleName = *FString::Printf(TEXT("Launcher.Platform_%s"), *InPlatformInfoNameString);
PlatformInfo.IconPaths.LargeStyleName = *FString::Printf(TEXT("Launcher.Platform_%s.Large"), *InPlatformInfoNameString);
PlatformInfo.IconPaths.XLargeStyleName = *FString::Printf(TEXT("Launcher.Platform_%s.XLarge"), *InPlatformInfoNameString);
// SDK data
PlatformInfo.SDKStatus = InStatus;
PlatformInfo.SDKTutorial = InTutorial;
// Distribution data
PlatformInfo.bEnabledForUse = InEnabled;
PlatformInfo.bEnabledInBinary = InBinary;
return PlatformInfo;
}
#if PLATFORM_WINDOWS
static const bool IsAvailableOnWindows = true;
static const bool IsAvailableOnMac = false;
static const bool IsAvailableOnLinux = false;
static const FString IOSTutorial = TEXT("/Engine/Tutorial/Mobile/InstallingiTunesTutorial.InstallingiTunesTutorial");
#elif PLATFORM_MAC
static const bool IsAvailableOnWindows = false;
static const bool IsAvailableOnMac = true;
static const bool IsAvailableOnLinux = false;
static const FString IOSTutorial = TEXT("/Engine/Tutorial/Installation/InstallingXCodeTutorial.InstallingXCodeTutorial");
#elif PLATFORM_LINUX
static const bool IsAvailableOnWindows = false;
static const bool IsAvailableOnMac = false;
static const bool IsAvailableOnLinux = true;
static const FString IOSTutorial = TEXT("/Engine/Tutorial/NotYetImplemented");
#endif
static const FPlatformInfo PlatformInfoArray[] = {
// PlatformInfoName TargetPlatformName DisplayName PlatformType PlatformFlags IconPaths UATCommandLine AutoSDKPath SDKStatus SDKTutorial EnabledForUse EnabledForBinary
BuildPlatformInfo(TEXT("WindowsNoEditor"), TEXT("WindowsNoEditor"), LOCTEXT("WindowsNoEditor", "Windows"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_24x"), TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingVisualStudioTutorial.InstallingVisualStudioTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("WindowsNoEditor_Win32"), TEXT("WindowsNoEditor"), LOCTEXT("WindowsNoEditor_Win32", "Windows (32-bit)"), EPlatformType::Game, EPlatformFlags::BuildFlavor, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_24x"), TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_128x")), TEXT("-targetplatform=Win32"), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingVisualStudioTutorial.InstallingVisualStudioTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("WindowsNoEditor_Win64"), TEXT("WindowsNoEditor"), LOCTEXT("WindowsNoEditor_Win64", "Windows (64-bit)"), EPlatformType::Game, EPlatformFlags::BuildFlavor, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_24x"), TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_128x")), TEXT("-targetplatform=Win64"), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingVisualStudioTutorial.InstallingVisualStudioTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("Windows"), TEXT("Windows"), LOCTEXT("WindowsEditor", "Windows (Editor)"), EPlatformType::Editor, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_Windows_24x"), TEXT("Launcher/WindowsTarget/Platform_Windows_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingVisualStudioTutorial.InstallingVisualStudioTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("WindowsClient"), TEXT("WindowsClient"), LOCTEXT("WindowsClient", "Windows (Client-only)"), EPlatformType::Client, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_Windows_24x"), TEXT("Launcher/WindowsTarget/Platform_Windows_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingVisualStudioTutorial.InstallingVisualStudioTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("WindowsServer"), TEXT("WindowsServer"), LOCTEXT("WindowsServer", "Windows (Dedicated Server)"), EPlatformType::Server, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_WindowsServer_24x"), TEXT("Launcher/WindowsTarget/Platform_WindowsServer_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingVisualStudioTutorial.InstallingVisualStudioTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("MacNoEditor"), TEXT("MacNoEditor"), LOCTEXT("MacNoEditor", "Mac"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/MacTarget/Platform_Mac_24x"), TEXT("Launcher/MacTarget/Platform_Mac_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingXCodeTutorial.InstallingXCodeTutorial"), IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Mac"), TEXT("Mac"), LOCTEXT("MacEditor", "Mac (Editor)"), EPlatformType::Editor, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/MacTarget/Platform_Mac_24x"), TEXT("Launcher/MacTarget/Platform_Mac_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingXCodeTutorial.InstallingXCodeTutorial"), IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("MacClient"), TEXT("MacClient"), LOCTEXT("MacClient", "Mac (Client-only)"), EPlatformType::Client, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/MacTarget/Platform_Mac_24x"), TEXT("Launcher/MacTarget/Platform_Mac_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingXCodeTutorial.InstallingXCodeTutorial"), IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("MacServer"), TEXT("MacServer"), LOCTEXT("MacServer", "Mac (Dedicated Server)"), EPlatformType::Server, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/MacTarget/Platform_Mac_24x"), TEXT("Launcher/MacTarget/Platform_Mac_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Installation/InstallingXCodeTutorial.InstallingXCodeTutorial"), IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("LinuxNoEditor"), TEXT("LinuxNoEditor"), LOCTEXT("LinuxNoEditor", "Linux"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/LinuxTarget/Platform_Linux_24x"), TEXT("Launcher/LinuxTarget/Platform_Linux_128x")), TEXT(""), TEXT("Linux_x64"), EPlatformSDKStatus::Unknown, TEXT(""), IsAvailableOnLinux || IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("Linux"), TEXT("Linux"), LOCTEXT("LinuxEditor", "Linux (Editor)"), EPlatformType::Editor, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/LinuxTarget/Platform_Linux_24x"), TEXT("Launcher/LinuxTarget/Platform_Linux_128x")), TEXT(""), TEXT("Linux_x64"), EPlatformSDKStatus::Unknown, TEXT(""), IsAvailableOnLinux, true),
BuildPlatformInfo(TEXT("LinuxClient"), TEXT("LinuxClient"), LOCTEXT("LinuxClient", "Linux (Client-only)"), EPlatformType::Client, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/LinuxTarget/Platform_Linux_24x"), TEXT("Launcher/LinuxTarget/Platform_Linux_128x")), TEXT(""), TEXT("Linux_x64"), EPlatformSDKStatus::Unknown, TEXT(""), IsAvailableOnLinux || IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("LinuxServer"), TEXT("LinuxServer"), LOCTEXT("LinuxServer", "Linux (Dedicated Server)"), EPlatformType::Server, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/LinuxTarget/Platform_Linux_24x"), TEXT("Launcher/LinuxTarget/Platform_Linux_128x")), TEXT(""), TEXT("Linux_x64"), EPlatformSDKStatus::Unknown, TEXT(""), IsAvailableOnLinux || IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("IOS"), TEXT("IOS"), LOCTEXT("IOS", "iOS"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/iOSTarget/Platform_iOS_24x"), TEXT("Launcher/iOSTarget/Platform_iOS_128x")), TEXT(""), TEXT(""), EPlatformSDKStatus::Unknown, IOSTutorial, IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android"), TEXT("Android"), LOCTEXT("Android", "Android"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT(""), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android_All"), TEXT("Android"), LOCTEXT("Android_All", "Android (All)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT(""), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android_ATC"), TEXT("Android_ATC"), LOCTEXT("Android_ATC", "Android (ATC)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_ATC_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ATC"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android_DXT"), TEXT("Android_DXT"), LOCTEXT("Android_DXT", "Android (DXT)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_DXT_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=DXT"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android_ETC1"), TEXT("Android_ETC1"), LOCTEXT("Android_ETC1", "Android (ETC1)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_ETC1_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ETC1"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android_ETC2"), TEXT("Android_ETC2"), LOCTEXT("Android_ETC2", "Android (ETC2)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_ETC2_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ETC2"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("Android_PVRTC"), TEXT("Android_PVRTC"), LOCTEXT("Android_PVRTC", "Android (PVRTC)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_PVRTC_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=PVRTC"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("/Engine/Tutorial/Mobile/SettingUpAndroidTutorial.SettingUpAndroidTutorial"), IsAvailableOnWindows || IsAvailableOnMac, true),
// @todo es31: Set the final false to true when ES31 is in Binary releases
BuildPlatformInfo(TEXT("Android_ES31"), TEXT("Android_ES31"), LOCTEXT("Android_ES31", "Android (ES31+AEP)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_ES31_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ES31"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("Shared/Tutorials/SettingUpAndroidTutorial"), IsAvailableOnWindows, false),
// BuildPlatformInfo(TEXT("Android_GL4"), TEXT("Android_GL4"), LOCTEXT("Android_GL4", "Android (GL4)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/AndroidTarget/Platform_Android_GL4_24x"), TEXT("Launcher/AndroidTarget/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=GL4"), TEXT("Android"), EPlatformSDKStatus::Unknown, TEXT("Shared/Tutorials/SettingUpAndroidTutorial"), IsAvailableOnWindows, true),
BuildPlatformInfo(TEXT("HTML5"), TEXT("HTML5"), LOCTEXT("HTML5", "HTML5"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/HTML5Target/Platform_HTML5_24x"), TEXT("Launcher/HTML5Target/Platform_HTML5_128x")), TEXT(""), TEXT("HTML5"), EPlatformSDKStatus::Unknown, TEXT("Platforms/HTML5/GettingStarted"), IsAvailableOnWindows || IsAvailableOnMac, true),
BuildPlatformInfo(TEXT("PS4"), TEXT("PS4"), LOCTEXT("PS4", "PlayStation 4"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/PS4Target/Platform_PS4_24x"), TEXT("Launcher/PS4Target/Platform_PS4_128x")), TEXT(""), TEXT("PS4"), EPlatformSDKStatus::Unknown, TEXT("Platforms/PS4/GettingStarted"), IsAvailableOnWindows, false),
BuildPlatformInfo(TEXT("XboxOne"), TEXT("XboxOne"), LOCTEXT("XboxOne", "Xbox One"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/XboxOneTarget/Platform_XboxOne_24x"), TEXT("Launcher/XboxOneTarget/Platform_XboxOne_128x")), TEXT(""), TEXT("XboxOne"), EPlatformSDKStatus::Unknown, TEXT("Platforms/XboxOne/GettingStarted"), IsAvailableOnWindows, false),
//BuildPlatformInfo(TEXT("WinRT"), TEXT("WinRT"), LOCTEXT("WinRT", "Windows RT"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_24x"), TEXT("Launcher/WindowsTarget/Platform_WindowsNoEditor_128x")), TEXT("")),
};
} // anonymous namespace
const FPlatformInfo* FindPlatformInfo(const FName& InPlatformName)
{
for(const FPlatformInfo& PlatformInfo : PlatformInfoArray)
{
if(PlatformInfo.PlatformInfoName == InPlatformName)
{
return &PlatformInfo;
}
}
return nullptr;
}
const FPlatformInfo* FindVanillaPlatformInfo(const FName& InPlatformName)
{
const FPlatformInfo* const FoundInfo = FindPlatformInfo(InPlatformName);
return (FoundInfo) ? (FoundInfo->IsVanilla()) ? FoundInfo : FindPlatformInfo(FoundInfo->VanillaPlatformName) : nullptr;
}
const FPlatformInfo* GetPlatformInfoArray(int32& OutNumPlatforms)
{
OutNumPlatforms = ARRAY_COUNT(PlatformInfoArray);
return PlatformInfoArray;
}
void UpdatePlatformSDKStatus(FString InPlatformName, EPlatformSDKStatus InStatus)
{
for(const FPlatformInfo& PlatformInfo : PlatformInfoArray)
{
if(PlatformInfo.VanillaPlatformName == FName(*InPlatformName))
{
const_cast<FPlatformInfo&>(PlatformInfo).SDKStatus = InStatus;
}
}
}
FPlatformEnumerator EnumeratePlatformInfoArray()
{
return FPlatformEnumerator(PlatformInfoArray, ARRAY_COUNT(PlatformInfoArray));
}
TArray<FVanillaPlatformEntry> BuildPlatformHierarchy(const EPlatformFilter InFilter)
{
TArray<FVanillaPlatformEntry> VanillaPlatforms;
// Build up a tree from the platforms we support (vanilla outers, with a list of flavors)
// PlatformInfoArray should be ordered in such a way that the vanilla platforms always appear before their flavors
for(const FPlatformInfo& PlatformInfo : PlatformInfoArray)
{
if(PlatformInfo.IsVanilla())
{
VanillaPlatforms.Add(FVanillaPlatformEntry(&PlatformInfo));
}
else
{
const bool bHasBuildFlavor = !!(PlatformInfo.PlatformFlags & EPlatformFlags::BuildFlavor);
const bool bHasCookFlavor = !!(PlatformInfo.PlatformFlags & EPlatformFlags::CookFlavor);
const bool bValidFlavor =
InFilter == EPlatformFilter::All ||
(InFilter == EPlatformFilter::BuildFlavor && bHasBuildFlavor) ||
(InFilter == EPlatformFilter::CookFlavor && bHasCookFlavor);
if(bValidFlavor)
{
const FName VanillaPlatformName = PlatformInfo.VanillaPlatformName;
FVanillaPlatformEntry* const VanillaEntry = VanillaPlatforms.FindByPredicate([VanillaPlatformName](const FVanillaPlatformEntry& Item) -> bool
{
return Item.PlatformInfo->PlatformInfoName == VanillaPlatformName;
});
check(VanillaEntry);
VanillaEntry->PlatformFlavors.Add(&PlatformInfo);
}
}
}
return VanillaPlatforms;
}
} // namespace PlatformFamily
#undef LOCTEXT_NAMESPACE