13 Commits

Author SHA1 Message Date
0f881fbc7a Enforce pointer alignment for InlinedAllocation
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
AssetReferences stored in inlined allocation needs to be aligned to
pointer sized boundary due to atomic operations having strict
requirements for such. Unaligned access seems to only crash on
Windows on ARM systems when trying to allocate TextRender draw chunks.
2025-10-19 22:13:40 +03:00
0898f3d020 Fix wrong build configuration used in ogg and vorbis for Windows
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-19 17:24:10 +03:00
c63e79efa4 Add dependency build script for Visual Studio EnvDTE 2025-10-19 13:47:58 +03:00
d0eb85c04f Add dependency build script for WinPixEventRuntime
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 04:20:58 +03:00
a7749abdcc Fix compiler error and wrong CPU architecture warnings on WoA 2025-10-18 04:20:58 +03:00
242d24d1a6 Fix building vorbis on Windows 2025-10-18 04:20:58 +03:00
853a7510f6 Check VS2026 toolset before trying to compile PhysX 2025-10-18 04:20:58 +03:00
88bd636cbe Fix building ogg+vorbis on macOS 2025-10-18 04:20:57 +03:00
65df32f5d7 Fix NvCloth compilation on Linux and macOS 2025-10-18 04:20:57 +03:00
4baa7fb7b8 Fix PhysX compilation on Linux and macOS 2025-10-18 04:20:57 +03:00
1644c9c5e0 Fix python tool call on macOS for glslang 2025-10-18 04:20:57 +03:00
e130ac7d80 Fix building PhysX on Linux and macOS 2025-10-18 04:20:56 +03:00
45e1d28ba2 Support building OpenAL from Git repository in other platforms 2025-10-18 04:20:56 +03:00
10 changed files with 405 additions and 212 deletions

View File

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

View File

@@ -5,6 +5,9 @@
#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

@@ -0,0 +1,95 @@
// 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

@@ -1,5 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -89,6 +90,15 @@ namespace Flax.Deps.Dependencies
// Get the source
CloneGitRepoSingleBranch(root, "https://github.com/FlaxEngine/NvCloth.git", "master");
// Patch the CMakeLists.txt to support custom compilation flags
foreach (var os in new[] { "android", "ios", "linux", "mac", "windows", })
{
var filePath = Path.Combine(nvCloth, "compiler", "cmake", os, "CMakeLists.txt");
var appendLine = "SET(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} ${NVCLOTH_CXX_FLAGS}\")";
if (!File.ReadAllText(filePath).Contains(appendLine))
File.AppendAllText(filePath, Environment.NewLine + appendLine + Environment.NewLine);
}
foreach (var platform in options.Platforms)
{
foreach (var architecture in options.Architectures)
@@ -184,7 +194,7 @@ namespace Flax.Deps.Dependencies
}
break;
case TargetPlatform.Mac:
cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac";
cmakeArgs += " -DTARGET_BUILD_PLATFORM=mac -DNVCLOTH_CXX_FLAGS=\"-Wno-error=poison-system-directories -Wno-error=missing-include-dirs\"";
cmakeName = "mac";
binariesPrefix = "lib";
break;
@@ -194,7 +204,7 @@ namespace Flax.Deps.Dependencies
binariesPrefix = "lib";
break;
case TargetPlatform.Linux:
cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux";
cmakeArgs += " -DTARGET_BUILD_PLATFORM=linux -DNVCLOTH_CXX_FLAGS=\"-Wno-error=poison-system-directories -Wno-error=missing-include-dirs\"";
cmakeName = "linux";
binariesPrefix = "lib";
break;

View File

