Add support for Game Cooker on Linux
This commit is contained in:
@@ -101,7 +101,7 @@ bool CompileScriptsStep::DeployBinaries(CookingData& data, const String& path, c
|
||||
// Deploy files
|
||||
Array<String> files(16);
|
||||
const String outputPath = StringUtils::GetDirectoryName(path);
|
||||
FileSystem::DirectoryGetFiles(files, outputPath, TEXT("*.*"), DirectorySearchOption::TopDirectoryOnly);
|
||||
FileSystem::DirectoryGetFiles(files, outputPath, TEXT(""), DirectorySearchOption::TopDirectoryOnly);
|
||||
for (int32 i = files.Count() - 1; i >= 0; i--)
|
||||
{
|
||||
bool skip = false;
|
||||
|
||||
@@ -368,6 +368,7 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
// Compile for a target platform
|
||||
switch (data.Data.Platform)
|
||||
{
|
||||
#if PLATFORM_TOOLS_WINDOWS
|
||||
case BuildPlatform::Windows32:
|
||||
case BuildPlatform::Windows64:
|
||||
{
|
||||
@@ -391,6 +392,7 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_UWP
|
||||
case BuildPlatform::UWPx86:
|
||||
case BuildPlatform::UWPx64:
|
||||
@@ -408,12 +410,14 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_UWP
|
||||
case BuildPlatform::XboxOne:
|
||||
{
|
||||
const char* platformDefineName = "PLATFORM_XBOX_ONE";
|
||||
COMPILE_PROFILE(DirectX_SM4, SHADER_FILE_CHUNK_INTERNAL_D3D_SM4_CACHE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_LINUX
|
||||
case BuildPlatform::LinuxX64:
|
||||
{
|
||||
@@ -426,24 +430,30 @@ bool ProcessShaderBase(CookAssetsStep::AssetCookData& data, ShaderAssetBase* ass
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_PS4
|
||||
case BuildPlatform::PS4:
|
||||
{
|
||||
const char* platformDefineName = "PLATFORM_PS4";
|
||||
COMPILE_PROFILE(PS4, SHADER_FILE_CHUNK_INTERNAL_GENERIC_CACHE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_XBOX_SCARLETT
|
||||
case BuildPlatform::XboxScarlett:
|
||||
{
|
||||
const char* platformDefineName = "PLATFORM_XBOX_SCARLETT";
|
||||
COMPILE_PROFILE(DirectX_SM6, SHADER_FILE_CHUNK_INTERNAL_D3D_SM6_CACHE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_ANDROID
|
||||
case BuildPlatform::AndroidARM64:
|
||||
{
|
||||
const char* platformDefineName = "PLATFORM_ANDROID";
|
||||
COMPILE_PROFILE(Vulkan_SM5, SHADER_FILE_CHUNK_INTERNAL_VULKAN_SM5_CACHE);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
{
|
||||
LOG(Warning, "Not implemented platform or shaders not supported.");
|
||||
@@ -895,21 +905,27 @@ bool CookAssetsStep::Perform(CookingData& data)
|
||||
cache.Load(data);
|
||||
|
||||
// Update build settings
|
||||
#if PLATFORM_TOOLS_WINDOWS
|
||||
{
|
||||
const auto settings = WindowsPlatformSettings::Get();
|
||||
cache.Settings.Windows.SupportDX11 = settings->SupportDX11;
|
||||
cache.Settings.Windows.SupportDX10 = settings->SupportDX10;
|
||||
cache.Settings.Windows.SupportVulkan = settings->SupportVulkan;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_UWP
|
||||
{
|
||||
const auto settings = UWPPlatformSettings::Get();
|
||||
cache.Settings.UWP.SupportDX11 = settings->SupportDX11;
|
||||
cache.Settings.UWP.SupportDX10 = settings->SupportDX10;
|
||||
}
|
||||
#endif
|
||||
#if PLATFORM_TOOLS_LINUX
|
||||
{
|
||||
const auto settings = LinuxPlatformSettings::Get();
|
||||
cache.Settings.Linux.SupportVulkan = settings->SupportVulkan;
|
||||
}
|
||||
#endif
|
||||
{
|
||||
cache.Settings.Global.ShadersNoOptimize = buildSettings->ShadersNoOptimize;
|
||||
cache.Settings.Global.ShadersGenerateDebugData = buildSettings->ShadersGenerateDebugData;
|
||||
|
||||
@@ -51,13 +51,16 @@ public class Editor : EditorModule
|
||||
|
||||
var platformToolsRoot = Path.Combine(FolderPath, "Cooker", "Platform");
|
||||
var platformToolsRootExternal = Path.Combine(Globals.EngineRoot, "Source", "Platforms");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Windows", "PLATFORM_TOOLS_WINDOWS");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "UWP", "PLATFORM_TOOLS_UWP");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "UWP", "PLATFORM_TOOLS_XBOX_ONE");
|
||||
if (options.Platform.Target == TargetPlatform.Windows)
|
||||
{
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Windows", "PLATFORM_TOOLS_WINDOWS");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "UWP", "PLATFORM_TOOLS_UWP");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "UWP", "PLATFORM_TOOLS_XBOX_ONE");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "PS4", "PLATFORM_TOOLS_PS4");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "XboxScarlett", "PLATFORM_TOOLS_XBOX_SCARLETT");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Android", "PLATFORM_TOOLS_ANDROID");
|
||||
}
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Linux", "PLATFORM_TOOLS_LINUX");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "PS4", "PLATFORM_TOOLS_PS4");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "XboxScarlett", "PLATFORM_TOOLS_XBOX_SCARLETT");
|
||||
AddPlatformTools(options, platformToolsRoot, platformToolsRootExternal, "Android", "PLATFORM_TOOLS_ANDROID");
|
||||
|
||||
// Visual Studio integration
|
||||
if (options.Platform.Target == TargetPlatform.Windows)
|
||||
|
||||
@@ -61,6 +61,9 @@ namespace FlaxEditor.Windows
|
||||
|
||||
public abstract class Platform
|
||||
{
|
||||
[HideInEditor]
|
||||
public bool IsSupported;
|
||||
|
||||
[HideInEditor]
|
||||
public bool IsAvailable;
|
||||
|
||||
@@ -93,6 +96,23 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
Output = output;
|
||||
|
||||
// Check if can build on that platform
|
||||
#if PLATFORM_WINDOWS
|
||||
IsSupported = true;
|
||||
#elif PLATFORM_LINUX
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case BuildPlatform.LinuxX64:
|
||||
IsSupported = true;
|
||||
break;
|
||||
default:
|
||||
IsSupported = false;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
#error "Unknown platform."
|
||||
#endif
|
||||
|
||||
// TODO: restore build settings from the Editor cache!
|
||||
|
||||
// Check if can find installed tools for this platform
|
||||
@@ -179,7 +199,11 @@ namespace FlaxEditor.Windows
|
||||
_platform = proxy.Selector.Selected;
|
||||
var platformObj = proxy.PerPlatformOptions[_platform];
|
||||
|
||||
if (platformObj.IsAvailable)
|
||||
if (!platformObj.IsSupported)
|
||||
{
|
||||
layout.Label("This platform is not supported on this system.", TextAlignment.Center);
|
||||
}
|
||||
else if (platformObj.IsAvailable)
|
||||
{
|
||||
string name;
|
||||
switch (_platform)
|
||||
|
||||
Reference in New Issue
Block a user