Fix missing console platforms

#3746
This commit is contained in:
Wojtek Figat
2026-01-12 00:31:59 +01:00
parent 0364fd629b
commit fc2f56aca6
15 changed files with 136 additions and 322 deletions

View File

@@ -29,7 +29,6 @@ namespace Flax.Deps.Dependencies
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}

View File

@@ -1,6 +1,5 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System;
using System.IO;
using System.Linq;
using Flax.Build;

View File

@@ -43,6 +43,12 @@ namespace Flax.Deps.Dependencies
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.XboxOne:
case TargetPlatform.XboxScarlett:
return new[]
{
TargetArchitecture.x64,
};
default: return new TargetArchitecture[0];
}
}

View File

@@ -1,11 +1,8 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using Flax.Build;
using Flax.Build.Platforms;
namespace Flax.Deps.Dependencies
{
@@ -23,8 +20,8 @@ namespace Flax.Deps.Dependencies
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
return new[]
{
TargetPlatform.Windows,
};
default: return new TargetPlatform[0];
@@ -40,8 +37,8 @@ namespace Flax.Deps.Dependencies
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};

View File

@@ -17,70 +17,6 @@ namespace Flax.Deps.Dependencies
{
private string root, nvCloth;
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
TargetPlatform.XboxOne,
TargetPlatform.XboxScarlett,
TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.Switch,
TargetPlatform.Android,
};
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
case TargetPlatform.Mac:
return new[]
{
TargetPlatform.Mac,
TargetPlatform.iOS,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <inheritdoc />
public override void Build(BuildOptions options)
{

View File

@@ -70,6 +70,16 @@ namespace Flax.Deps.Dependencies
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.iOS:
return new[]
{
TargetArchitecture.ARM64,
};
case TargetPlatform.Android:
return new[]
{
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}

View File

@@ -17,70 +17,6 @@ namespace Flax.Deps.Dependencies
/// <seealso cref="Flax.Deps.Dependency" />
class PhysX : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
TargetPlatform.XboxOne,
TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.XboxScarlett,
TargetPlatform.Android,
TargetPlatform.Switch,
};
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
case TargetPlatform.Mac:
return new[]
{
TargetPlatform.Mac,
TargetPlatform.iOS,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
private string root;
private string projectGenDir;
private string projectGenPath;

View File

@@ -42,18 +42,6 @@ namespace Flax.Deps.Dependencies
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}

View File

@@ -1,6 +1,5 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System.Collections.Generic;
using System.IO;
using Flax.Build;
@@ -76,7 +75,7 @@ namespace Flax.Deps.Dependencies
{
case TargetPlatform.Windows:
{
string buildDir = Path.Combine(root, "build-" + architecture.ToString());
string buildDir = Path.Combine(root, "build-" + architecture);
var isa = architecture == TargetArchitecture.ARM64 ? "-DASTCENC_ISA_NEON=ON" : "-DASTCENC_ISA_SSE2=ON";
var lib = architecture == TargetArchitecture.ARM64 ? "astcenc-neon-static.lib" : "astcenc-sse2-static.lib";
SetupDirectory(buildDir, true);
@@ -84,11 +83,11 @@ namespace Flax.Deps.Dependencies
BuildCmake(buildDir);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(buildDir, "Source/Release", lib), Path.Combine(depsFolder, "astcenc.lib"));
}
break;
break;
}
case TargetPlatform.Mac:
{
string buildDir = Path.Combine(root, "build-" + architecture.ToString());
string buildDir = Path.Combine(root, "build-" + architecture);
var isa = architecture == TargetArchitecture.ARM64 ? "-DASTCENC_ISA_NEON=ON" : "-DASTCENC_ISA_SSE2=ON";
var lib = architecture == TargetArchitecture.ARM64 ? "libastcenc-neon-static.a" : "libastcenc-sse2-static.a";
SetupDirectory(buildDir, true);
@@ -96,8 +95,8 @@ namespace Flax.Deps.Dependencies
BuildCmake(buildDir);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(buildDir, "Source", lib), Path.Combine(depsFolder, "libastcenc.a"));
break;
}
break;
}
}
}

View File

