6 Commits

Author SHA1 Message Date
7e72e856e1 Fix building ogg+vorbis on macOS
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled
2025-10-18 02:34:50 +03:00
2e78190bf0 Fix NvCloth compilation on Linux and macOS 2025-10-18 02:34:41 +03:00
03df23679f Fix PhysX compilation on Linux and macOS 2025-10-18 02:34:33 +03:00
c2cbf11e4d Fix python tool call on macOS for glslang 2025-10-18 02:34:22 +03:00
f4c3fb1c72 Fix building PhysX on Linux and macOS 2025-10-18 02:34:14 +03:00
5327529f38 Support building OpenAL from Git repository in other platforms 2025-10-18 02:34:04 +03:00
8 changed files with 31 additions and 230 deletions

View File

@@ -208,7 +208,7 @@ public:
typedef typename FallbackAllocation::template Data<T> FallbackData;
bool _useFallback = false;
alignas(sizeof(void*)) byte _data[Capacity * sizeof(T)];
byte _data[Capacity * sizeof(T)];
FallbackData _fallback;
public:

View File

@@ -5,9 +5,6 @@
#include "Types.h"
#include "Engine/Core/Types/StringView.h"
#include "Engine/Core/Types/Guid.h"
#if PLATFORM_ARCH_ARM64
#include "Engine/Core/Core.h"
#endif
class MMethod;
class BinaryModule;

View File

@@ -1,95 +0,0 @@
// 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
{
/// <summary>
/// Visual Studio EnvDTE COM library. https://learn.microsoft.com/en-us/dotnet/api/envdte?view=visualstudiosdk-2022
/// </summary>
/// <seealso cref="Flax.Deps.Dependency" />
class EnvDTE : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <inheritdoc />
public override void Build(BuildOptions options)
{
options.IntermediateFolder.Replace("/" + GetType().Name, "/Microsoft.VisualStudio.Setup.Configuration.Native");
// Get the source
var root = options.IntermediateFolder;
var packagePath = Path.Combine(root, $"package.zip");
if (!File.Exists(packagePath))
{
Downloader.DownloadFileFromUrlToPath("https://www.nuget.org/api/v2/package/Microsoft.VisualStudio.Setup.Configuration.Native/3.14.2075", packagePath);
}
var extractedPath = Path.Combine(root, "extracted");
if (!Directory.Exists(extractedPath))
{
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
archive.ExtractToDirectory(extractedPath);
}
root = extractedPath;
foreach (var platform in options.Platforms)
{
foreach (var architecture in options.Architectures)
{
BuildStarted(platform, architecture);
switch (platform)
{
case TargetPlatform.Windows:
{
var bin = Path.Combine(root, "lib", "native", "v141", architecture.ToString().ToLower());
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(bin, "Microsoft.VisualStudio.Setup.Configuration.Native.lib"), Path.Combine(depsFolder, "Microsoft.VisualStudio.Setup.Configuration.Native.lib"));
var include = Path.Combine(root, "lib", "native", "include");
Utilities.FileCopy(Path.Combine(include, "Setup.Configuration.h"), Path.Combine(options.ThirdPartyFolder, "Microsoft.VisualStudio.Setup.Configuration.Native", "Setup.Configuration.h"));
break;
}
}
}
}
}
}
}

View File