@@ -1,5 +1,5 @@
// Copyright (c) Wojciech Figat. All rights reserved.
//#define USE_GIT_REPOSITORY
using System;
using System.Collections.Generic;
using System.IO;
@@ -85,12 +85,15 @@ namespace Flax.Deps.Dependencies
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
var noSSL = true; // OpenAL Soft website has broken certs
#if !USE_GIT_REPOSITORY
if (options.Platforms.Contains(TargetPlatform.Windows))
#endif
{
// Get the source
CloneGitRepo(root, "https://github.com/kcat/openal-soft.git");
GitCheckout(root, "master", "d3875f333fb6abe2f39d82caca329414871ae53b"); // 1.23.1
GitCheckout(root, "master", "dc7d7054a5b4f3bec1dc23a42fd616a0847af948"); // 1.24.3
}
#if !USE_GIT_REPOSITORY
else
{
// Get the source
@@ -98,25 +101,20 @@ 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)
{
if (!Directory.Exists(root))
archive.ExtractToDirectory(root);
root = Path.Combine(root, archive.Entries.First().FullName);
// TODO: Maybe use PowerShell Expand-Archive instead?
var sevenZip = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip", "7z.exe");
Utilities.Run(sevenZip, "x package.zip", null, root);
Utilities.Run(sevenZip, "x package", null, root);
}
else
{
Utilities.Run("tar", "xjf " + packagePath.Replace('\\', '/'), null, root, Utilities.RunOptions.ConsoleLogOutput);
}
}
/*if (Platform.BuildTargetPlatform == TargetPlatform.Windows)
{
// TODO: Maybe use PowerShell Expand-Archive instead?
var sevenZip = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip", "7z.exe");
Utilities.Run(sevenZip, "x package.zip", null, root);
Utilities.Run(sevenZip, "x package", null, root);
}
else
{
Utilities.Run("tar", "xjf " + packagePath.Replace('\\', '/'), null, root, Utilities.RunOptions.ConsoleLogOutput);
}*/
}
#endif
foreach (var platform in options.Platforms)
{
@@ -136,40 +134,12 @@ namespace Flax.Deps.Dependencies
// Build for Windows
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
var solutionPath = Path.Combine(buildDir, "OpenAL.sln");
SetupDirectory(buildDir, true);
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" -DCMAKE_CXX_FLAGS=\"/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR /EHsc\" " + cmakeArgs);
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopy)
Utilities.FileCopy(Path.Combine(buildDir, configuration, file), Path.Combine(depsFolder, Path.GetFileName(file)));
#if false
// Get the binaries
var packagePath = Path.Combine(root, "package.zip");
if (!File.Exists(packagePath))
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-binaries/openal-soft-" + version + "-bin.zip", packagePath, noSSL);
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
{
if (!Directory.Exists(root))
archive.ExtractToDirectory(root);
root = Path.Combine(root, archive.Entries.First().FullName);
}
// Deploy Win64 binaries
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
Utilities.FileCopy(Path.Combine(root, "bin", "Win64", "soft_oal.dll"), Path.Combine(depsFolder, "OpenAL32.dll"));
Utilities.FileCopy(Path.Combine(root, "libs", "Win64", "OpenAL32.lib"), Path.Combine(depsFolder, "OpenAL32.lib"));
// Deploy license
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"), true);
// Deploy header files
var files = Directory.GetFiles(Path.Combine(root, "include", "AL"));
foreach (var file in files)
{
Utilities.FileCopy(file, Path.Combine(dstIncludePath, Path.GetFileName(file)));
}
#endif
break;
}
case TargetPlatform.Linux:
@@ -194,14 +164,16 @@ namespace Flax.Deps.Dependencies
+ cmakeArgs;
// Use separate build directory
#if !USE_GIT_REPOSITORY
root = Path.Combine(root, "openal-soft-" + version);
var buildDir = Path.Combine(root, "build");
#endif
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
SetupDirectory(buildDir, true);
// Build for Linux
Utilities.Run("cmake", $"-G \"Unix Makefiles\" -DCMAKE_BUILD_TYPE={configuration} -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DLIBTYPE=STATIC {config} ..", null, buildDir, Utilities.RunOptions.ConsoleLogOutput, envVars);
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
BuildCmake(buildDir, configuration, envVars);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopy)
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
break;
@@ -219,12 +191,14 @@ namespace Flax.Deps.Dependencies
var config = "-DALSOFT_REQUIRE_OBOE=OFF -DALSOFT_REQUIRE_OPENSL=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
// Use separate build directory
#if !USE_GIT_REPOSITORY
root = Path.Combine(root, "openal-soft-" + version);
var buildDir = Path.Combine(root, "build");
#endif
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
SetupDirectory(buildDir, true);
// Build
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
RunCmake(root, platform, TargetArchitecture.ARM64, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
BuildCmake(buildDir, envVars);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
foreach (var file in binariesToCopy)
@@ -244,12 +218,14 @@ namespace Flax.Deps.Dependencies
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
// Use separate build directory
#if !USE_GIT_REPOSITORY
root = Path.Combine(root, "openal-soft-" + version);
var buildDir = Path.Combine(root, "build");
#endif
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
SetupDirectory(buildDir, true);
// Build for Mac
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
BuildCmake(buildDir, envVars);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopy)
@@ -269,12 +245,14 @@ namespace Flax.Deps.Dependencies
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
// Use separate build directory
#if !USE_GIT_REPOSITORY
root = Path.Combine(root, "openal-soft-" + version);
var buildDir = Path.Combine(root, "build");
#endif
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
SetupDirectory(buildDir, true);
// Build for iOS
SetupDirectory(buildDir, true);
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
RunCmake(root, platform, TargetArchitecture.ARM64, $"-B\"{buildDir}\" -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
BuildCmake(buildDir, envVars);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
foreach (var file in binariesToCopy)
@@ -284,6 +262,16 @@ namespace Flax.Deps.Dependencies
}
}
}
// Deploy license
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"), true);
// Deploy header files
var files = Directory.GetFiles(Path.Combine(root, "include", "AL"));
foreach (var file in files)
{
Utilities.FileCopy(file, Path.Combine(dstIncludePath, Path.GetFileName(file)));
}
}
}
}