@@ -107,7 +107,7 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Windows:
{
// Build for Windows
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
var buildDir = Path.Combine(root, "build-" + architecture);
var solutionPath = Path.Combine(buildDir, "CURL.sln");
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_STATIC_CRT=OFF");

View File

@@ -15,70 +15,6 @@ namespace Flax.Deps.Dependencies
/// <seealso cref="Flax.Deps.Dependency" />
class freetype : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
TargetPlatform.XboxOne,
TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.XboxScarlett,
TargetPlatform.Android,
TargetPlatform.Switch,
};
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
case TargetPlatform.Mac:
return new[]
{
TargetPlatform.Mac,
TargetPlatform.iOS,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <inheritdoc />
public override void Build(BuildOptions options)
{

View File

@@ -78,6 +78,18 @@ namespace Flax.Deps.Dependencies
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.XboxOne:
case TargetPlatform.XboxScarlett:
return new[]
{
TargetArchitecture.x64,
};
case TargetPlatform.Switch:
case TargetPlatform.Android:
return new[]
{
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}

View File

@@ -43,36 +43,6 @@ namespace Flax.Deps.Dependencies
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <inheritdoc />
public override bool BuildByDefault => false;

View File

@@ -15,70 +15,6 @@ namespace Flax.Deps.Dependencies
/// <seealso cref="Flax.Deps.Dependency" />
class vorbis : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
TargetPlatform.XboxOne,
TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.XboxScarlett,
TargetPlatform.Android,
TargetPlatform.Switch,
};
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
case TargetPlatform.Mac:
return new[]
{
TargetPlatform.Mac,
TargetPlatform.iOS,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
private struct Binary
{
public string Filename;

View File

@@ -52,7 +52,6 @@ namespace Flax.Deps
/// </summary>
protected static TargetPlatform BuildPlatform => Platform.BuildPlatform.Target;
private static Version? _cmakeVersion;
protected static Version CMakeVersion
{
@@ -60,11 +59,19 @@ namespace Flax.Deps
{
if (_cmakeVersion == null)
{
var versionOutput = Utilities.ReadProcessOutput("cmake", "--version");
var versionStart = versionOutput.IndexOf("cmake version ") + "cmake version ".Length;
var versionEnd = versionOutput.IndexOfAny(['-', '\n', '\r'], versionStart); // End of line or dash before Git hash
var versionString = versionOutput.Substring(versionStart, versionEnd - versionStart);
_cmakeVersion = new Version(versionString);
try
{
var versionOutput = Utilities.ReadProcessOutput("cmake", "--version");
var versionStart = versionOutput.IndexOf("cmake version ") + "cmake version ".Length;
var versionEnd = versionOutput.IndexOfAny(['-', '\n', '\r'], versionStart); // End of line or dash before Git hash
var versionString = versionOutput.Substring(versionStart, versionEnd - versionStart);
_cmakeVersion = new Version(versionString);
}
catch (Exception)
{
// Assume old version by default (in case of errors)
_cmakeVersion = new Version(3, 0);
}
}
return _cmakeVersion;
}
@@ -73,12 +80,95 @@ namespace Flax.Deps
/// <summary>
/// Gets the platforms list supported by this dependency to build on the current build platform (based on <see cref="Platform.BuildPlatform"/>).
/// </summary>
public abstract TargetPlatform[] Platforms { get; }
public virtual TargetPlatform[] Platforms
{
get
{
// The most common build setup
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
TargetPlatform.XboxOne,
TargetPlatform.XboxScarlett,
TargetPlatform.PS4,
TargetPlatform.PS5,
TargetPlatform.Android,
TargetPlatform.Switch,
};
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
case TargetPlatform.Mac:
return new[]
{
TargetPlatform.Mac,
TargetPlatform.iOS,
};
default: return new TargetPlatform[0];
}
}
}
/// <summary>
/// Gets the architectures list supported by this dependency to build on the current build platform (based on <see cref="Platform.BuildPlatform"/>).
/// </summary>
public abstract TargetArchitecture[] Architectures { get; }
public virtual TargetArchitecture[] Architectures
{
get
{
// Default value returns all supported architectures for all supported platforms
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.Linux:
return new[]
{
TargetArchitecture.x64,
//TargetArchitecture.ARM64,
};
case TargetPlatform.Mac:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
case TargetPlatform.XboxOne:
case TargetPlatform.XboxScarlett:
case TargetPlatform.PS4:
case TargetPlatform.PS5:
return new[]
{
TargetArchitecture.x64,
};
case TargetPlatform.Switch:
return new[]
{
TargetArchitecture.ARM64,
};
case TargetPlatform.Android:
return new[]
{
TargetArchitecture.ARM64,
};
case TargetPlatform.iOS:
return new[]
{
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <summary>
/// True if build dependency by default, otherwise only when explicitly specified via command line.