Fix building consoles

This commit is contained in:
Wojtek Figat
2023-03-06 16:19:16 +01:00
parent aaaf7c5c37
commit 7fce25a2e4
4 changed files with 23 additions and 10 deletions

View File

@@ -13,12 +13,12 @@ namespace Flax.Build.NativeCpp
/// </summary>
public static class IncludesCache
{
private static Dictionary<string, string[]> DirectIncludesCache = new Dictionary<string, string[]>();
private static Dictionary<string, string[]> AllIncludesCache = new Dictionary<string, string[]>();
private static Dictionary<string, DateTime> DirectIncludesTimestampCache = new Dictionary<string, DateTime>();
private static Dictionary<string, DateTime> AllIncludesTimestampCache = new Dictionary<string, DateTime>();
private static Dictionary<string, bool> FileExistsCache = new Dictionary<string, bool>();
private static Dictionary<string, DateTime> FileTimestampCache = new Dictionary<string, DateTime>();
private static Dictionary<string, string[]> DirectIncludesCache = new();
private static Dictionary<string, string[]> AllIncludesCache = new();
private static Dictionary<string, DateTime> DirectIncludesTimestampCache = new();
private static Dictionary<string, DateTime> AllIncludesTimestampCache = new();
private static Dictionary<string, bool> FileExistsCache = new();
private static Dictionary<string, DateTime> FileTimestampCache = new();
private static readonly string IncludeToken = "include";
private static string CachePath;
@@ -231,6 +231,8 @@ namespace Flax.Build.NativeCpp
private static string[] GetDirectIncludes(string sourceFile)
{
if (!FileExists(sourceFile))
return Array.Empty<string>();
DateTime? lastModified = null;
// Try hit the cache

View File

@@ -12,6 +12,7 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
<EnableDefaultCompileItems>False</EnableDefaultCompileItems>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>USE_NETCORE</DefineConstants>
@@ -24,6 +25,13 @@
<ItemGroup>
<Folder Include="Properties" />
<Compile Include="**\*.cs" />
<Compile Remove="obj\**" />
<Compile Include="..\..\Platforms\XboxOne\Flax.Build\*.cs" />
<Compile Include="..\..\Platforms\XboxScarlett\Flax.Build\*.cs" />
<Compile Include="..\..\Platforms\Switch\Flax.Build\*.cs" />
<Compile Include="..\..\Platforms\PS4\Flax.Build\*.cs" />
<Compile Include="..\..\Platforms\PS5\Flax.Build\*.cs" />
</ItemGroup>
<ItemGroup>

View File

@@ -56,7 +56,7 @@ namespace Flax.Build.Platforms
ClangPath = Path.Combine(ToolchainPath, "usr/bin/clang++");
LinkerPath = Path.Combine(ToolchainPath, "usr/bin/clang++");
ArchiverPath = Path.Combine(ToolchainPath, "usr/bin/libtool");
ClangVersion = GetClangVersion(ClangPath);
ClangVersion = GetClangVersion(platform.Target, ClangPath);
SdkPath = Path.Combine(SdkPath, "SDKs");
var sdks = Directory.GetDirectories(SdkPath);
var sdkPrefix = "MacOSX";

View File

@@ -140,7 +140,7 @@ namespace Flax.Build.Platforms
}
// Determinate compiler version
ClangVersion = GetClangVersion(ClangPath);
ClangVersion = GetClangVersion(platform.Target, ClangPath);
LibStdCppVersion = GetLibStdCppVersion(ClangPath) ?? ClangVersion.ToString();
// Check version
@@ -156,13 +156,16 @@ namespace Flax.Build.Platforms
return libName;
}
public static Version GetClangVersion(string path)
public static Version GetClangVersion(TargetPlatform platform, string path)
{
if (!File.Exists(path))
throw new Exception(string.Format("Missing Clang ({0})", path));
// Parse the version
string output = Utilities.ReadProcessOutput(path, "--version -dumpversion");
string arg = "--version -dumpversion";
if (platform == TargetPlatform.PS4)
arg = "--version";
string output = Utilities.ReadProcessOutput(path, arg);
Regex versionPattern = new Regex("\\d+(\\.\\d+)+");
Match versionMatch = versionPattern.Match(output);
if (versionMatch.Success)