Compare commits
13 Commits
7e72e856e1
...
sdl_platfo
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f881fbc7a | |||
| 0898f3d020 | |||
| c63e79efa4 | |||
| d0eb85c04f | |||
| a7749abdcc | |||
| 242d24d1a6 | |||
| 853a7510f6 | |||
| 88bd636cbe | |||
| 65df32f5d7 | |||
| 4baa7fb7b8 | |||
| 1644c9c5e0 | |||
| e130ac7d80 | |||
| 45e1d28ba2 |
@@ -208,7 +208,7 @@ public:
|
|||||||
typedef typename FallbackAllocation::template Data<T> FallbackData;
|
typedef typename FallbackAllocation::template Data<T> FallbackData;
|
||||||
|
|
||||||
bool _useFallback = false;
|
bool _useFallback = false;
|
||||||
byte _data[Capacity * sizeof(T)];
|
alignas(sizeof(void*)) byte _data[Capacity * sizeof(T)];
|
||||||
FallbackData _fallback;
|
FallbackData _fallback;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "Engine/Core/Types/StringView.h"
|
#include "Engine/Core/Types/StringView.h"
|
||||||
#include "Engine/Core/Types/Guid.h"
|
#include "Engine/Core/Types/Guid.h"
|
||||||
|
#if PLATFORM_ARCH_ARM64
|
||||||
|
#include "Engine/Core/Core.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class MMethod;
|
class MMethod;
|
||||||
class BinaryModule;
|
class BinaryModule;
|
||||||
|
|||||||
95
Source/Tools/Flax.Build/Deps/Dependencies/EnvDTE.cs
Normal file
95
Source/Tools/Flax.Build/Deps/Dependencies/EnvDTE.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -89,6 +90,15 @@ namespace Flax.Deps.Dependencies
|
|||||||
// Get the source
|
// Get the source
|
||||||
CloneGitRepoSingleBranch(root, "https://github.com/FlaxEngine/NvCloth.git", "master");
|
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 platform in options.Platforms)
|
||||||
{
|
{
|
||||||
foreach (var architecture in options.Architectures)
|
foreach (var architecture in options.Architectures)
|
||||||
@@ -184,7 +194,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TargetPlatform.Mac:
|
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";
|
cmakeName = "mac";
|
||||||
binariesPrefix = "lib";
|
binariesPrefix = "lib";
|
||||||
break;
|
break;
|
||||||
@@ -194,7 +204,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
binariesPrefix = "lib";
|
binariesPrefix = "lib";
|
||||||
break;
|
break;
|
||||||
case TargetPlatform.Linux:
|
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";
|
cmakeName = "linux";
|
||||||
binariesPrefix = "lib";
|
binariesPrefix = "lib";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
//#define USE_GIT_REPOSITORY
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -85,12 +85,15 @@ namespace Flax.Deps.Dependencies
|
|||||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
|
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "OpenAL");
|
||||||
var noSSL = true; // OpenAL Soft website has broken certs
|
var noSSL = true; // OpenAL Soft website has broken certs
|
||||||
|
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
if (options.Platforms.Contains(TargetPlatform.Windows))
|
if (options.Platforms.Contains(TargetPlatform.Windows))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// Get the source
|
// Get the source
|
||||||
CloneGitRepo(root, "https://github.com/kcat/openal-soft.git");
|
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
|
else
|
||||||
{
|
{
|
||||||
// Get the source
|
// Get the source
|
||||||
@@ -98,25 +101,20 @@ namespace Flax.Deps.Dependencies
|
|||||||
if (!File.Exists(packagePath))
|
if (!File.Exists(packagePath))
|
||||||
{
|
{
|
||||||
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-releases/openal-soft-" + version + ".tar.bz2", packagePath, noSSL);
|
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))
|
// TODO: Maybe use PowerShell Expand-Archive instead?
|
||||||
archive.ExtractToDirectory(root);
|
var sevenZip = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "7-Zip", "7z.exe");
|
||||||
root = Path.Combine(root, archive.Entries.First().FullName);
|
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)
|
foreach (var platform in options.Platforms)
|
||||||
{
|
{
|
||||||
@@ -136,40 +134,12 @@ namespace Flax.Deps.Dependencies
|
|||||||
// Build for Windows
|
// Build for Windows
|
||||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||||
var solutionPath = Path.Combine(buildDir, "OpenAL.sln");
|
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);
|
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());
|
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, configuration, file), Path.Combine(depsFolder, Path.GetFileName(file)));
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case TargetPlatform.Linux:
|
case TargetPlatform.Linux:
|
||||||
@@ -194,14 +164,16 @@ namespace Flax.Deps.Dependencies
|
|||||||
+ cmakeArgs;
|
+ cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
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);
|
SetupDirectory(buildDir, true);
|
||||||
|
|
||||||
// Build for Linux
|
// 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);
|
BuildCmake(buildDir, configuration, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
Utilities.FileCopy(Path.Combine(buildDir, file), Path.Combine(depsFolder, file));
|
||||||
break;
|
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;
|
var config = "-DALSOFT_REQUIRE_OBOE=OFF -DALSOFT_REQUIRE_OPENSL=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
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);
|
SetupDirectory(buildDir, true);
|
||||||
|
|
||||||
// Build
|
// 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);
|
BuildCmake(buildDir, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||||
foreach (var file in binariesToCopy)
|
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;
|
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
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
|
// Build for Mac
|
||||||
SetupDirectory(buildDir, true);
|
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||||
RunCmake(buildDir, platform, architecture, ".. -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
|
||||||
BuildCmake(buildDir, envVars);
|
BuildCmake(buildDir, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
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;
|
var config = " -DALSOFT_REQUIRE_COREAUDIO=ON -DALSOFT_EMBED_HRTF_DATA=YES " + cmakeArgs;
|
||||||
|
|
||||||
// Use separate build directory
|
// Use separate build directory
|
||||||
|
#if !USE_GIT_REPOSITORY
|
||||||
root = Path.Combine(root, "openal-soft-" + version);
|
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
|
// Build for iOS
|
||||||
SetupDirectory(buildDir, true);
|
RunCmake(root, platform, TargetArchitecture.ARM64, $"-B\"{buildDir}\" -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
||||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_SYSTEM_NAME=iOS -DALSOFT_OSX_FRAMEWORK=ON -DLIBTYPE=STATIC -DCMAKE_BUILD_TYPE=" + configuration + config, envVars);
|
|
||||||
BuildCmake(buildDir, envVars);
|
BuildCmake(buildDir, envVars);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||||
foreach (var file in binariesToCopy)
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,8 +95,13 @@ namespace Flax.Deps.Dependencies
|
|||||||
if (cmakeSwitch.HasAttribute("name") && cmakeSwitch.Attributes["name"].Value == name)
|
if (cmakeSwitch.HasAttribute("name") && cmakeSwitch.Attributes["name"].Value == name)
|
||||||
{
|
{
|
||||||
cmakeSwitch.Attributes["value"].Value = value;
|
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)
|
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");
|
ConfigureCmakeSwitch(cmakeParams, "PX_COPY_EXTERNAL_DLL", "OFF");
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case TargetPlatform.Android:
|
||||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_INSTALL_PREFIX", $"install/android-{Configuration.AndroidPlatformApi}/PhysX");
|
ConfigureCmakeSwitch(cmakeParams, "CMAKE_INSTALL_PREFIX", $"install/android-{Configuration.AndroidPlatformApi}/PhysX");
|
||||||
ConfigureCmakeSwitch(cmakeParams, "ANDROID_NATIVE_API_LEVEL", $"android-{Configuration.AndroidPlatformApi}");
|
ConfigureCmakeSwitch(cmakeParams, "ANDROID_NATIVE_API_LEVEL", $"android-{Configuration.AndroidPlatformApi}");
|
||||||
@@ -136,6 +144,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
break;
|
break;
|
||||||
case TargetPlatform.Mac:
|
case TargetPlatform.Mac:
|
||||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.MacOSXMinVer);
|
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;
|
break;
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.iOSMinVer);
|
ConfigureCmakeSwitch(cmakeParams, "CMAKE_OSX_DEPLOYMENT_TARGET", Configuration.iOSMinVer);
|
||||||
@@ -156,6 +165,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
bool suppressBitsPostfix = false;
|
bool suppressBitsPostfix = false;
|
||||||
string binariesPrefix = string.Empty;
|
string binariesPrefix = string.Empty;
|
||||||
var envVars = new Dictionary<string, string>();
|
var envVars = new Dictionary<string, string>();
|
||||||
|
envVars.Add("CMAKE_BUILD_PARALLEL_LEVEL", CmakeBuildParallel);
|
||||||
switch (architecture)
|
switch (architecture)
|
||||||
{
|
{
|
||||||
case TargetArchitecture.x86:
|
case TargetArchitecture.x86:
|
||||||
@@ -413,15 +423,20 @@ namespace Flax.Deps.Dependencies
|
|||||||
{
|
{
|
||||||
if (architecture == TargetArchitecture.x64 || architecture == TargetArchitecture.ARM64)
|
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
|
else
|
||||||
{
|
|
||||||
Log.Verbose("Failed to generate VS2026 solution for PhysX, fallback to VS2022");
|
|
||||||
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
|
Build(options, architecture == TargetArchitecture.x64 ? "vc17win64" : "vc17win-arm64", platform, architecture);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new InvalidArchitectureException(architecture);
|
throw new InvalidArchitectureException(architecture);
|
||||||
@@ -484,7 +499,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "PhysX");
|
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "PhysX");
|
||||||
Directory.GetFiles(dstIncludePath, "*.h", SearchOption.AllDirectories).ToList().ForEach(File.Delete);
|
Directory.GetFiles(dstIncludePath, "*.h", SearchOption.AllDirectories).ToList().ForEach(File.Delete);
|
||||||
Utilities.FileCopy(Path.Combine(root, "LICENSE.md"), Path.Combine(dstIncludePath, "License.txt"));
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
// Copyright (c) Wojciech Figat. All rights reserved.
|
// Copyright (c) Wojciech Figat. All rights reserved.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Flax.Build;
|
using Flax.Build;
|
||||||
|
|
||||||
@@ -82,7 +83,8 @@ namespace Flax.Deps.Dependencies
|
|||||||
|
|
||||||
// Setup the external sources
|
// Setup the external sources
|
||||||
// Requires distutils (pip install setuptools)
|
// 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)
|
foreach (var platform in options.Platforms)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,18 +83,20 @@ namespace Flax.Deps.Dependencies
|
|||||||
{
|
{
|
||||||
public string Filename;
|
public string Filename;
|
||||||
public string SrcFolder;
|
public string SrcFolder;
|
||||||
|
public string DstFilename;
|
||||||
|
|
||||||
public Binary(string filename, string srcFolder)
|
public Binary(string filename, string srcFolder, string dstFilename = null)
|
||||||
{
|
{
|
||||||
Filename = filename;
|
Filename = filename;
|
||||||
SrcFolder = srcFolder;
|
SrcFolder = srcFolder;
|
||||||
|
DstFilename = dstFilename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool hasSourcesReady;
|
private bool hasSourcesReady;
|
||||||
private string root;
|
private string root;
|
||||||
private string rootMsvcLib;
|
private string rootMsvcLib;
|
||||||
private string configurationMsvc;
|
private string _configuration = "Release";
|
||||||
private List<string> vcxprojContentsWindows;
|
private List<string> vcxprojContentsWindows;
|
||||||
private string[] vcxprojPathsWindows;
|
private string[] vcxprojPathsWindows;
|
||||||
|
|
||||||
@@ -104,22 +106,6 @@ namespace Flax.Deps.Dependencies
|
|||||||
new Binary("libvorbisfile_static.lib", "libvorbisfile"),
|
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)
|
private void PatchWindowsTargetPlatformVersion(string windowsTargetPlatformVersion, string platformToolset)
|
||||||
{
|
{
|
||||||
// Fix the MSVC project settings for Windows
|
// Fix the MSVC project settings for Windows
|
||||||
@@ -137,7 +123,6 @@ namespace Flax.Deps.Dependencies
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
hasSourcesReady = true;
|
hasSourcesReady = true;
|
||||||
configurationMsvc = "Release";
|
|
||||||
|
|
||||||
string oggRoot = Path.Combine(root, "libogg");
|
string oggRoot = Path.Combine(root, "libogg");
|
||||||
string vorbisRoot = Path.Combine(root, "libvorbis");
|
string vorbisRoot = Path.Combine(root, "libvorbis");
|
||||||
@@ -227,7 +212,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
break;
|
break;
|
||||||
default: throw new InvalidArchitectureException(architecture);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case TargetPlatform.PS4:
|
case TargetPlatform.PS4:
|
||||||
@@ -246,7 +231,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
buildDir, true, true);
|
buildDir, true, true);
|
||||||
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
||||||
Path.Combine(root, "libogg", "include", "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;
|
break;
|
||||||
}
|
}
|
||||||
case TargetPlatform.PS5:
|
case TargetPlatform.PS5:
|
||||||
@@ -267,7 +252,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
Utilities.FileCopy(
|
Utilities.FileCopy(
|
||||||
Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
||||||
Path.Combine(root, "libogg", "include", "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;
|
break;
|
||||||
}
|
}
|
||||||
case TargetPlatform.XboxOne:
|
case TargetPlatform.XboxOne:
|
||||||
@@ -275,21 +260,21 @@ namespace Flax.Deps.Dependencies
|
|||||||
vcxprojPaths = vcxprojPathsWindows;
|
vcxprojPaths = vcxprojPathsWindows;
|
||||||
buildPlatform = "x64";
|
buildPlatform = "x64";
|
||||||
PatchWindowsTargetPlatformVersion("10.0", "v143");
|
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;
|
break;
|
||||||
case TargetPlatform.XboxScarlett:
|
case TargetPlatform.XboxScarlett:
|
||||||
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
||||||
vcxprojPaths = vcxprojPathsWindows;
|
vcxprojPaths = vcxprojPathsWindows;
|
||||||
buildPlatform = "x64";
|
buildPlatform = "x64";
|
||||||
PatchWindowsTargetPlatformVersion("10.0", "v143");
|
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;
|
break;
|
||||||
default: throw new InvalidPlatformException(platform);
|
default: throw new InvalidPlatformException(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build
|
// Build
|
||||||
foreach (var vcxprojPath in vcxprojPaths)
|
foreach (var vcxprojPath in vcxprojPaths)
|
||||||
Deploy.VCEnvironment.BuildSolution(vcxprojPath, configurationMsvc, buildPlatform);
|
Deploy.VCEnvironment.BuildSolution(vcxprojPath, _configuration, buildPlatform);
|
||||||
|
|
||||||
// Copy binaries
|
// Copy binaries
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
@@ -303,48 +288,107 @@ namespace Flax.Deps.Dependencies
|
|||||||
|
|
||||||
string oggRoot = Path.Combine(root, "libogg");
|
string oggRoot = Path.Combine(root, "libogg");
|
||||||
string vorbisRoot = Path.Combine(root, "libvorbis");
|
string vorbisRoot = Path.Combine(root, "libvorbis");
|
||||||
|
|
||||||
var oggBuildDir = Path.Combine(oggRoot, "build-" + architecture.ToString());
|
var oggBuildDir = Path.Combine(oggRoot, "build-" + architecture.ToString());
|
||||||
var vorbisBuildDir = Path.Combine(vorbisRoot, "build-" + architecture.ToString());
|
var vorbisBuildDir = Path.Combine(vorbisRoot, "build-" + architecture.ToString());
|
||||||
|
var installDir = Path.Combine(root, "install");
|
||||||
|
|
||||||
string ext;
|
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)
|
switch (platform)
|
||||||
{
|
{
|
||||||
case TargetPlatform.Windows:
|
case TargetPlatform.Windows:
|
||||||
case TargetPlatform.UWP:
|
case TargetPlatform.UWP:
|
||||||
case TargetPlatform.XboxOne:
|
case TargetPlatform.XboxOne:
|
||||||
|
oggConfig += " -DBUILD_SHARED_LIBS=OFF";
|
||||||
|
vorbisConfig += " -DBUILD_SHARED_LIBS=OFF";
|
||||||
ext = ".lib";
|
ext = ".lib";
|
||||||
|
liboggFilename = "ogg";
|
||||||
break;
|
break;
|
||||||
case TargetPlatform.Linux:
|
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";
|
ext = ".a";
|
||||||
break;
|
break;
|
||||||
default: throw new InvalidPlatformException(platform);
|
default: throw new InvalidPlatformException(platform);
|
||||||
}
|
}
|
||||||
|
|
||||||
var binariesToCopy = new List<(string, string)>();
|
switch (platform)
|
||||||
|
|
||||||
// Build ogg
|
|
||||||
{
|
{
|
||||||
var solutionPath = Path.Combine(oggBuildDir, "ogg.sln");
|
case TargetPlatform.Windows:
|
||||||
|
case TargetPlatform.UWP:
|
||||||
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" -DBUILD_SHARED_LIBS=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5");
|
case TargetPlatform.XboxOne:
|
||||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
|
oggBinariesToCopy =
|
||||||
foreach (var file in oggBinariesToCopyWindowsCmake)
|
[
|
||||||
binariesToCopy.Add((Path.Combine(oggBuildDir, configurationMsvc, file.Item1), file.Item2));
|
("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
|
// Build vorbis
|
||||||
{
|
{
|
||||||
var oggLibraryPath = Path.Combine(oggBuildDir, configurationMsvc, "ogg" + ext);
|
SetupDirectory(vorbisBuildDir, true);
|
||||||
var solutionPath = Path.Combine(vorbisBuildDir, "vorbis.sln");
|
RunCmake(vorbisRoot, platform, architecture, $"-B\"{vorbisBuildDir}\" " + vorbisConfig);
|
||||||
|
if (platform == TargetPlatform.Windows)
|
||||||
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(Path.Combine(vorbisBuildDir, "vorbis.sln"), _configuration, architecture.ToString());
|
||||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
|
else
|
||||||
foreach (var file in vorbisBinariesToCopyWindowsCmake)
|
BuildCmake(vorbisBuildDir);
|
||||||
binariesToCopy.Add((Path.Combine(vorbisBuildDir, "lib", configurationMsvc, file.Item1), file.Item2));
|
Utilities.Run("cmake", $"--build . --config {_configuration} --target install", null, vorbisBuildDir, Utilities.RunOptions.DefaultTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy binaries
|
// 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);
|
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||||
foreach (var file in binariesToCopy)
|
foreach (var file in binariesToCopy)
|
||||||
Utilities.FileCopy(file.Item1, Path.Combine(depsFolder, file.Item2));
|
Utilities.FileCopy(file.Item1, Path.Combine(depsFolder, file.Item2));
|
||||||
@@ -389,29 +433,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
}
|
}
|
||||||
case TargetPlatform.Linux:
|
case TargetPlatform.Linux:
|
||||||
{
|
{
|
||||||
// Note: assumes the libogg-dev package is pre-installed on the system
|
BuildCmake(options, TargetPlatform.Linux, architecture);
|
||||||
|
|
||||||
// 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));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TargetPlatform.PS4:
|
case TargetPlatform.PS4:
|
||||||
@@ -443,7 +465,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
// Build for Android
|
// Build for Android
|
||||||
SetupDirectory(oggBuildDir, true);
|
SetupDirectory(oggBuildDir, true);
|
||||||
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
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);
|
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));
|
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);
|
BuildCmake(buildDir);
|
||||||
@@ -458,51 +480,33 @@ namespace Flax.Deps.Dependencies
|
|||||||
var oggBuildDir = Path.Combine(oggRoot, "build");
|
var oggBuildDir = Path.Combine(oggRoot, "build");
|
||||||
var buildDir = Path.Combine(root, "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
|
// 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");
|
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
|
||||||
GitCheckout(oggRoot, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
|
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);
|
SetupDirectory(oggBuildDir, true);
|
||||||
RunCmake(oggBuildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
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);
|
||||||
|
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);
|
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);
|
BuildCmake(buildDir);
|
||||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||||
foreach (var file in binariesToCopyUnix)
|
foreach (var file in binariesToCopyUnix)
|
||||||
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
|
Utilities.FileCopy(Path.Combine(buildDir, file.SrcFolder, file.Filename), Path.Combine(depsFolder, file.Filename));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TargetPlatform.Mac:
|
||||||
|
{
|
||||||
|
BuildCmake(options, TargetPlatform.Mac, architecture);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case TargetPlatform.iOS:
|
case TargetPlatform.iOS:
|
||||||
{
|
{
|
||||||
var oggRoot = Path.Combine(root, "ogg");
|
var oggRoot = Path.Combine(root, "ogg");
|
||||||
@@ -517,7 +521,7 @@ namespace Flax.Deps.Dependencies
|
|||||||
// Build for Mac
|
// Build for Mac
|
||||||
SetupDirectory(oggBuildDir, true);
|
SetupDirectory(oggBuildDir, true);
|
||||||
RunCmake(oggBuildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=\"../install\"");
|
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);
|
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));
|
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);
|
BuildCmake(buildDir);
|
||||||
@@ -530,37 +534,17 @@ namespace Flax.Deps.Dependencies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup files
|
// Setup headers directory
|
||||||
if (hasSourcesReady)
|
var installDir = Path.Combine(root, "install");
|
||||||
root = rootMsvcLib;
|
var oggOut = Path.Combine(options.ThirdPartyFolder, "ogg");
|
||||||
var srcIncludePath = Path.Combine(root, "include", "vorbis");
|
var vorbisOut = Path.Combine(options.ThirdPartyFolder, "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);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
// Deploy header files
|
||||||
{
|
Utilities.DirectoryCopy(Path.Combine(installDir, "include", "ogg"), oggOut, true, true);
|
||||||
// Setup headers directory
|
Utilities.DirectoryCopy(Path.Combine(installDir, "include", "vorbis"), vorbisOut, true, true);
|
||||||
SetupDirectory(dstIncludePath, true);
|
|
||||||
|
|
||||||
// Deploy header files and restore files
|
Utilities.FileCopy(Path.Combine(root, "libogg", "COPYING"), Path.Combine(oggOut, "COPYING"));
|
||||||
Directory.GetFiles(srcIncludePath, "Makefile*").ToList().ForEach(File.Delete);
|
Utilities.FileCopy(Path.Combine(root, "libvorbis", "COPYING"), Path.Combine(vorbisOut, "COPYING"));
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Flax.Build
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies the minimum CPU architecture type to support (on x86/x64).
|
/// Specifies the minimum CPU architecture type to support (on x86/x64).
|
||||||
/// </summary>
|
/// </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/)
|
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("oleaut32.lib");
|
||||||
options.LinkEnv.InputLibraries.Add("delayimp.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.CompileEnv.PreprocessorDefinitions.Add("USE_SOFT_INTRINSICS");
|
||||||
options.LinkEnv.InputLibraries.Add("softintrin.lib");
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user