You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
They need to specify -targetplatform=android as well as the -cookflavor ReviewedBy Daniel.Lamb [CL 2102054 by Jamie Dale in Main branch]
160 lines
12 KiB
C++
160 lines
12 KiB
C++
// Copyright 1998-2014 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)
|
|
{
|
|
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;
|
|
|
|
// 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);
|
|
|
|
return PlatformInfo;
|
|
}
|
|
|
|
static const FPlatformInfo PlatformInfoArray[] = {
|
|
// PlatformInfoName TargetPlatformName DisplayName PlatformType PlatformFlags IconPaths UATCommandLine
|
|
BuildPlatformInfo(TEXT("WindowsNoEditor"), TEXT("WindowsNoEditor"), LOCTEXT("WindowsNoEditor", "Windows"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_WindowsNoEditor_24x"), TEXT("Launcher/Windows/Platform_WindowsNoEditor_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("WindowsNoEditor_Win32"), TEXT("WindowsNoEditor"), LOCTEXT("WindowsNoEditor_Win32", "Windows (32-bit)"), EPlatformType::Game, EPlatformFlags::BuildFlavor, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_WindowsNoEditor_24x"), TEXT("Launcher/Windows/Platform_WindowsNoEditor_128x")), TEXT("-targetplatform=Win32")),
|
|
BuildPlatformInfo(TEXT("WindowsNoEditor_Win64"), TEXT("WindowsNoEditor"), LOCTEXT("WindowsNoEditor_Win64", "Windows (64-bit)"), EPlatformType::Game, EPlatformFlags::BuildFlavor, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_WindowsNoEditor_24x"), TEXT("Launcher/Windows/Platform_WindowsNoEditor_128x")), TEXT("-targetplatform=Win64")),
|
|
BuildPlatformInfo(TEXT("Windows"), TEXT("Windows"), LOCTEXT("WindowsEditor", "Windows (Editor)"), EPlatformType::Editor, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_Windows_24x"), TEXT("Launcher/Windows/Platform_Windows_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("WindowsClient"), TEXT("WindowsClient"), LOCTEXT("WindowsClient", "Windows (Client-only)"), EPlatformType::Client, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_Windows_24x"), TEXT("Launcher/Windows/Platform_Windows_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("WindowsServer"), TEXT("WindowsServer"), LOCTEXT("WindowsServer", "Windows (Dedicated Server)"), EPlatformType::Server, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_WindowsServer_24x"), TEXT("Launcher/Windows/Platform_WindowsServer_128x")), TEXT("")),
|
|
|
|
BuildPlatformInfo(TEXT("MacNoEditor"), TEXT("MacNoEditor"), LOCTEXT("MacNoEditor", "Mac"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Mac/Platform_Mac_24x"), TEXT("Launcher/Mac/Platform_Mac_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("Mac"), TEXT("Mac"), LOCTEXT("MacEditor", "Mac (Editor)"), EPlatformType::Editor, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Mac/Platform_Mac_24x"), TEXT("Launcher/Mac/Platform_Mac_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("MacClient"), TEXT("MacClient"), LOCTEXT("MacClient", "Mac (Client-only)"), EPlatformType::Client, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Mac/Platform_Mac_24x"), TEXT("Launcher/Mac/Platform_Mac_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("MacServer"), TEXT("MacServer"), LOCTEXT("MacServer", "Mac (Dedicated Server)"), EPlatformType::Server, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Mac/Platform_Mac_24x"), TEXT("Launcher/Mac/Platform_Mac_128x")), TEXT("")),
|
|
|
|
BuildPlatformInfo(TEXT("LinuxNoEditor"), TEXT("LinuxNoEditor"), LOCTEXT("LinuxNoEditor", "Linux"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Linux/Platform_Linux_24x"), TEXT("Launcher/Linux/Platform_Linux_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("Linux"), TEXT("Linux"), LOCTEXT("LinuxEditor", "Linux (Editor)"), EPlatformType::Editor, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Linux/Platform_Linux_24x"), TEXT("Launcher/Linux/Platform_Linux_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("LinuxClient"), TEXT("LinuxClient"), LOCTEXT("LinuxClient", "Linux (Client-only)"), EPlatformType::Client, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Linux/Platform_Linux_24x"), TEXT("Launcher/Linux/Platform_Linux_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("LinuxServer"), TEXT("LinuxServer"), LOCTEXT("LinuxServer", "Linux (Dedicated Server)"), EPlatformType::Server, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Linux/Platform_Linux_24x"), TEXT("Launcher/Linux/Platform_Linux_128x")), TEXT("")),
|
|
|
|
BuildPlatformInfo(TEXT("Android"), TEXT("Android"), LOCTEXT("Android", "Android"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("Android_All"), TEXT("Android"), LOCTEXT("Android_All", "Android (All)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("")),
|
|
BuildPlatformInfo(TEXT("Android_ATC"), TEXT("Android_ATC"), LOCTEXT("Android_ATC", "Android (ATC)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_ATC_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ATC")),
|
|
BuildPlatformInfo(TEXT("Android_DXT"), TEXT("Android_DXT"), LOCTEXT("Android_DXT", "Android (DXT)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_DXT_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=DXT")),
|
|
BuildPlatformInfo(TEXT("Android_ETC1"), TEXT("Android_ETC1"), LOCTEXT("Android_ETC1", "Android (ETC1)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_ETC1_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ETC1")),
|
|
BuildPlatformInfo(TEXT("Android_ETC2"), TEXT("Android_ETC2"), LOCTEXT("Android_ETC2", "Android (ETC2)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_ETC2_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=ETC2")),
|
|
BuildPlatformInfo(TEXT("Android_PVRTC"), TEXT("Android_PVRTC"), LOCTEXT("Android_PVRTC", "Android (PVRTC)"), EPlatformType::Game, EPlatformFlags::CookFlavor, FPlatformIconPaths(TEXT("Launcher/Android/Platform_Android_PVRTC_24x"), TEXT("Launcher/Android/Platform_Android_128x")), TEXT("-targetplatform=Android -cookflavor=PVRTC")),
|
|
|
|
BuildPlatformInfo(TEXT("IOS"), TEXT("IOS"), LOCTEXT("IOS", "iOS"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/iOS/Platform_iOS_24x"), TEXT("Launcher/iOS/Platform_iOS_128x")), TEXT("")),
|
|
|
|
BuildPlatformInfo(TEXT("PS4"), TEXT("PS4"), LOCTEXT("PS4", "PlayStation 4"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/PS4/Platform_PS4_24x"), TEXT("Launcher/PS4/Platform_PS4_128x")), TEXT("")),
|
|
|
|
BuildPlatformInfo(TEXT("XboxOne"), TEXT("XboxOne"), LOCTEXT("XboxOne", "Xbox One"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/XboxOne/Platform_XboxOne_24x"), TEXT("Launcher/XboxOne/Platform_XboxOne_128x")), TEXT("")),
|
|
|
|
BuildPlatformInfo(TEXT("HTML5"), TEXT("HTML5"), LOCTEXT("HTML5", "HTML5"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/HTML5/Platform_HTML5_24x"), TEXT("Launcher/HTML5/Platform_HTML5_128x")), TEXT("")),
|
|
|
|
//BuildPlatformInfo(TEXT("WinRT"), TEXT("WinRT"), LOCTEXT("WinRT", "Windows RT"), EPlatformType::Game, EPlatformFlags::None, FPlatformIconPaths(TEXT("Launcher/Windows/Platform_WindowsNoEditor_24x"), TEXT("Launcher/Windows/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;
|
|
}
|
|
|
|
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
|