View File

@@ -95,8 +95,13 @@ namespace Flax.Deps.Dependencies
if (cmakeSwitch.HasAttribute("name") && cmakeSwitch.Attributes["name"].Value == name)
{
cmakeSwitch.Attributes["value"].Value = value;
return;
}
}
var child = cmakeSwitches.OwnerDocument.CreateElement(cmakeSwitches.ChildNodes[0].Name);
child.SetAttribute("name", name);
child.SetAttribute("value", value);
cmakeSwitches.AppendChild(child);
}
private void Build(BuildOptions options, string preset, TargetPlatform targetPlatform, TargetArchitecture architecture)
@@ -129,6 +134,9 @@ namespace Flax.Deps.Dependencies
ConfigureCmakeSwitch(cmakeParams, "PX_COPY_EXTERNAL_DLL", "OFF");
}
break;
case TargetPlatform.Linux:
ConfigureCmakeSwitch(cmakeParams, "PHYSX_CXX_FLAGS", "\"-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs\"");
break;
case TargetPlatform.Android:
ConfigureCmakeSwitch(cmakeParams, "CMAKE_INSTALL_PREFIX", $"install/android-{Configuration.AndroidPlatformApi}/PhysX");
ConfigureCmakeSwitch(cmakeParams, "ANDROID_NATIVE_API_LEVEL", $"android-{Configuration.AndroidPlatformApi}");
@@ -136,6 +144,7 @@ namespace Flax.Deps.Dependencies
break;
case TargetPlatform.Mac:
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.MacOSXMinVer);
ConfigureCmakeSwitch(cmakeParams, "PHYSX_CXX_FLAGS", "\"-Wno-error=format -Wno-error=unused-but-set-variable -Wno-error=switch-default -Wno-error=invalid-offsetof -Wno-error=unsafe-buffer-usage -Wno-error=unsafe-buffer-usage-in-libc-call -Wno-error=missing-include-dirs\"");
break;
case TargetPlatform.iOS:
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.iOSMinVer);
@@ -156,6 +165,7 @@ namespace Flax.Deps.Dependencies
bool suppressBitsPostfix = false;
string binariesPrefix = string.Empty;
var envVars = new Dictionary<string, string>();
envVars.Add("CMAKE_BUILD_PARALLEL_LEVEL", CmakeBuildParallel);
switch (architecture)
{
case TargetArchitecture.x86:
@@ -413,15 +423,20 @@ namespace Flax.Deps.Dependencies
{
if (architecture == TargetArchitecture.x64 || architecture == TargetArchitecture.ARM64)
{
try
if (WindowsPlatform.GetToolsets().Any(x => x.Key == WindowsPlatformToolset.v145))
{
Build(options, architecture == TargetArchitecture.x64 ? "vc18win64" : "vc18win-arm64", platform, architecture);
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);
}
}
catch
{
Log.Verbose("Failed to generate VS2026 solution for PhysX, fallback to VS2022");
else
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
}
}
else
throw new InvalidArchitectureException(architecture);
@@ -484,7 +499,7 @@ namespace Flax.Deps.Dependencies
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "PhysX");
Directory.GetFiles(dstIncludePath, "*.h", SearchOption.AllDirectories).ToList().ForEach(File.Delete);
Utilities.FileCopy(Path.Combine(root, "LICENSE.md"), Path.Combine(dstIncludePath, "License.txt"));
Utilities.DirectoryCopy(Path.Combine(root, "physx", "include"), dstIncludePath);
Utilities.DirectoryCopy(Path.Combine(root, "physx", "include"), dstIncludePath, true, true);
}
}
}