@@ -101,6 +101,8 @@ namespace Flax.Deps.Dependencies
if (!File.Exists(packagePath))
{
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-releases/openal-soft-" + version + ".tar.bz2", packagePath, noSSL);
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
if (Platform.BuildTargetPlatform == TargetPlatform.Windows)
{
// TODO: Maybe use PowerShell Expand-Archive instead?

View File

@@ -423,20 +423,15 @@ namespace Flax.Deps.Dependencies
{
if (architecture == TargetArchitecture.x64 || architecture == TargetArchitecture.ARM64)
{
if (WindowsPlatform.GetToolsets().Any(x => x.Key == WindowsPlatformToolset.v145))
try
{
try
{
Build(options, architecture == TargetArchitecture.x64 ? "vc18win64" : "vc18win-arm64", platform, architecture);
}
catch (Exception e)
{
Log.Warning($"Failed to generate VS2026 solution for PhysX, fallback to VS2022: {e.Message}");
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
}
Build(options, architecture == TargetArchitecture.x64 ? "vc18win64" : "vc18win-arm64", platform, architecture);
}
else
catch
{
Log.Verbose("Failed to generate VS2026 solution for PhysX, fallback to VS2022");
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
}
}
else
throw new InvalidArchitectureException(architecture);

View File

@@ -1,91 +0,0 @@
// 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
{
/// <summary>
/// WinPixEventRuntime. https://github.com/microsoft/PixEvents
/// </summary>
/// <seealso cref="Flax.Deps.Dependency" />
class WinPixEventRuntime : Dependency
{
/// <inheritdoc />
public override TargetPlatform[] Platforms
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
};
default: return new TargetPlatform[0];
}
}
}
/// <inheritdoc />
public override TargetArchitecture[] Architectures
{
get
{
switch (BuildPlatform)
{
case TargetPlatform.Windows:
return new[]
{
TargetArchitecture.x64,
TargetArchitecture.ARM64,
};
default: return new TargetArchitecture[0];
}
}
}
/// <inheritdoc />
public override void Build(BuildOptions options)
{
// Get the source
var root = options.IntermediateFolder;
var packagePath = Path.Combine(root, $"package.zip");
if (!File.Exists(packagePath))
{
Downloader.DownloadFileFromUrlToPath("https://www.nuget.org/api/v2/package/WinPixEventRuntime/1.0.240308001", packagePath);
}
var extractedPath = Path.Combine(root, "extracted");
if (!Directory.Exists(extractedPath))
{
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
archive.ExtractToDirectory(extractedPath);
}
root = extractedPath;
foreach (var platform in options.Platforms)
{
foreach (var architecture in options.Architectures)
{
BuildStarted(platform, architecture);
switch (platform)
{
case TargetPlatform.Windows:
{
var bin = Path.Combine(root, "bin", architecture.ToString());
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
Utilities.FileCopy(Path.Combine(bin, "WinPixEventRuntime.dll"), Path.Combine(depsFolder, "WinPixEventRuntime.dll"));
Utilities.FileCopy(Path.Combine(bin, "WinPixEventRuntime.lib"), Path.Combine(depsFolder, "WinPixEventRuntime.lib"));
break;
}
}
}
}
}
}
}

View File