View File

@@ -0,0 +1,91 @@
// 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

@@ -1,5 +1,6 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using System;
using System.IO;
using Flax.Build;
@@ -82,7 +83,8 @@ namespace Flax.Deps.Dependencies
// Setup the external sources
// Requires distutils (pip install setuptools)
Utilities.Run("python", "update_glslang_sources.py", null, root, Utilities.RunOptions.ConsoleLogOutput);
if (Utilities.Run(BuildPlatform != TargetPlatform.Mac ? "python" : "python3", "update_glslang_sources.py", null, root, Utilities.RunOptions.ConsoleLogOutput) != 0)
throw new Exception("Failed to update glslang sources, make sure setuptools python package is installed.");
foreach (var platform in options.Platforms)
{

View File

@@ -83,18 +83,20 @@ namespace Flax.Deps.Dependencies
{
public string Filename;
public string SrcFolder;
public string DstFilename;
public Binary(string filename, string srcFolder)
public Binary(string filename, string srcFolder, string dstFilename = null)
{
Filename = filename;
SrcFolder = srcFolder;
DstFilename = dstFilename;
}
}
private bool hasSourcesReady;
private string root;
private string rootMsvcLib;
private string configurationMsvc;
private string _configuration = "Release";
private List<string> vcxprojContentsWindows;
private string[] vcxprojPathsWindows;
@@ -104,22 +106,6 @@ namespace Flax.Deps.Dependencies
new Binary("libvorbisfile_static.lib", "libvorbisfile"),
};
private (string, string)[] vorbisBinariesToCopyWindowsCmake =
{
("vorbis.lib", "libvorbis_static.lib"),
("vorbisfile.lib", "libvorbisfile_static.lib"),
};
private Binary[] oggBinariesToCopyWindows =
{
new Binary("libogg_static.lib", "ogg"),
};
private (string, string)[] oggBinariesToCopyWindowsCmake =
{
("ogg.lib", "libogg_static.lib"),
};
private void PatchWindowsTargetPlatformVersion(string windowsTargetPlatformVersion, string platformToolset)
{
// Fix the MSVC project settings for Windows
@@ -137,7 +123,6 @@ namespace Flax.Deps.Dependencies
return;
hasSourcesReady = true;
configurationMsvc = "Release";
string oggRoot = Path.Combine(root, "libogg");
string vorbisRoot = Path.Combine(root, "libvorbis");
@@ -227,7 +212,7 @@ namespace Flax.Deps.Dependencies
break;
default: throw new InvalidArchitectureException(architecture);
}
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
break;
}
case TargetPlatform.PS4:
@@ -246,7 +231,7 @@ namespace Flax.Deps.Dependencies
buildDir, true, true);
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
Path.Combine(root, "libogg", "include", "ogg", "config_types.h"));
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
break;
}
case TargetPlatform.PS5:
@@ -267,7 +252,7 @@ namespace Flax.Deps.Dependencies
Utilities.FileCopy(
Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
Path.Combine(root, "libogg", "include", "ogg", "config_types.h"));
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
break;
}
case TargetPlatform.XboxOne:
@@ -275,21 +260,21 @@ namespace Flax.Deps.Dependencies
vcxprojPaths = vcxprojPathsWindows;
buildPlatform = "x64";
PatchWindowsTargetPlatformVersion("10.0", "v143");
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
break;
case TargetPlatform.XboxScarlett:
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
vcxprojPaths = vcxprojPathsWindows;
buildPlatform = "x64";
PatchWindowsTargetPlatformVersion("10.0", "v143");
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, _configuration))));
break;
default: throw new InvalidPlatformException(platform);
}
// Build
foreach (var vcxprojPath in vcxprojPaths)
Deploy.VCEnvironment.BuildSolution(vcxprojPath, configurationMsvc, buildPlatform);
Deploy.VCEnvironment.BuildSolution(vcxprojPath, _configuration, buildPlatform);
// Copy binaries
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
@@ -303,48 +288,107 @@ namespace Flax.Deps.Dependencies
string oggRoot = Path.Combine(root, "libogg");
string vorbisRoot = Path.Combine(root, "libvorbis");
var oggBuildDir = Path.Combine(oggRoot, "build-" + architecture.ToString());
var vorbisBuildDir = Path.Combine(vorbisRoot, "build-" + architecture.ToString());
var installDir = Path.Combine(root, "install");
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;
switch (platform)
{
case TargetPlatform.Windows:
case TargetPlatform.UWP:
case TargetPlatform.XboxOne:
oggConfig += " -DBUILD_SHARED_LIBS=OFF";
vorbisConfig += " -DBUILD_SHARED_LIBS=OFF";
ext = ".lib";
liboggFilename = "ogg";
break;
case TargetPlatform.Linux:
oggConfig += " -DCMAKE_POSITION_INDEPENDENT_CODE=ON";
vorbisConfig += " -DCMAKE_POSITION_INDEPENDENT_CODE=ON";
envVars = new Dictionary<string, string>
{
{ "CC", "clang-" + Configuration.LinuxClangMinVer },
{ "CC_FOR_BUILD", "clang-" + Configuration.LinuxClangMinVer }
};
ext = ".a";
break;
case TargetPlatform.Mac:
//oggConfig += $" -DOGG_INCLUDE_DIR=\"{oggRoot}/install/include\" -DOGG_LIBRARY=\"{oggRoot}/install/lib\"";
ext = ".a";
break;
default: throw new InvalidPlatformException(platform);
}
var binariesToCopy = new List<(string, string)>();
// Build ogg
switch (platform)
{
var solutionPath = Path.Combine(oggBuildDir, "ogg.sln");
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5");
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
foreach (var file in oggBinariesToCopyWindowsCmake)
binariesToCopy.Add((Path.Combine(oggBuildDir, configurationMsvc, file.Item1), file.Item2));
case TargetPlatform.Windows:
case TargetPlatform.UWP:
case TargetPlatform.XboxOne:
oggBinariesToCopy =
[
("ogg.lib", "libogg_static.lib")
];
vorbisBinariesToCopy =
[
new Binary("vorbis.lib", "libvorbis", "libvorbis_static.lib"),
new Binary("vorbisfile.lib", "libvorbisfile", "libvorbisfile_static.lib")
];
break;
case TargetPlatform.Linux:
case TargetPlatform.Mac:
oggBinariesToCopy =
[
("libogg.a", "libogg.a")
];
vorbisBinariesToCopy =
[
new Binary("libvorbis.a", "lib"),
new Binary("libvorbisenc.a", "lib"),
new Binary("libvorbisfile.a", "lib")
];
break;
default: throw new InvalidPlatformException(platform);
}
vorbisConfig += $" -DOGG_INCLUDE_DIR=\"{Path.Combine(installDir, "include")}\" -DOGG_LIBRARY=\"{Path.Combine(installDir, "lib", liboggFilename + ext)}\"";
var binariesToCopy = new List<(string, string)>();
SetupDirectory(installDir, true);
// Build ogg
{
SetupDirectory(oggBuildDir, true);
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" " + oggConfig, envVars);
if (platform == TargetPlatform.Windows)
Deploy.VCEnvironment.BuildSolution(Path.Combine(oggBuildDir, "ogg.sln"), _configuration, architecture.ToString());
else
BuildCmake(oggBuildDir);
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, oggBuildDir, Utilities.RunOptions.DefaultTool);
}
// Build vorbis
{
var oggLibraryPath = Path.Combine(oggBuildDir, configurationMsvc, "ogg" + ext);
var solutionPath = Path.Combine(vorbisBuildDir, "vorbis.sln");
RunCmake(vorbisRoot, platform, architecture, $"-B\"{vorbisBuildDir}\" -DOGG_INCLUDE_DIR=\"{Path.Combine(oggRoot, "include")}\" -DOGG_LIBRARY=\"{oggLibraryPath}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5");
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
foreach (var file in vorbisBinariesToCopyWindowsCmake)
binariesToCopy.Add((Path.Combine(vorbisBuildDir, "lib", configurationMsvc, file.Item1), file.Item2));
SetupDirectory(vorbisBuildDir, true);
RunCmake(vorbisRoot, platform, architecture, $"-B\"{vorbisBuildDir}\" " + vorbisConfig);
if (platform == TargetPlatform.Windows)
Deploy.VCEnvironment.BuildSolution(Path.Combine(vorbisBuildDir, "vorbis.sln"), _configuration, architecture.ToString());
else
BuildCmake(vorbisBuildDir);
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, vorbisBuildDir, Utilities.RunOptions.DefaultTool);
}
// Copy binaries
foreach (var file in oggBinariesToCopy)
binariesToCopy.Add((Path.Combine(installDir, "lib", file.Item1), file.Item2));
foreach (var file in vorbisBinariesToCopy)
binariesToCopy.Add((Path.Combine(installDir, "lib", file.Filename), file.DstFilename ?? file.Filename));
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopy)
Utilities.FileCopy(file.Item1, Path.Combine(depsFolder, file.Item2));
@@ -389,29 +433,7 @@ namespace Flax.Deps.Dependencies
}
case TargetPlatform.Linux:
{
// Note: assumes the libogg-dev package is pre-installed on the system
// Get the source
CloneGitRepoFast(root, "https://github.com/xiph/vorbis.git");
var envVars = new Dictionary<string, string>
{
{ "CC", "clang-" + Configuration.LinuxClangMinVer },
{ "CC_FOR_BUILD", "clang-" + Configuration.LinuxClangMinVer }
};
var buildDir = Path.Combine(root, "build");
Utilities.Run(Path.Combine(root, "autogen.sh"), null, null, root, Utilities.RunOptions.Default, envVars);
// Build for Linux
var toolchain = UnixToolchain.GetToolchainName(platform, architecture);
Utilities.Run(Path.Combine(root, "configure"), string.Format("--host={0}", toolchain), null, root, Utilities.RunOptions.Default, envVars);
SetupDirectory(buildDir, true);
Utilities.Run("cmake", "-G \"Unix Makefiles\" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release ..", null, buildDir, Utilities.RunOptions.ConsoleLogOutput, envVars);
Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.ConsoleLogOutput, envVars);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
foreach (var file in binariesToCopyUnix)
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
BuildCmake(options, TargetPlatform.Linux, architecture);
break;
}
case TargetPlatform.PS4:
@@ -443,7 +465,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 . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
Utilities.Run("cmake", "--build . --config Release --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);
@@ -458,51 +480,33 @@ namespace Flax.Deps.Dependencies
var oggBuildDir = Path.Combine(oggRoot, "build");
var buildDir = Path.Combine(root, "build");
// Get the source
SetupDirectory(oggRoot, false);
CloneGitRepo(root, "https://github.com/xiph/vorbis.git");
GitCheckout(root, "master", "98eddc72d36e3421519d54b101c09b57e4d4d10d");
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg"), oggRoot, true, true);
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/vorbis"), buildDir, true, true);
// Build for Switch
SetupDirectory(oggBuildDir, true);
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
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));
BuildCmake(buildDir);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
foreach (var file in binariesToCopyUnix)
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
break;
}
case TargetPlatform.Mac:
{
var oggRoot = Path.Combine(root, "ogg");
var oggBuildDir = Path.Combine(oggRoot, "build");
var buildDir = Path.Combine(root, "build");
// Get the source
CloneGitRepoFast(root, "https://github.com/xiph/vorbis.git");
SetupDirectory(oggRoot, false);
CloneGitRepo(root, "https://github.com/xiph/vorbis.git");
GitCheckout(root, "master", "98eddc72d36e3421519d54b101c09b57e4d4d10d");
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/ogg"), oggRoot, true, true);
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data/vorbis"), buildDir, true, true);
// Build for Mac
// Build for Switch
SetupDirectory(oggBuildDir, true);
RunCmake(oggBuildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
Utilities.Run("cmake", "--build . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
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.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, architecture, string.Format(".. -DCMAKE_BUILD_TYPE=Release -DOGG_INCLUDE_DIR=\"{0}/install/include\" -DOGG_LIBRARY=\"{0}/install/lib\"", oggRoot));
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);
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
foreach (var file in binariesToCopyUnix)
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
break;
}
case TargetPlatform.Mac:
{
BuildCmake(options, TargetPlatform.Mac, architecture);
break;
}
case TargetPlatform.iOS:
{
var oggRoot = Path.Combine(root, "ogg");
@@ -517,7 +521,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 . --target install", null, oggBuildDir, Utilities.RunOptions.ConsoleLogOutput);
Utilities.Run("cmake", "--build . --config Release --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);
@@ -530,37 +534,17 @@ namespace Flax.Deps.Dependencies
}
}
// Backup files
if (hasSourcesReady)
root = rootMsvcLib;
var srcIncludePath = Path.Combine(root, "include", "vorbis");
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "vorbis");
foreach (var filename in filesToKeep)
{
var src = Path.Combine(dstIncludePath, filename);
var dst = Path.Combine(options.IntermediateFolder, filename + ".tmp");
Utilities.FileCopy(src, dst);
}
// Setup headers directory
var installDir = Path.Combine(root, "install");
var oggOut = Path.Combine(options.ThirdPartyFolder, "ogg");
var vorbisOut = Path.Combine(options.ThirdPartyFolder, "vorbis");
try
{
// Setup headers directory
SetupDirectory(dstIncludePath, true);
// Deploy header files
Utilities.DirectoryCopy(Path.Combine(installDir, "include", "ogg"), oggOut, true, true);
Utilities.DirectoryCopy(Path.Combine(installDir, "include", "vorbis"), vorbisOut, true, true);
// Deploy header files and restore files
Directory.GetFiles(srcIncludePath, "Makefile*").ToList().ForEach(File.Delete);
Utilities.DirectoryCopy(srcIncludePath, dstIncludePath, true, true);
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"));
}
finally
{
foreach (var filename in filesToKeep)
{
var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
var dst = Path.Combine(dstIncludePath, filename);
Utilities.FileCopy(src, dst);
}
}
Utilities.FileCopy(Path.Combine(root, "libogg", "COPYING"), Path.Combine(oggOut, "COPYING"));
Utilities.FileCopy(Path.Combine(root, "libvorbis", "COPYING"), Path.Combine(vorbisOut, "COPYING"));
}
}
}

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 (om x86/x64).")]
[CommandLine("winCpuArch", "<arch>", "Specifies the minimum CPU architecture type to support (on 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,22 +76,27 @@ namespace Flax.Build.Platforms
options.LinkEnv.InputLibraries.Add("oleaut32.lib");
options.LinkEnv.InputLibraries.Add("delayimp.lib");
if (options.Architecture == TargetArchitecture.ARM64)
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)
{
options.CompileEnv.PreprocessorDefinitions.Add("USE_SOFT_INTRINSICS");
options.LinkEnv.InputLibraries.Add("softintrin.lib");
}
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;
if (options.CompileEnv.CpuArchitecture != CpuArchitecture.None)
options.CompileEnv.CpuArchitecture = CpuArchitecture.NEON;
}
}