@@ -295,7 +295,6 @@ namespace Flax.Deps.Dependencies
string ext;
string oggConfig = $"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE={_configuration} -DCMAKE_INSTALL_PREFIX=\"{installDir}\"";
string vorbisConfig = $"-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE={_configuration} -DCMAKE_INSTALL_PREFIX=\"{installDir}\"";
string liboggFilename = "libogg";
Dictionary<string, string> envVars = new Dictionary<string, string>();
(string, string)[] oggBinariesToCopy;
Binary[] vorbisBinariesToCopy;
@@ -307,7 +306,6 @@ namespace Flax.Deps.Dependencies
oggConfig += " -DBUILD_SHARED_LIBS=OFF";
vorbisConfig += " -DBUILD_SHARED_LIBS=OFF";
ext = ".lib";
liboggFilename = "ogg";
break;
case TargetPlatform.Linux:
oggConfig += " -DCMAKE_POSITION_INDEPENDENT_CODE=ON";
@@ -357,7 +355,7 @@ namespace Flax.Deps.Dependencies
default: throw new InvalidPlatformException(platform);
}
vorbisConfig += $" -DOGG_INCLUDE_DIR=\"{Path.Combine(installDir, "include")}\" -DOGG_LIBRARY=\"{Path.Combine(installDir, "lib", liboggFilename + ext)}\"";
vorbisConfig += $" -DOGG_INCLUDE_DIR=\"{Path.Combine(installDir, "include")}\" -DOGG_LIBRARY=\"{Path.Combine(installDir, "lib", "libogg" + ext)}\"";
var binariesToCopy = new List<(string, string)>();
@@ -368,9 +366,9 @@ namespace Flax.Deps.Dependencies
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" " + oggConfig, envVars);
if (platform == TargetPlatform.Windows)
Deploy.VCEnvironment.BuildSolution(Path.Combine(oggBuildDir, "ogg.sln"), _configuration, architecture.ToString());
else
else if (platform == TargetPlatform.Mac || platform == TargetPlatform.Linux)
BuildCmake(oggBuildDir);
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, oggBuildDir, Utilities.RunOptions.DefaultTool);
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.DefaultTool);
}
// Build vorbis
{
@@ -378,9 +376,9 @@ namespace Flax.Deps.Dependencies
RunCmake(vorbisRoot, platform, architecture, $"-B\"{vorbisBuildDir}\" " + vorbisConfig);
if (platform == TargetPlatform.Windows)
Deploy.VCEnvironment.BuildSolution(Path.Combine(vorbisBuildDir, "vorbis.sln"), _configuration, architecture.ToString());
else
else if (platform == TargetPlatform.Mac || platform == TargetPlatform.Linux)
BuildCmake(vorbisBuildDir);
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, vorbisBuildDir, Utilities.RunOptions.DefaultTool);
Utilities.Run("cmake", "--build . --target install", null, vorbisBuildDir, Utilities.RunOptions.DefaultTool);
}
// Copy binaries
@@ -465,7 +463,7 @@ namespace Flax.Deps.Dependencies
// Build for Android
SetupDirectory(oggBuildDir, true);
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
Utilities.Run("cmake", "--build . --config Release --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
BuildCmake(buildDir);
@@ -492,7 +490,7 @@ namespace Flax.Deps.Dependencies
// Build for Switch
SetupDirectory(oggBuildDir, true);
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
Utilities.Run("cmake", "--build . --config Release --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg", "include", "ogg", "config_types.h"), Path.Combine(oggRoot, "install", "include", "ogg", "config_types.h"));
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
@@ -521,7 +519,7 @@ namespace Flax.Deps.Dependencies
// Build for Mac
SetupDirectory(oggBuildDir, true);
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
Utilities.Run("cmake", "--build . --config Release --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, TargetArchitecture.ARM64, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
BuildCmake(buildDir);

View File

@@ -19,7 +19,7 @@ namespace Flax.Build
/// <summary>
/// Specifies the minimum CPU architecture type to support (on x86/x64).
/// </summary>
[CommandLine("winCpuArch", "<arch>", "Specifies the minimum CPU architecture type to support (on x86/x64).")]
[CommandLine("winCpuArch", "<arch>", "Specifies the minimum CPU architecture type to support (om x86/x64).")]
public static CpuArchitecture WindowsCpuArch = CpuArchitecture.AVX2; // 94.48% support on PC according to Steam Hardware & Software Survey: May 2025 (https://store.steampowered.com/hwsurvey/)
}
}
@@ -76,27 +76,22 @@ namespace Flax.Build.Platforms
options.LinkEnv.InputLibraries.Add("oleaut32.lib");
options.LinkEnv.InputLibraries.Add("delayimp.lib");
options.CompileEnv.CpuArchitecture = Configuration.WindowsCpuArch;
if (options.Architecture == TargetArchitecture.x64)
{
if (_minVersion.Major <= 7 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX2)
{
// Old Windows had lower support ratio for latest CPU features
options.CompileEnv.CpuArchitecture = CpuArchitecture.AVX;
}
if (_minVersion.Major >= 11 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX)
{
// Windows 11 has hard requirement on SSE4.2
options.CompileEnv.CpuArchitecture = CpuArchitecture.SSE4_2;
}
}
else if (options.Architecture == TargetArchitecture.ARM64)
if (options.Architecture == TargetArchitecture.ARM64)
{
options.CompileEnv.PreprocessorDefinitions.Add("USE_SOFT_INTRINSICS");
options.LinkEnv.InputLibraries.Add("softintrin.lib");
if (options.CompileEnv.CpuArchitecture != CpuArchitecture.None)
options.CompileEnv.CpuArchitecture = CpuArchitecture.NEON;
}
options.CompileEnv.CpuArchitecture = Configuration.WindowsCpuArch;
if (_minVersion.Major <= 7 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX2)
{
// Old Windows had lower support ratio for latest CPU features
options.CompileEnv.CpuArchitecture = CpuArchitecture.AVX;
}
if (_minVersion.Major >= 11 && options.CompileEnv.CpuArchitecture == CpuArchitecture.AVX)
{
// Windows 11 has hard requirement on SSE4.2
options.CompileEnv.CpuArchitecture = CpuArchitecture.SSE4_2;
}
}