Merge branch 'woa_support' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-woa_support
# Conflicts: # Source/ThirdParty/assimp/config.h.in # Source/Tools/Flax.Build/Deps/Dependencies/Assimp.cs
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>annotations</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
||||
@@ -125,9 +125,7 @@ namespace Flax.Build
|
||||
continue;
|
||||
if (!platform.HasRequiredSDKsInstalled && (!projectInfo.IsCSharpOnlyProject || platform != Platform.BuildPlatform))
|
||||
continue;
|
||||
|
||||
// Prevent generating configuration data for Windows x86
|
||||
if (architecture == TargetArchitecture.x86 && targetPlatform == TargetPlatform.Windows)
|
||||
if (!platform.CanBuildArchitecture(architecture))
|
||||
continue;
|
||||
|
||||
string configurationText = targetName + '.' + platformName + '.' + configurationName;
|
||||
|
||||
@@ -188,6 +188,16 @@ namespace Flax.Build
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this platform can compile or cross-compile for the specified architecture.
|
||||
/// </summary>
|
||||
/// <param name="targetArchitecture">The architecture.</param>
|
||||
/// <returns><c>true</c> if this platform can build the specified architecture; otherwise, <c>false</c>.</returns>
|
||||
public virtual bool CanBuildArchitecture(TargetArchitecture targetArchitecture)
|
||||
{
|
||||
return IsPlatformSupported(Target, targetArchitecture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the output file for the linker.
|
||||
/// </summary>
|
||||
@@ -286,11 +296,24 @@ namespace Flax.Build
|
||||
var subdir = "Binaries/Editor/";
|
||||
switch (Platform.BuildTargetPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows: return subdir + "Win64";
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
switch (Platform.BuildTargetArchitecture)
|
||||
{
|
||||
case TargetArchitecture.x64:
|
||||
return subdir + "Win64";
|
||||
case TargetArchitecture.x86:
|
||||
return subdir + "Win32";
|
||||
case TargetArchitecture.ARM64:
|
||||
return subdir + "ARM64";
|
||||
default:
|
||||
throw new NotImplementedException($"{Platform.BuildTargetPlatform}: {Platform.BuildTargetArchitecture}");
|
||||
}
|
||||
}
|
||||
case TargetPlatform.Linux: return subdir + "Linux";
|
||||
case TargetPlatform.Mac: return subdir + "Mac";
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
throw new NotImplementedException(Platform.BuildTargetPlatform.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -306,7 +329,7 @@ namespace Flax.Build
|
||||
|
||||
switch (targetPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows: return targetArchitecture == TargetArchitecture.x64 || targetArchitecture == TargetArchitecture.x86;
|
||||
case TargetPlatform.Windows: return targetArchitecture == TargetArchitecture.x64 || targetArchitecture == TargetArchitecture.x86 || targetArchitecture == TargetArchitecture.ARM64;
|
||||
case TargetPlatform.XboxScarlett: return targetArchitecture == TargetArchitecture.x64;
|
||||
case TargetPlatform.XboxOne: return targetArchitecture == TargetArchitecture.x64;
|
||||
case TargetPlatform.UWP: return targetArchitecture == TargetArchitecture.x64;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.IO;
|
||||
using Flax.Build;
|
||||
@@ -32,14 +32,14 @@ namespace Flax.Deps.Dependencies
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var solutionPath = Path.Combine(root, "DirectXMesh_Desktop_2015.sln");
|
||||
var solutionPath = Path.Combine(root, "DirectXMesh_Desktop_2022_Win10.sln");
|
||||
var configuration = "Release";
|
||||
var outputFileNames = new[]
|
||||
{
|
||||
"DirectXMesh.lib",
|
||||
"DirectXMesh.pdb",
|
||||
};
|
||||
var binFolder = Path.Combine(root, "DirectXMesh", "Bin", "Desktop_2015");
|
||||
var binFolder = Path.Combine(root, "DirectXMesh", "Bin", "Desktop_2022_Win10");
|
||||
|
||||
// Get the source
|
||||
CloneGitRepoFast(root, "https://github.com/Microsoft/DirectXMesh.git");
|
||||
@@ -50,14 +50,15 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
// Build for Win64
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, TargetArchitecture.x64);
|
||||
foreach (var file in outputFileNames)
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
Utilities.FileCopy(Path.Combine(binFolder, "x64", "Release", file), Path.Combine(depsFolder, file));
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, architecture);
|
||||
foreach (var file in outputFileNames)
|
||||
{
|
||||
Utilities.FileCopy(Path.Combine(binFolder, architecture.ToString(), "Release", file), Path.Combine(depsFolder, file));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Flax.Build;
|
||||
using Flax.Build.Platforms;
|
||||
|
||||
namespace Flax.Deps.Dependencies
|
||||
{
|
||||
/// <summary>
|
||||
/// DirectX Shader Compiler and tools. https://github.com/microsoft/DirectXShaderCompiler
|
||||
/// </summary>
|
||||
/// <seealso cref="Flax.Deps.Dependency" />
|
||||
class DirectXShaderCompiler : Dependency
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override TargetPlatform[] Platforms
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Windows,
|
||||
};
|
||||
default: return new TargetPlatform[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var sdk = WindowsPlatformBase.GetSDKs().Last();
|
||||
var sdkLibLocation = Path.Combine(sdk.Value, "Lib", WindowsPlatformBase.GetSDKVersion(sdk.Key).ToString(), "um");
|
||||
string binLocation = Path.Combine(sdk.Value, "bin", WindowsPlatformBase.GetSDKVersion(sdk.Key).ToString());
|
||||
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
|
||||
string dxilLocation = @$"{binLocation}\{architecture}\dxil.dll";
|
||||
string dxcompilerLocation = @$"{binLocation}\{architecture}\dxcompiler.dll";
|
||||
string d3dcompilerLocation = @$"{binLocation}\{architecture}\d3dcompiler_47.dll";
|
||||
Utilities.FileCopy(dxilLocation, Path.Combine(depsFolder, Path.GetFileName(dxilLocation)));
|
||||
Utilities.FileCopy(dxcompilerLocation, Path.Combine(depsFolder, Path.GetFileName(dxcompilerLocation)));
|
||||
Utilities.FileCopy(d3dcompilerLocation, Path.Combine(depsFolder, Path.GetFileName(d3dcompilerLocation)));
|
||||
|
||||
string dxcompilerLibLocation = @$"{sdkLibLocation}\{architecture}\dxcompiler.lib";
|
||||
string d3dcompilerLibLocation = @$"{sdkLibLocation}\{architecture}\d3dcompiler.lib";
|
||||
Utilities.FileCopy(dxcompilerLibLocation, Path.Combine(depsFolder, Path.GetFileName(dxcompilerLibLocation)));
|
||||
Utilities.FileCopy(d3dcompilerLibLocation, Path.Combine(depsFolder, "d3dcompiler_47.lib"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,12 +52,15 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var solutionPath = Path.Combine(root, "DirectXTex_Desktop_2022.sln");
|
||||
var binFolder = Path.Combine(root, "DirectXTex", "Bin", "Desktop_2022");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var file in outputFileNames)
|
||||
Utilities.FileCopy(Path.Combine(binFolder, "x64", configuration, file), Path.Combine(depsFolder, file));
|
||||
var solutionPath = Path.Combine(root, "DirectXTex_Desktop_2022_Win10.sln");
|
||||
var binFolder = Path.Combine(root, "DirectXTex", "Bin", "Desktop_2022_Win10");
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in outputFileNames)
|
||||
Utilities.FileCopy(Path.Combine(binFolder, architecture.ToString(), configuration, file), Path.Combine(depsFolder, file));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.UWP:
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
Build(options, platform, TargetArchitecture.x64);
|
||||
Build(options, platform, TargetArchitecture.ARM64);
|
||||
break;
|
||||
case TargetPlatform.XboxOne:
|
||||
case TargetPlatform.XboxScarlett:
|
||||
@@ -193,7 +194,7 @@ namespace Flax.Deps.Dependencies
|
||||
RunCmake(cmakeFolder, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + cmakeArgs, envVars);
|
||||
|
||||
// Run build
|
||||
Utilities.Run("cmake", "--build . --config Release", null, cmakeFolder, Utilities.RunOptions.ThrowExceptionOnError, envVars);
|
||||
BuildCmake(cmakeFolder, envVars);
|
||||
|
||||
// Deploy binaries
|
||||
var libs = new[]
|
||||
|
||||
@@ -58,13 +58,40 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var binariesToCopy = new[]
|
||||
{
|
||||
"OpenAL32.lib",
|
||||
"OpenAL32.dll",
|
||||
};
|
||||
|
||||
string configuration = "Release";
|
||||
|
||||
// Get the source
|
||||
CloneGitRepo(root, "https://github.com/kcat/openal-soft.git");
|
||||
GitCheckout(root, "master", "d3875f333fb6abe2f39d82caca329414871ae53b"); // 1.23.1
|
||||
|
||||
// Build for Win64 and ARM64
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
var solutionPath = Path.Combine(buildDir, "OpenAL.sln");
|
||||
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_SHARED_LIBS=OFF");
|
||||
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");
|
||||
File.Delete(packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-binaries/openal-soft-" + version + "-bin.zip", packagePath);
|
||||
if (!File.Exists(packagePath))
|
||||
Downloader.DownloadFileFromUrlToPath("https://openal-soft.org/openal-binaries/openal-soft-" + version + "-bin.zip", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
archive.ExtractToDirectory(root);
|
||||
if (!Directory.Exists(root))
|
||||
archive.ExtractToDirectory(root);
|
||||
root = Path.Combine(root, archive.Entries.First().FullName);
|
||||
}
|
||||
|
||||
@@ -74,7 +101,7 @@ namespace Flax.Deps.Dependencies
|
||||
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"));
|
||||
Utilities.FileCopy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"), true);
|
||||
|
||||
// Deploy header files
|
||||
var files = Directory.GetFiles(Path.Combine(root, "include", "AL"));
|
||||
@@ -82,7 +109,7 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
Utilities.FileCopy(file, Path.Combine(dstIncludePath, Path.GetFileName(file)));
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Linux:
|
||||
|
||||
@@ -92,6 +92,14 @@ namespace Flax.Deps.Dependencies
|
||||
var cmakeParams = presetXml["preset"]["CMakeParams"];
|
||||
switch (targetPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
if (architecture == TargetArchitecture.ARM64)
|
||||
{
|
||||
// Windows ARM64 doesn't have GPU support, so avoid copying those DLLs around
|
||||
ConfigureCmakeSwitch(cmakeSwitches, "PX_COPY_EXTERNAL_DLL", "OFF");
|
||||
ConfigureCmakeSwitch(cmakeParams, "PX_COPY_EXTERNAL_DLL", "OFF");
|
||||
}
|
||||
break;
|
||||
case TargetPlatform.Android:
|
||||
ConfigureCmakeSwitch(cmakeParams, "CMAKE_INSTALL_PREFIX", $"install/android-{Configuration.AndroidPlatformApi}/PhysX");
|
||||
ConfigureCmakeSwitch(cmakeParams, "ANDROID_NATIVE_API_LEVEL", $"android-{Configuration.AndroidPlatformApi}");
|
||||
@@ -241,6 +249,12 @@ namespace Flax.Deps.Dependencies
|
||||
envVars.Add("PM_ANDROIDNDK_PATH", AndroidNdk.Instance.RootPath);
|
||||
}
|
||||
|
||||
// Update packman for old PhysX version (https://github.com/NVIDIA-Omniverse/PhysX/issues/229)
|
||||
if (BuildPlatform == TargetPlatform.Windows)
|
||||
Utilities.Run(Path.Combine(projectGenDir, "buildtools", "packman", "packman.cmd"), "update -y");
|
||||
else
|
||||
Utilities.Run(Path.Combine(projectGenDir, "buildtools", "packman", "packman"), "update -y");
|
||||
|
||||
// Print the PhysX version
|
||||
Log.Info("Building PhysX version " + File.ReadAllText(Path.Combine(root, "physx", "version.txt")) + " to " + binariesSubDir);
|
||||
|
||||
@@ -375,6 +389,7 @@ namespace Flax.Deps.Dependencies
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
Build(options, "vc17win64", platform, TargetArchitecture.x64);
|
||||
Build(options, "vc17win-arm64", platform, TargetArchitecture.ARM64);
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Linux:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Flax.Build;
|
||||
|
||||
@@ -32,14 +33,14 @@ namespace Flax.Deps.Dependencies
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var solutionPath = Path.Combine(root, "UVAtlas", "UVAtlas_2015.sln");
|
||||
var solutionPath = Path.Combine(root, "UVAtlas_2022_Win10.sln");
|
||||
var configuration = "Release";
|
||||
var outputFileNames = new[]
|
||||
{
|
||||
"UVAtlas.lib",
|
||||
"UVAtlas.pdb",
|
||||
};
|
||||
var binFolder = Path.Combine(root, "UVAtlas", "Bin", "Desktop_2015");
|
||||
var binFolder = Path.Combine(root, "UVAtlas", "Bin", "Desktop_2022_Win10");
|
||||
|
||||
// Get the source
|
||||
CloneGitRepoFast(root, "https://github.com/Microsoft/UVAtlas.git");
|
||||
@@ -51,13 +52,15 @@ namespace Flax.Deps.Dependencies
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
// Build for Win64
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, TargetArchitecture.x64);
|
||||
foreach (var file in outputFileNames)
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
Utilities.FileCopy(Path.Combine(binFolder, "x64", "Release", file), Path.Combine(depsFolder, file));
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString(), new Dictionary<string, string>() { { "RestorePackagesConfig", "true" } });
|
||||
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Windows, architecture);
|
||||
foreach (var file in outputFileNames)
|
||||
{
|
||||
Utilities.FileCopy(Path.Combine(binFolder, architecture.ToString(), "Release", file), Path.Combine(depsFolder, file));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Flax.Build;
|
||||
|
||||
@@ -37,7 +38,6 @@ namespace Flax.Deps.Dependencies
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var buildDir = Path.Combine(root, "build");
|
||||
|
||||
// Get the source
|
||||
var commit = "aeece2f609db959d1c5e43e4f00bd177ea130575"; // 4.6.1
|
||||
@@ -48,10 +48,12 @@ namespace Flax.Deps.Dependencies
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
foreach (var architecture in new []{ TargetArchitecture.x64 })
|
||||
|
||||
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
var isa = "-DASTCENC_ISA_SSE2=ON";
|
||||
var lib = "astcenc-sse2-static.lib";
|
||||
string buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
var isa = architecture == TargetArchitecture.ARM64 ? "-DASTCENC_ISA_NEON=ON" : "-DASTCENC_ISA_SSE2=ON";
|
||||
var lib = architecture == TargetArchitecture.ARM64 ? "astcenc-neon-static.lib" : "astcenc-sse2-static.lib";
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release -DASTCENC_CLI=OFF -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL " + isa);
|
||||
BuildCmake(buildDir);
|
||||
@@ -62,6 +64,7 @@ namespace Flax.Deps.Dependencies
|
||||
case TargetPlatform.Mac:
|
||||
foreach (var architecture in new []{ TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
string buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
var isa = architecture == TargetArchitecture.ARM64 ? "-DASTCENC_ISA_NEON=ON" : "-DASTCENC_ISA_SSE2=ON";
|
||||
var lib = architecture == TargetArchitecture.ARM64 ? "libastcenc-neon-static.a" : "libastcenc-sse2-static.a";
|
||||
SetupDirectory(buildDir, true);
|
||||
|
||||
@@ -46,12 +46,10 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var packagePath = Path.Combine(root, "package.zip");
|
||||
var vcVersion = "VC14";
|
||||
var configuration = "LIB Release - DLL Windows SSPI";
|
||||
var configuration = "Release";
|
||||
var binariesToCopyWin = new[]
|
||||
{
|
||||
"libcurl.lib",
|
||||
"lib/libcurl.pdb",
|
||||
};
|
||||
var filesToKeep = new[]
|
||||
{
|
||||
@@ -60,7 +58,7 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
// Get the source
|
||||
if (!File.Exists(packagePath))
|
||||
Downloader.DownloadFileFromUrlToPath("https://curl.haxx.se/download/curl-7.64.1.zip", packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath("https://curl.haxx.se/download/curl-7.88.1.zip", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
var newRoot = Path.Combine(root, archive.Entries.First().FullName);
|
||||
@@ -75,20 +73,17 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var vsSolutionPath = Path.Combine(root, "projects", "Windows", vcVersion, "curl-all.sln");
|
||||
var vcxprojPath = Path.Combine(root, "projects", "Windows", vcVersion, "lib", "libcurl.vcxproj");
|
||||
var vcxprojContents = File.ReadAllText(vcxprojPath);
|
||||
vcxprojContents = vcxprojContents.Replace("<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>");
|
||||
vcxprojContents = vcxprojContents.Replace("<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>");
|
||||
vcxprojContents = vcxprojContents.Replace("<WholeProgramOptimization>true</WholeProgramOptimization>", "<WholeProgramOptimization>false</WholeProgramOptimization>");
|
||||
vcxprojContents = vcxprojContents.Replace("<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>", "<DebugInformationFormat></DebugInformationFormat>");
|
||||
File.WriteAllText(vcxprojPath, vcxprojContents);
|
||||
// Build for Win64 and ARM64
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
// Build for Win64
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var filename in binariesToCopyWin)
|
||||
Utilities.FileCopy(Path.Combine(root, "build", "Win64", vcVersion, configuration, filename), Path.Combine(depsFolder, Path.GetFileName(filename)));
|
||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
var solutionPath = Path.Combine(buildDir, "CURL.sln");
|
||||
|
||||
RunCmake(root, platform, architecture, $"-B\"{buildDir}\" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_STATIC_CRT=OFF");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopyWin)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, "lib", configuration, file), Path.Combine(depsFolder, Path.GetFileName(file)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
57
Source/Tools/Flax.Build/Deps/Dependencies/dbghelp.cs
Normal file
57
Source/Tools/Flax.Build/Deps/Dependencies/dbghelp.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Flax.Build;
|
||||
using Flax.Build.Platforms;
|
||||
|
||||
namespace Flax.Deps.Dependencies
|
||||
{
|
||||
/// <summary>
|
||||
/// Windows Debug Help Library.
|
||||
/// </summary>
|
||||
/// <seealso cref="Flax.Deps.Dependency" />
|
||||
class dbghelp : Dependency
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override TargetPlatform[] Platforms
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Windows,
|
||||
};
|
||||
default: return new TargetPlatform[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
var sdk = WindowsPlatformBase.GetSDKs().Last();
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
var libLocation = @$"{sdk.Value}Debuggers\lib\{architecture}\dbghelp.lib";
|
||||
var dllLocation = @$"{sdk.Value}Debuggers\{architecture}\dbghelp.dll";
|
||||
Utilities.FileCopy(libLocation, Path.Combine(depsFolder, Path.GetFileName(libLocation)));
|
||||
Utilities.FileCopy(dllLocation, Path.Combine(depsFolder, Path.GetFileName(dllLocation)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
// Get the source
|
||||
if (!File.Exists(packagePath))
|
||||
Downloader.DownloadFileFromUrlToPath("https://sourceforge.net/projects/freetype/files/freetype2/2.10.0/ft2100.zip/download", packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath("https://sourceforge.net/projects/freetype/files/freetype2/2.13.2/ft2132.zip/download", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
var newRoot = Path.Combine(root, archive.Entries.First().FullName);
|
||||
@@ -99,15 +99,22 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
// Fix the MSVC project settings for Windows
|
||||
PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "8.1", "140");
|
||||
|
||||
// Build for Win64
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configurationMsvc, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var filename in binariesToCopyMsvc)
|
||||
Utilities.FileCopy(Path.Combine(root, "objs", "x64", configurationMsvc, filename), Path.Combine(depsFolder, filename));
|
||||
// Patch the RuntimeLibrary value
|
||||
File.WriteAllText(vcxprojPath, vcxprojContents);
|
||||
|
||||
// Build for Windows
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configurationMsvc, architecture.ToString(),
|
||||
new Dictionary<string, string>() {
|
||||
{ "WindowsTargetPlatformVersion", "10.0" },
|
||||
{ "PlatformToolset", "v143" },
|
||||
//{ "RuntimeLibrary", "MultiThreadedDLL" }
|
||||
});
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var filename in binariesToCopyMsvc)
|
||||
Utilities.FileCopy(Path.Combine(root, "objs", architecture.ToString(), configurationMsvc, filename), Path.Combine(depsFolder, filename));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.UWP:
|
||||
@@ -286,18 +293,25 @@ namespace Flax.Deps.Dependencies
|
||||
Utilities.FileCopy(src, dst);
|
||||
}
|
||||
|
||||
// Setup headers directory
|
||||
SetupDirectory(dstIncludePath, true);
|
||||
|
||||
// Deploy header files and restore files
|
||||
Utilities.DirectoryCopy(srcIncludePath, dstIncludePath, true, true);
|
||||
Utilities.FileCopy(Path.Combine(root, "include", "ft2build.h"), Path.Combine(dstIncludePath, "ft2build.h"));
|
||||
Utilities.FileCopy(Path.Combine(root, "docs", "LICENSE.TXT"), Path.Combine(dstIncludePath, "LICENSE.TXT"));
|
||||
foreach (var filename in filesToKeep)
|
||||
try
|
||||
{
|
||||
var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
|
||||
var dst = Path.Combine(dstIncludePath, filename);
|
||||
Utilities.FileCopy(src, dst);
|
||||
// Setup headers directory
|
||||
SetupDirectory(dstIncludePath, true);
|
||||
|
||||
// Deploy header files and restore files
|
||||
Utilities.DirectoryCopy(srcIncludePath, dstIncludePath, true, true);
|
||||
Utilities.FileCopy(Path.Combine(root, "include", "ft2build.h"), Path.Combine(dstIncludePath, "ft2build.h"));
|
||||
Utilities.FileCopy(Path.Combine(root, "LICENSE.TXT"), Path.Combine(dstIncludePath, "LICENSE.TXT"));
|
||||
Utilities.FileCopy(Path.Combine(root, "docs", "FTL.TXT"), Path.Combine(dstIncludePath, "FTL.TXT"));
|
||||
}
|
||||
finally
|
||||
{
|
||||
foreach (var filename in filesToKeep)
|
||||
{
|
||||
var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
|
||||
var dst = Path.Combine(dstIncludePath, filename);
|
||||
Utilities.FileCopy(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Flax.Deps.Dependencies
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Linux,
|
||||
TargetPlatform.Windows,
|
||||
};
|
||||
case TargetPlatform.Linux:
|
||||
return new[]
|
||||
@@ -43,8 +43,6 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var installDir = Path.Combine(root, "install");
|
||||
var buildDir = root;
|
||||
var solutionPath = Path.Combine(buildDir, "glslang.sln");
|
||||
var configuration = "Release";
|
||||
var cmakeArgs = string.Format("-DCMAKE_INSTALL_PREFIX=\"{0}\" -DCMAKE_BUILD_TYPE={1} -DENABLE_RTTI=ON -DENABLE_CTEST=OFF -DENABLE_HLSL=ON -DENABLE_SPVREMAPPER=ON -DENABLE_GLSLANG_BINARIES=OFF", installDir, configuration);
|
||||
var libsRoot = Path.Combine(installDir, "lib");
|
||||
@@ -53,6 +51,7 @@ namespace Flax.Deps.Dependencies
|
||||
CloneGitRepoFast(root, "https://github.com/FlaxEngine/glslang.git");
|
||||
|
||||
// Setup the external sources
|
||||
// Requires distutils (pip install setuptools)
|
||||
Utilities.Run("python", "update_glslang_sources.py", null, root, Utilities.RunOptions.ConsoleLogOutput);
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
@@ -74,15 +73,21 @@ namespace Flax.Deps.Dependencies
|
||||
Path.Combine(libsRoot, "glslang.lib"),
|
||||
};
|
||||
|
||||
// Build for Win64
|
||||
File.Delete(Path.Combine(buildDir, "CMakeCache.txt"));
|
||||
RunCmake(buildDir, platform, TargetArchitecture.x64, cmakeArgs);
|
||||
Utilities.Run("cmake", string.Format("--build . --config {0} --target install", configuration), null, buildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var file in outputFiles)
|
||||
// Build for Windows
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
Utilities.FileCopy(file, Path.Combine(depsFolder, Path.GetFileName(file)));
|
||||
var buildDir = Path.Combine(root, "build-" + architecture.ToString());
|
||||
var solutionPath = Path.Combine(buildDir, "glslang.sln");
|
||||
|
||||
SetupDirectory(buildDir, false);
|
||||
RunCmake(root, platform, architecture, cmakeArgs + $" -B\"{buildDir}\"");
|
||||
Utilities.Run("cmake", string.Format("--build . --config {0} --target install", configuration), null, buildDir, Utilities.RunOptions.ConsoleLogOutput);
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, architecture.ToString());
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in outputFiles)
|
||||
{
|
||||
Utilities.FileCopy(file, Path.Combine(depsFolder, Path.GetFileName(file)));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -100,6 +105,7 @@ namespace Flax.Deps.Dependencies
|
||||
Path.Combine(libsRoot, "libSPIRV.a"),
|
||||
Path.Combine(libsRoot, "libglslang.a"),
|
||||
};
|
||||
var buildDir = root;
|
||||
|
||||
// Build for Linux
|
||||
RunCmake(root, platform, TargetArchitecture.x64, cmakeArgs);
|
||||
@@ -128,6 +134,7 @@ namespace Flax.Deps.Dependencies
|
||||
Path.Combine(libsRoot, "libSPIRV.a"),
|
||||
Path.Combine(libsRoot, "libglslang.a"),
|
||||
};
|
||||
var buildDir = root;
|
||||
|
||||
// Build for Mac
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Flax.Build;
|
||||
using Flax.Build.Platforms;
|
||||
|
||||
namespace Flax.Deps.Dependencies
|
||||
{
|
||||
/// <summary>
|
||||
/// Ogg project codecs use the Ogg bitstream format to arrange the raw, compressed bitstream into a more robust, useful form. For example, the Ogg bitstream makes seeking, time stamping and error recovery possible, as well as mixing several sepearate, concurrent media streams into a single physical bitstream.
|
||||
/// </summary>
|
||||
/// <seealso cref="Flax.Deps.Dependency" />
|
||||
class ogg : Dependency
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override TargetPlatform[] Platforms
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (BuildPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Windows,
|
||||
TargetPlatform.UWP,
|
||||
TargetPlatform.XboxOne,
|
||||
TargetPlatform.PS4,
|
||||
TargetPlatform.PS5,
|
||||
TargetPlatform.XboxScarlett,
|
||||
TargetPlatform.Android,
|
||||
TargetPlatform.Switch,
|
||||
};
|
||||
case TargetPlatform.Linux:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Linux,
|
||||
};
|
||||
case TargetPlatform.Mac:
|
||||
return new[]
|
||||
{
|
||||
TargetPlatform.Mac,
|
||||
TargetPlatform.iOS,
|
||||
};
|
||||
default: return new TargetPlatform[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PatchWindowsTargetPlatformVersion(string vcxprojPath, string vcxprojContents, string windowsTargetPlatformVersion, string platformToolset)
|
||||
{
|
||||
// Fix the MSVC project settings for Windows
|
||||
var contents = vcxprojContents.Replace("<PlatformToolset>v140</PlatformToolset>", string.Format("<PlatformToolset>{0}</PlatformToolset>", platformToolset));
|
||||
contents = contents.Replace("</RootNamespace>", string.Format("</RootNamespace><WindowsTargetPlatformVersion>{0}</WindowsTargetPlatformVersion>", windowsTargetPlatformVersion));
|
||||
File.WriteAllText(vcxprojPath, contents);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Build(BuildOptions options)
|
||||
{
|
||||
var root = options.IntermediateFolder;
|
||||
var configuration = "Release";
|
||||
var filesToKeep = new[]
|
||||
{
|
||||
"ogg.Build.cs",
|
||||
};
|
||||
|
||||
// Get the source
|
||||
CloneGitRepo(root, "https://github.com/xiph/ogg");
|
||||
GitCheckout(root, "master", "4380566a44b8d5e85ad511c9c17eb04197863ec5");
|
||||
|
||||
var binariesToCopyMsvc = new[]
|
||||
{
|
||||
"libogg_static.lib",
|
||||
};
|
||||
var vsSolutionPath = Path.Combine(root, "win32", "VS2015", "libogg_static.sln");
|
||||
var vcxprojPath = Path.Combine(root, "win32", "VS2015", "libogg_static.vcxproj");
|
||||
var vcxprojContents = File.ReadAllText(vcxprojPath);
|
||||
var libraryFileName = "libogg.a";
|
||||
vcxprojContents = vcxprojContents.Replace("<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>");
|
||||
vcxprojContents = vcxprojContents.Replace("<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>");
|
||||
vcxprojContents = vcxprojContents.Replace("<WholeProgramOptimization>true</WholeProgramOptimization>", "<WholeProgramOptimization>false</WholeProgramOptimization>");
|
||||
var buildDir = Path.Combine(root, "build");
|
||||
|
||||
foreach (var platform in options.Platforms)
|
||||
{
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
// Fix the MSVC project settings for Windows
|
||||
PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "8.1", "140");
|
||||
|
||||
// Build for Win64
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var file in binariesToCopyMsvc)
|
||||
Utilities.FileCopy(Path.Combine(root, "win32", "VS2015", "x64", configuration, file), Path.Combine(depsFolder, file));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.UWP:
|
||||
{
|
||||
// Fix the MSVC project settings for UWP
|
||||
PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "10.0.17763.0", "v141");
|
||||
|
||||
// Build for UWP x64
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var file in binariesToCopyMsvc)
|
||||
Utilities.FileCopy(Path.Combine(root, "win32", "VS2015", "x64", configuration, file), Path.Combine(depsFolder, file));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Linux:
|
||||
{
|
||||
var envVars = new Dictionary<string, string>
|
||||
{
|
||||
{ "CC", "clang-7" },
|
||||
{ "CC_FOR_BUILD", "clang-7" }
|
||||
};
|
||||
|
||||
Utilities.Run(Path.Combine(root, "autogen.sh"), null, null, root, Utilities.RunOptions.Default, envVars);
|
||||
|
||||
// Build for Linux
|
||||
var toolchain = UnixToolchain.GetToolchainName(platform, TargetArchitecture.x64);
|
||||
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, TargetArchitecture.x64);
|
||||
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS4:
|
||||
{
|
||||
// Get the build data files
|
||||
Utilities.DirectoryCopy(
|
||||
Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg"),
|
||||
Path.Combine(root, "PS4"), true, true);
|
||||
|
||||
// Build for PS4
|
||||
var solutionPath = Path.Combine(root, "PS4", "libogg_static.sln");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, "Release", "ORBIS");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
Utilities.FileCopy(Path.Combine(root, "PS4", "lib", libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS5:
|
||||
{
|
||||
// Get the build data files
|
||||
Utilities.DirectoryCopy(
|
||||
Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg"),
|
||||
Path.Combine(root, "PS5"), true, true);
|
||||
|
||||
// Build for PS5
|
||||
var solutionPath = Path.Combine(root, "PS5", "libogg_static.sln");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, "Release", "PROSPERO");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
Utilities.FileCopy(Path.Combine(root, "PS5", "lib", libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.XboxOne:
|
||||
{
|
||||
// Fix the MSVC project settings for Xbox Scarlett
|
||||
PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "10.0.19041.0", "v142");
|
||||
|
||||
// Build for Xbox Scarlett x64
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var file in binariesToCopyMsvc)
|
||||
Utilities.FileCopy(Path.Combine(root, "win32", "VS2015", "x64", configuration, file), Path.Combine(depsFolder, file));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.XboxScarlett:
|
||||
{
|
||||
// Fix the MSVC project settings for Xbox Scarlett
|
||||
PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "10.0.19041.0", "v142");
|
||||
|
||||
// Build for Xbox Scarlett x64
|
||||
Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configuration, "x64");
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
|
||||
foreach (var file in binariesToCopyMsvc)
|
||||
Utilities.FileCopy(Path.Combine(root, "win32", "VS2015", "x64", configuration, file), Path.Combine(depsFolder, file));
|
||||
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Android:
|
||||
{
|
||||
// Build for Android
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release");
|
||||
BuildCmake(buildDir);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Switch:
|
||||
{
|
||||
// Get the build data files
|
||||
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg"), root, true, true);
|
||||
|
||||
// Build for Switch
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release");
|
||||
BuildCmake(buildDir);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.Mac:
|
||||
{
|
||||
// Build for Mac
|
||||
foreach (var architecture in new[] { TargetArchitecture.x64, TargetArchitecture.ARM64 })
|
||||
{
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, architecture, ".. -DCMAKE_BUILD_TYPE=Release");
|
||||
BuildCmake(buildDir);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.iOS:
|
||||
{
|
||||
SetupDirectory(buildDir, true);
|
||||
RunCmake(buildDir, platform, TargetArchitecture.ARM64, ".. -DCMAKE_BUILD_TYPE=Release");
|
||||
BuildCmake(buildDir);
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
|
||||
Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Backup files
|
||||
var srcIncludePath = Path.Combine(root, "include", "ogg");
|
||||
var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "ogg");
|
||||
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
|
||||
SetupDirectory(dstIncludePath, true);
|
||||
|
||||
// Deploy header files and restore files
|
||||
Directory.GetFiles(srcIncludePath, "Makefile*").ToList().ForEach(File.Delete);
|
||||
Directory.GetFiles(srcIncludePath, "*.in").ToList().ForEach(File.Delete);
|
||||
Utilities.DirectoryCopy(srcIncludePath, dstIncludePath, true, true);
|
||||
File.Copy(Path.Combine(root, "COPYING"), Path.Combine(dstIncludePath, "COPYING"));
|
||||
foreach (var filename in filesToKeep)
|
||||
{
|
||||
var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
|
||||
var dst = Path.Combine(dstIncludePath, filename);
|
||||
Utilities.FileCopy(src, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,11 +69,24 @@ namespace Flax.Deps.Dependencies
|
||||
private List<string> vcxprojContentsWindows;
|
||||
private string[] vcxprojPathsWindows;
|
||||
|
||||
private Binary[] binariesToCopyWindows =
|
||||
private Binary[] vorbisBinariesToCopyWindows =
|
||||
{
|
||||
new Binary("libvorbis_static.lib", "libvorbis"),
|
||||
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)
|
||||
{
|
||||
@@ -92,28 +105,24 @@ namespace Flax.Deps.Dependencies
|
||||
return;
|
||||
|
||||
hasSourcesReady = true;
|
||||
|
||||
var packagePath = Path.Combine(root, "package.zip");
|
||||
configurationMsvc = "Release";
|
||||
|
||||
// Get the additional source (ogg dependency)
|
||||
Downloader.DownloadFileFromUrlToPath("http://downloads.xiph.org/releases/ogg/libogg-1.3.3.zip", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
archive.ExtractToDirectory(root);
|
||||
Directory.Move(Path.Combine(root, archive.Entries.First().FullName), Path.Combine(root, "libogg"));
|
||||
}
|
||||
string oggRoot = Path.Combine(root, "libogg");
|
||||
string vorbisRoot = Path.Combine(root, "libvorbis");
|
||||
|
||||
// Get the source
|
||||
File.Delete(packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath("http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.zip", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
archive.ExtractToDirectory(root);
|
||||
rootMsvcLib = Path.Combine(root, archive.Entries.First().FullName);
|
||||
}
|
||||
SetupDirectory(oggRoot, false);
|
||||
CloneGitRepo(oggRoot, "https://github.com/xiph/ogg.git");
|
||||
GitResetLocalChanges(oggRoot); // Reset patches
|
||||
GitCheckout(oggRoot, "master", "db5c7a49ce7ebda47b15b78471e78fb7f2483e22");
|
||||
|
||||
// Patch Windows projects
|
||||
SetupDirectory(vorbisRoot, false);
|
||||
CloneGitRepo(vorbisRoot, "https://github.com/xiph/vorbis.git");
|
||||
GitResetLocalChanges(vorbisRoot); // Reset patches
|
||||
GitCheckout(vorbisRoot, "master", "84c023699cdf023a32fa4ded32019f194afcdad0");
|
||||
|
||||
rootMsvcLib = vorbisRoot;
|
||||
|
||||
// Patch Windows projects which use MSBuild
|
||||
vcxprojPathsWindows = new[]
|
||||
{
|
||||
Path.Combine(rootMsvcLib, "win32", "VS2010", "libvorbis", "libvorbis_static.vcxproj"),
|
||||
@@ -127,6 +136,36 @@ namespace Flax.Deps.Dependencies
|
||||
contents = contents.Replace("<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>", "<DebugInformationFormat></DebugInformationFormat>");
|
||||
vcxprojContentsWindows[i] = contents.Replace("<WholeProgramOptimization>true</WholeProgramOptimization>", "<WholeProgramOptimization>false</WholeProgramOptimization>");
|
||||
}
|
||||
|
||||
// TODO: FIXME for UWP/XBoxOne (use CMake for these too?)
|
||||
#if false
|
||||
var packagePath = Path.Combine(root, "package.zip");
|
||||
configurationMsvc = "Release";
|
||||
|
||||
// Get the additional source (ogg dependency)
|
||||
if (!Directory.Exists(Path.Combine(root, "libogg")))
|
||||
{
|
||||
File.Delete(packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath("http://downloads.xiph.org/releases/ogg/libogg-1.3.3.zip", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
archive.ExtractToDirectory(root);
|
||||
Directory.Move(Path.Combine(root, archive.Entries.First().FullName), Path.Combine(root, "libogg"));
|
||||
}
|
||||
}
|
||||
|
||||
// Get the source
|
||||
if (!Directory.Exists(Path.Combine(root, "libvorbis")))
|
||||
{
|
||||
File.Delete(packagePath);
|
||||
Downloader.DownloadFileFromUrlToPath("http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.6.zip", packagePath);
|
||||
using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
|
||||
{
|
||||
archive.ExtractToDirectory(root);
|
||||
Directory.Move(Path.Combine(root, archive.Entries.First().FullName), Path.Combine(root, "libvorbis"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void BuildMsbuild(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture)
|
||||
@@ -135,14 +174,14 @@ namespace Flax.Deps.Dependencies
|
||||
|
||||
string buildPlatform, buildDir;
|
||||
string[] vcxprojPaths;
|
||||
Binary[] binariesToCopy;
|
||||
List<Binary> binariesToCopy = new List<Binary>();
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
||||
binariesToCopy = binariesToCopyWindows;
|
||||
vcxprojPaths = vcxprojPathsWindows;
|
||||
PatchWindowsTargetPlatformVersion("8.1", "v140");
|
||||
PatchWindowsTargetPlatformVersion("10.0", "v143");
|
||||
switch (architecture)
|
||||
{
|
||||
case TargetArchitecture.x86:
|
||||
@@ -151,13 +190,17 @@ namespace Flax.Deps.Dependencies
|
||||
case TargetArchitecture.x64:
|
||||
buildPlatform = "x64";
|
||||
break;
|
||||
case TargetArchitecture.ARM64:
|
||||
buildPlatform = "ARM64";
|
||||
break;
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
}
|
||||
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.UWP:
|
||||
{
|
||||
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
||||
binariesToCopy = binariesToCopyWindows;
|
||||
vcxprojPaths = vcxprojPathsWindows;
|
||||
PatchWindowsTargetPlatformVersion("10.0.17763.0", "v141");
|
||||
switch (architecture)
|
||||
@@ -173,11 +216,13 @@ 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))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS4:
|
||||
{
|
||||
buildDir = Path.Combine(rootMsvcLib, "PS4");
|
||||
binariesToCopy = new[]
|
||||
var binariesToCopyVorbis = new[]
|
||||
{
|
||||
new Binary("libvorbis.a", "libvorbis"),
|
||||
};
|
||||
@@ -186,16 +231,17 @@ namespace Flax.Deps.Dependencies
|
||||
Path.Combine(buildDir, "libvorbis", "libvorbis_static.vcxproj"),
|
||||
};
|
||||
buildPlatform = "ORBIS";
|
||||
Utilities.DirectoryCopy(
|
||||
Path.Combine(GetBinariesFolder(options, platform), "Data", "vorbis"),
|
||||
Utilities.DirectoryCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "vorbis"),
|
||||
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"));
|
||||
Utilities.FileCopy(Path.Combine(GetBinariesFolder(options, platform), "Data", "ogg", "ogg", "config_types.h"),
|
||||
Path.Combine(root, "..", "ogg", "include", "ogg", "config_types.h"));
|
||||
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.PS5:
|
||||
{
|
||||
buildDir = Path.Combine(rootMsvcLib, "PS5");
|
||||
binariesToCopy = new[]
|
||||
var binariesToCopyVorbis = new[]
|
||||
{
|
||||
new Binary("libvorbis.a", "libvorbis"),
|
||||
};
|
||||
@@ -209,21 +255,23 @@ 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"));
|
||||
Path.Combine(root, "..", "ogg", "include", "ogg", "config_types.h"));
|
||||
binariesToCopy.AddRange(binariesToCopyVorbis.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.XboxOne:
|
||||
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
||||
binariesToCopy = binariesToCopyWindows;
|
||||
vcxprojPaths = vcxprojPathsWindows;
|
||||
buildPlatform = "x64";
|
||||
PatchWindowsTargetPlatformVersion("10.0.19041.0", "v142");
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
case TargetPlatform.XboxScarlett:
|
||||
buildDir = Path.Combine(rootMsvcLib, "win32", "VS2010");
|
||||
binariesToCopy = binariesToCopyWindows;
|
||||
vcxprojPaths = vcxprojPathsWindows;
|
||||
buildPlatform = "x64";
|
||||
PatchWindowsTargetPlatformVersion("10.0.19041.0", "v142");
|
||||
binariesToCopy.AddRange(vorbisBinariesToCopyWindows.Select(x => new Binary(x.Filename, Path.Combine(buildDir, x.SrcFolder, buildPlatform, configurationMsvc))));
|
||||
break;
|
||||
default: throw new InvalidPlatformException(platform);
|
||||
}
|
||||
@@ -235,7 +283,60 @@ namespace Flax.Deps.Dependencies
|
||||
// Copy binaries
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var filename in binariesToCopy)
|
||||
Utilities.FileCopy(Path.Combine(buildDir, filename.SrcFolder, buildPlatform, configurationMsvc, filename.Filename), Path.Combine(depsFolder, filename.Filename));
|
||||
Utilities.FileCopy(Path.Combine(filename.SrcFolder, filename.Filename), Path.Combine(depsFolder, filename.Filename));
|
||||
}
|
||||
|
||||
private void BuildCmake(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture)
|
||||
{
|
||||
GetSources();
|
||||
|
||||
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());
|
||||
|
||||
string ext;
|
||||
switch (platform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
case TargetPlatform.UWP:
|
||||
case TargetPlatform.XboxOne:
|
||||
ext = ".lib";
|
||||
break;
|
||||
case TargetPlatform.Linux:
|
||||
ext = ".a";
|
||||
break;
|
||||
default:
|
||||
throw new InvalidPlatformException(platform);
|
||||
}
|
||||
|
||||
List<(string, string)> binariesToCopy = new List<(string, string)>();
|
||||
// Build ogg
|
||||
{
|
||||
var solutionPath = Path.Combine(oggBuildDir, "ogg.sln");
|
||||
|
||||
RunCmake(oggRoot, platform, architecture, $"-B\"{oggBuildDir}\" -DBUILD_SHARED_LIBS=OFF");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
|
||||
foreach (var file in oggBinariesToCopyWindowsCmake)
|
||||
binariesToCopy.Add((Path.Combine(oggBuildDir, configurationMsvc, file.Item1), file.Item2));
|
||||
}
|
||||
|
||||
// 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");
|
||||
Deploy.VCEnvironment.BuildSolution(solutionPath, configurationMsvc, architecture.ToString());
|
||||
foreach (var file in vorbisBinariesToCopyWindowsCmake)
|
||||
binariesToCopy.Add((Path.Combine(vorbisBuildDir, "lib", configurationMsvc, file.Item1), file.Item2));
|
||||
}
|
||||
|
||||
// Copy binaries
|
||||
var depsFolder = GetThirdPartyFolder(options, platform, architecture);
|
||||
foreach (var file in binariesToCopy)
|
||||
Utilities.FileCopy(file.Item1, Path.Combine(depsFolder, file.Item2));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -259,7 +360,8 @@ namespace Flax.Deps.Dependencies
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
{
|
||||
BuildMsbuild(options, TargetPlatform.Windows, TargetArchitecture.x64);
|
||||
BuildCmake(options, TargetPlatform.Windows, TargetArchitecture.x64);
|
||||
BuildCmake(options, TargetPlatform.Windows, TargetArchitecture.ARM64);
|
||||
break;
|
||||
}
|
||||
case TargetPlatform.UWP:
|
||||
@@ -428,18 +530,24 @@ namespace Flax.Deps.Dependencies
|
||||
Utilities.FileCopy(src, dst);
|
||||
}
|
||||
|
||||
// Setup headers directory
|
||||
SetupDirectory(dstIncludePath, 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"));
|
||||
foreach (var filename in filesToKeep)
|
||||
try
|
||||
{
|
||||
var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
|
||||
var dst = Path.Combine(dstIncludePath, filename);
|
||||
Utilities.FileCopy(src, dst);
|
||||
// Setup headers directory
|
||||
SetupDirectory(dstIncludePath, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Flax.Deps
|
||||
/// <param name="submodules">True if initialize submodules of the repository (recursive).</param>
|
||||
public static void CloneGitRepo(string path, string url, string commit = null, string args = null, bool submodules = false)
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(path, Path.GetFileNameWithoutExtension(url), ".git")))
|
||||
if (!Directory.Exists(Path.Combine(path, ".git")))
|
||||
{
|
||||
string cmdLine = string.Format("clone \"{0}\" \"{1}\"", url, path);
|
||||
if (args != null)
|
||||
@@ -140,12 +140,12 @@ namespace Flax.Deps
|
||||
if (submodules)
|
||||
cmdLine += " --recurse-submodules";
|
||||
|
||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||
if (submodules)
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool);
|
||||
}
|
||||
if (commit != null)
|
||||
Utilities.Run("git", string.Format("reset --hard {0}", commit), null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", string.Format("reset --hard {0}", commit), null, path, Utilities.RunOptions.DefaultTool);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,7 +157,7 @@ namespace Flax.Deps
|
||||
/// <param name="submodules">True if initialize submodules of the repository (recursive).</param>
|
||||
public static void CloneGitRepoFast(string path, string url, string args = null, bool submodules = false)
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(path, Path.GetFileNameWithoutExtension(url), ".git")))
|
||||
if (!Directory.Exists(Path.Combine(path, ".git")))
|
||||
{
|
||||
string cmdLine = string.Format("clone \"{0}\" \"{1}\" --depth 1", url, path);
|
||||
if (args != null)
|
||||
@@ -165,9 +165,9 @@ namespace Flax.Deps
|
||||
if (submodules)
|
||||
cmdLine += " --recurse-submodules";
|
||||
|
||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||
if (submodules)
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,9 +192,9 @@ namespace Flax.Deps
|
||||
if (submodules)
|
||||
cmdLine += " --recurse-submodules";
|
||||
|
||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||
if (submodules)
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool);
|
||||
}
|
||||
|
||||
if (commit != null)
|
||||
@@ -221,7 +221,7 @@ namespace Flax.Deps
|
||||
|
||||
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||
if (submodules)
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool);
|
||||
Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool);
|
||||
|
||||
if (commit != null)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>annotations</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Flax.Build.Platforms
|
||||
options.LinkEnv.InputLibraries.Add($"Microsoft.Xbox.Services.{(int)xboxServicesToolset}.GDK.C.lib");
|
||||
|
||||
var toolsetPath = WindowsPlatformBase.GetToolsets()[Toolset];
|
||||
var toolsPath = WindowsPlatformBase.GetVCToolPath64(Toolset);
|
||||
var toolsPath = WindowsPlatformBase.GetVCToolPath(Toolset, TargetArchitecture.x64, Architecture);
|
||||
if (options.CompileEnv.UseDebugCRT)
|
||||
throw new Exception("Don't use debug CRT on GDK.");
|
||||
var name = Path.GetFileName(toolsetPath);
|
||||
|
||||
@@ -70,6 +70,24 @@ namespace Flax.Build.Platforms
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanBuildArchitecture(TargetArchitecture targetArchitecture)
|
||||
{
|
||||
// Prevent generating configuration data for Windows x86 (deprecated)
|
||||
if (targetArchitecture == TargetArchitecture.x86)
|
||||
return false;
|
||||
|
||||
// Check if we have a compiler for this architecture
|
||||
var toolsets = GetToolsets();
|
||||
foreach (var toolset in toolsets)
|
||||
{
|
||||
if (GetVCToolPath(toolset.Key, BuildTargetArchitecture, targetArchitecture) != null)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
void IVisualStudioProjectCustomizer.WriteVisualStudioBegin(VisualStudioProject project, Platform platform, StringBuilder vcProjectFileContent, StringBuilder vcFiltersFileContent, StringBuilder vcUserFileContent)
|
||||
{
|
||||
@@ -82,7 +100,7 @@ namespace Flax.Build.Platforms
|
||||
var outputType = project.OutputType ?? configuration.Target.OutputType;
|
||||
if (outputType != TargetOutputType.Executable && configuration.Name.StartsWith("Editor."))
|
||||
{
|
||||
var editorFolder = configuration.Architecture == TargetArchitecture.x64 ? "Win64" : "Win32";
|
||||
var editorFolder = configuration.Architecture == TargetArchitecture.x64 ? "Win64" : (configuration.Architecture == TargetArchitecture.ARM64 ? "ARM64" : "Win32");
|
||||
vcUserFileContent.AppendLine(string.Format(" <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='{0}'\">", configuration.Name));
|
||||
vcUserFileContent.AppendLine(string.Format(" <LocalDebuggerCommand>{0}\\FlaxEditor.exe</LocalDebuggerCommand>", Path.Combine(Globals.EngineRoot, "Binaries", "Editor", editorFolder, configuration.ConfigurationName)));
|
||||
vcUserFileContent.AppendLine(" <LocalDebuggerCommandArguments>-project \"$(SolutionDir)\" -skipCompile</LocalDebuggerCommandArguments>");
|
||||
@@ -108,6 +126,9 @@ namespace Flax.Build.Platforms
|
||||
case TargetArchitecture.x64:
|
||||
name = "Win64";
|
||||
break;
|
||||
case TargetArchitecture.ARM64:
|
||||
name = "ARM64";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,12 +416,16 @@ namespace Flax.Build.Platforms
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the 32-bit tool binaries.
|
||||
/// Gets the path to the VC++ tool binaries for specified host and target architectures.
|
||||
/// </summary>
|
||||
/// <param name="toolset">The version of the toolset to use.</param>
|
||||
/// <returns>The directory containing the 64-bit toolchain binaries.</returns>
|
||||
public static string GetVCToolPath32(WindowsPlatformToolset toolset)
|
||||
/// <param name="hostArchitecture">The host architecture for native binaries.</param>
|
||||
/// <param name="architecture">The target architecture to build for.</param>
|
||||
/// <returns>The directory containing the toolchain binaries.</returns>
|
||||
public static string GetVCToolPath(WindowsPlatformToolset toolset, TargetArchitecture hostArchitecture, TargetArchitecture architecture)
|
||||
{
|
||||
if (architecture == TargetArchitecture.AnyCPU)
|
||||
architecture = hostArchitecture;
|
||||
var toolsets = GetToolsets();
|
||||
var vcToolChainDir = toolsets[toolset];
|
||||
|
||||
@@ -429,86 +433,44 @@ namespace Flax.Build.Platforms
|
||||
{
|
||||
case WindowsPlatformToolset.v140:
|
||||
{
|
||||
string compilerPath = Path.Combine(vcToolChainDir, "bin", "cl.exe");
|
||||
if (File.Exists(compilerPath))
|
||||
if (hostArchitecture != TargetArchitecture.x86)
|
||||
{
|
||||
return Path.GetDirectoryName(compilerPath);
|
||||
}
|
||||
string nativeCompilerPath = Path.Combine(vcToolChainDir, "bin", "amd64", "cl.exe");
|
||||
if (File.Exists(nativeCompilerPath))
|
||||
return Path.GetDirectoryName(nativeCompilerPath);
|
||||
|
||||
throw new Exception(string.Format("No 32-bit compiler toolchain found in {0}", compilerPath));
|
||||
string crossCompilerPath = Path.Combine(vcToolChainDir, "bin", "x86_amd64", "cl.exe");
|
||||
if (File.Exists(crossCompilerPath))
|
||||
return Path.GetDirectoryName(crossCompilerPath);
|
||||
|
||||
Log.Verbose(string.Format("No {0} host compiler toolchain found in {1} or {2}", hostArchitecture.ToString(), nativeCompilerPath, crossCompilerPath));
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
string compilerPath = Path.Combine(vcToolChainDir, "bin", "cl.exe");
|
||||
if (File.Exists(compilerPath))
|
||||
return Path.GetDirectoryName(compilerPath);
|
||||
Log.Verbose(string.Format("No {0} host compiler toolchain found in {1}", hostArchitecture.ToString()));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
case WindowsPlatformToolset.v141:
|
||||
case WindowsPlatformToolset.v142:
|
||||
case WindowsPlatformToolset.v143:
|
||||
case WindowsPlatformToolset.v144:
|
||||
{
|
||||
/*
|
||||
string crossCompilerPath = Path.Combine(vcToolChainDir, "bin", "HostX64", "x86", "cl.exe");
|
||||
if (File.Exists(crossCompilerPath))
|
||||
{
|
||||
return Path.GetDirectoryName(crossCompilerPath);
|
||||
}
|
||||
*/
|
||||
|
||||
string nativeCompilerPath = Path.Combine(vcToolChainDir, "bin", "HostX86", "x86", "cl.exe");
|
||||
string hostFolder = hostArchitecture == TargetArchitecture.x86 ? "HostX86" : $"Host{hostArchitecture.ToString().ToLower()}";
|
||||
string nativeCompilerPath = Path.Combine(vcToolChainDir, "bin", hostFolder, architecture.ToString().ToLower(), "cl.exe");
|
||||
if (File.Exists(nativeCompilerPath))
|
||||
{
|
||||
return Path.GetDirectoryName(nativeCompilerPath);
|
||||
}
|
||||
|
||||
//throw new Exception(string.Format("No 32-bit compiler toolchain found in {0} or {1}", crossCompilerPath, nativeCompilerPath));
|
||||
throw new Exception(string.Format("No 32-bit compiler toolchain found in {0}", nativeCompilerPath));
|
||||
}
|
||||
default: throw new ArgumentOutOfRangeException(nameof(toolset), toolset, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path to the 64-bit tool binaries.
|
||||
/// </summary>
|
||||
/// <param name="toolset">The version of the toolset to use.</param>
|
||||
/// <returns>The directory containing the 64-bit toolchain binaries.</returns>
|
||||
public static string GetVCToolPath64(WindowsPlatformToolset toolset)
|
||||
{
|
||||
var toolsets = GetToolsets();
|
||||
var vcToolChainDir = toolsets[toolset];
|
||||
|
||||
switch (toolset)
|
||||
{
|
||||
case WindowsPlatformToolset.v140:
|
||||
{
|
||||
string nativeCompilerPath = Path.Combine(vcToolChainDir, "bin", "amd64", "cl.exe");
|
||||
if (File.Exists(nativeCompilerPath))
|
||||
{
|
||||
return Path.GetDirectoryName(nativeCompilerPath);
|
||||
}
|
||||
|
||||
string crossCompilerPath = Path.Combine(vcToolChainDir, "bin", "x86_amd64", "cl.exe");
|
||||
string crossCompilerPath = Path.Combine(vcToolChainDir, "bin", hostFolder, architecture.ToString().ToLower(), "cl.exe");
|
||||
if (File.Exists(crossCompilerPath))
|
||||
{
|
||||
return Path.GetDirectoryName(crossCompilerPath);
|
||||
}
|
||||
|
||||
throw new Exception(string.Format("No 64-bit compiler toolchain found in {0} or {1}", nativeCompilerPath, crossCompilerPath));
|
||||
}
|
||||
case WindowsPlatformToolset.v141:
|
||||
case WindowsPlatformToolset.v142:
|
||||
case WindowsPlatformToolset.v143:
|
||||
case WindowsPlatformToolset.v144:
|
||||
{
|
||||
string nativeCompilerPath = Path.Combine(vcToolChainDir, "bin", "HostX64", "x64", "cl.exe");
|
||||
if (File.Exists(nativeCompilerPath))
|
||||
{
|
||||
return Path.GetDirectoryName(nativeCompilerPath);
|
||||
}
|
||||
|
||||
string crossCompilerPath = Path.Combine(vcToolChainDir, "bin", "HostX86", "x64", "cl.exe");
|
||||
if (File.Exists(crossCompilerPath))
|
||||
{
|
||||
return Path.GetDirectoryName(crossCompilerPath);
|
||||
}
|
||||
|
||||
throw new Exception(string.Format("No 64-bit compiler toolchain found in {0} or {1}", nativeCompilerPath, crossCompilerPath));
|
||||
Log.Verbose(string.Format("No {0} host compiler toolchain found in {1} or {2}", hostArchitecture.ToString(), nativeCompilerPath, crossCompilerPath));
|
||||
return null;
|
||||
}
|
||||
default: throw new ArgumentOutOfRangeException(nameof(toolset), toolset, null);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,12 @@ namespace Flax.Build.Platforms
|
||||
options.LinkEnv.InputLibraries.Add("ole32.lib");
|
||||
options.LinkEnv.InputLibraries.Add("oleaut32.lib");
|
||||
options.LinkEnv.InputLibraries.Add("delayimp.lib");
|
||||
|
||||
if (options.Architecture == TargetArchitecture.ARM64)
|
||||
{
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("USE_SOFT_INTRINSICS");
|
||||
options.LinkEnv.InputLibraries.Add("softintrin.lib");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using Flax.Build.Graph;
|
||||
@@ -133,16 +134,14 @@ namespace Flax.Build.Platforms
|
||||
throw new Exception(string.Format("Missing SDK {0} for platform Windows", SDK));
|
||||
|
||||
// Get the tools paths
|
||||
string vcToolPath;
|
||||
if (Architecture == TargetArchitecture.x64)
|
||||
vcToolPath = WindowsPlatformBase.GetVCToolPath64(Toolset);
|
||||
else
|
||||
vcToolPath = WindowsPlatformBase.GetVCToolPath32(Toolset);
|
||||
_vcToolPath = vcToolPath;
|
||||
_compilerPath = Path.Combine(vcToolPath, "cl.exe");
|
||||
_linkerPath = Path.Combine(vcToolPath, "link.exe");
|
||||
_libToolPath = Path.Combine(vcToolPath, "lib.exe");
|
||||
_xdcmakePath = Path.Combine(vcToolPath, "xdcmake.exe");
|
||||
var hostArchitecture = Platform.BuildTargetArchitecture;
|
||||
_vcToolPath = WindowsPlatformBase.GetVCToolPath(Toolset, hostArchitecture, Architecture);
|
||||
if (string.IsNullOrEmpty(_vcToolPath))
|
||||
throw new Exception(string.Format("No {0} host compiler tools found for target architecture {1}", hostArchitecture, Architecture));
|
||||
_compilerPath = Path.Combine(_vcToolPath, "cl.exe");
|
||||
_linkerPath = Path.Combine(_vcToolPath, "link.exe");
|
||||
_libToolPath = Path.Combine(_vcToolPath, "lib.exe");
|
||||
_xdcmakePath = Path.Combine(_vcToolPath, "xdcmake.exe");
|
||||
|
||||
// Add Visual C++ toolset include and library paths
|
||||
var vcToolChainDir = toolsets[Toolset];
|
||||
@@ -166,7 +165,7 @@ namespace Flax.Build.Platforms
|
||||
case TargetArchitecture.x64:
|
||||
SystemLibraryPaths.Add(Path.Combine(vcToolChainDir, "lib", "amd64"));
|
||||
break;
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
default: throw new InvalidArchitectureException(Architecture);
|
||||
}
|
||||
|
||||
// When using Visual Studio 2015 toolset and using pre-Windows 10 SDK, find a Windows 10 SDK and add the UCRT include paths
|
||||
@@ -198,7 +197,7 @@ namespace Flax.Build.Platforms
|
||||
case TargetArchitecture.x64:
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "ucrt", "x64"));
|
||||
break;
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
default: throw new InvalidArchitectureException(Architecture);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -223,7 +222,7 @@ namespace Flax.Build.Platforms
|
||||
case TargetArchitecture.x64:
|
||||
SystemLibraryPaths.Add(Path.Combine(vcToolChainDir, "lib", "x64"));
|
||||
break;
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
default: throw new InvalidArchitectureException(Architecture);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -274,7 +273,7 @@ namespace Flax.Build.Platforms
|
||||
_makepriPath = Path.Combine(binRootDir, "makepri.exe");
|
||||
break;
|
||||
}
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
default: throw new InvalidArchitectureException(Architecture);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -313,13 +312,16 @@ namespace Flax.Build.Platforms
|
||||
{
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "ucrt", "arm64"));
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "um", "arm64"));
|
||||
var binRootDir = Path.Combine(windowsSdkDir, "bin", sdkVersionName, hostArchitecture.ToString().ToLower());
|
||||
_resourceCompilerPath = Path.Combine(binRootDir, "rc.exe");
|
||||
_makepriPath = Path.Combine(binRootDir, "makepri.exe");
|
||||
break;
|
||||
}
|
||||
case TargetArchitecture.x86:
|
||||
{
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "ucrt", "x86"));
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "um", "x86"));
|
||||
var binRootDir = Path.Combine(windowsSdkDir, "bin", sdkVersionName, "x86");
|
||||
var binRootDir = Path.Combine(windowsSdkDir, "bin", sdkVersionName, hostArchitecture.ToString().ToLower());
|
||||
_resourceCompilerPath = Path.Combine(binRootDir, "rc.exe");
|
||||
_makepriPath = Path.Combine(binRootDir, "makepri.exe");
|
||||
break;
|
||||
@@ -328,12 +330,12 @@ namespace Flax.Build.Platforms
|
||||
{
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "ucrt", "x64"));
|
||||
SystemLibraryPaths.Add(Path.Combine(libraryRootDir, "um", "x64"));
|
||||
var binRootDir = Path.Combine(windowsSdkDir, "bin", sdkVersionName, "x64");
|
||||
var binRootDir = Path.Combine(windowsSdkDir, "bin", sdkVersionName, hostArchitecture.ToString().ToLower());
|
||||
_resourceCompilerPath = Path.Combine(binRootDir, "rc.exe");
|
||||
_makepriPath = Path.Combine(binRootDir, "makepri.exe");
|
||||
break;
|
||||
}
|
||||
default: throw new InvalidArchitectureException(architecture);
|
||||
default: throw new InvalidArchitectureException(Architecture);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -406,7 +408,7 @@ namespace Flax.Build.Platforms
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_CRT_SECURE_NO_DEPRECATE");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_CRT_SECURE_NO_WARNINGS");
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("_WINDOWS");
|
||||
if (Architecture == TargetArchitecture.x64)
|
||||
if (Architecture == TargetArchitecture.x64 || Architecture == TargetArchitecture.ARM64)
|
||||
options.CompileEnv.PreprocessorDefinitions.Add("WIN64");
|
||||
}
|
||||
|
||||
@@ -794,9 +796,11 @@ namespace Flax.Build.Platforms
|
||||
args.Add("/MACHINE:x64");
|
||||
break;
|
||||
case TargetArchitecture.ARM:
|
||||
case TargetArchitecture.ARM64:
|
||||
args.Add("/MACHINE:ARM");
|
||||
break;
|
||||
case TargetArchitecture.ARM64:
|
||||
args.Add("/MACHINE:ARM64");
|
||||
break;
|
||||
default: throw new InvalidArchitectureException(Architecture);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,6 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
csProjectFileContent.AppendLine("");
|
||||
|
||||
// Files and folders
|
||||
|
||||
csProjectFileContent.AppendLine(" <ItemGroup>");
|
||||
|
||||
var files = new List<string>();
|
||||
@@ -214,24 +213,41 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
else
|
||||
csProjectFileContent.AppendLine(string.Format(" <{0} Include=\"{1}\" />", fileType, projectPath));
|
||||
}
|
||||
csProjectFileContent.AppendLine(" </ItemGroup>");
|
||||
|
||||
if (project.GeneratedSourceFiles != null)
|
||||
{
|
||||
foreach (var file in project.GeneratedSourceFiles)
|
||||
foreach (var group in project.GeneratedSourceFiles.GroupBy(x => GetGroupingFromPath(x), y => y))
|
||||
{
|
||||
string fileType;
|
||||
if (file.EndsWith(".cs", StringComparison.OrdinalIgnoreCase))
|
||||
fileType = "Compile";
|
||||
else
|
||||
fileType = "None";
|
||||
(string targetName, string platform, string arch, string configuration) = group.Key;
|
||||
|
||||
var filePath = file.Replace('/', '\\');
|
||||
csProjectFileContent.AppendLine(string.Format(" <{0} Visible=\"false\" Include=\"{1}\" />", fileType, filePath));
|
||||
var targetConfiguration = project.Targets.First(x => x.Name == targetName).ConfigurationName;
|
||||
csProjectFileContent.AppendLine($" <ItemGroup Condition=\" '$(Configuration)|$(Platform)' == '{targetConfiguration}.{platform}.{configuration}|{arch}' \" >");
|
||||
|
||||
foreach (var file in group)
|
||||
{
|
||||
string fileType;
|
||||
if (file.EndsWith(".cs", StringComparison.OrdinalIgnoreCase))
|
||||
fileType = "Compile";
|
||||
else
|
||||
fileType = "None";
|
||||
|
||||
var filePath = file.Replace('/', '\\');
|
||||
csProjectFileContent.AppendLine(string.Format(" <{0} Visible=\"false\" Include=\"{1}\" />", fileType, filePath));
|
||||
}
|
||||
|
||||
csProjectFileContent.AppendLine(" </ItemGroup>");
|
||||
}
|
||||
|
||||
(string target, string platform, string arch, string configuration) GetGroupingFromPath(string path)
|
||||
{
|
||||
ReadOnlySpan<char> span = path.AsSpan();
|
||||
Span<Range> split = stackalloc Range[path.Count((c) => c == '/' || c == '\\')];
|
||||
var _ = MemoryExtensions.SplitAny(path, split, [ '/', '\\' ]);
|
||||
return (span[split[^5]].ToString(), span[split[^4]].ToString(), span[split[^3]].ToString(), span[split[^2]].ToString());
|
||||
}
|
||||
}
|
||||
|
||||
csProjectFileContent.AppendLine(" </ItemGroup>");
|
||||
|
||||
// End
|
||||
|
||||
csProjectFileContent.AppendLine("</Project>");
|
||||
|
||||
@@ -199,6 +199,26 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
if (includePaths.Count != 0)
|
||||
vcProjectFileContent.AppendLine(string.Format(" <NMakeIncludeSearchPath>$(NMakeIncludeSearchPath);{0}</NMakeIncludeSearchPath>", string.Join(";", includePaths)));
|
||||
|
||||
var additionalOptions = new List<string>();
|
||||
additionalOptions.Add("$(AdditionalOptions)");
|
||||
switch (configuration.TargetBuildOptions.CompileEnv.CppVersion)
|
||||
{
|
||||
case CppVersion.Cpp14:
|
||||
additionalOptions.Add("/std:c++14");
|
||||
break;
|
||||
case CppVersion.Cpp17:
|
||||
additionalOptions.Add("/std:c++17");
|
||||
break;
|
||||
case CppVersion.Cpp20:
|
||||
additionalOptions.Add("/std:c++20");
|
||||
break;
|
||||
case CppVersion.Latest:
|
||||
additionalOptions.Add("/std:c++latest");
|
||||
break;
|
||||
}
|
||||
|
||||
vcProjectFileContent.AppendLine(string.Format(" <AdditionalOptions>{0}</AdditionalOptions>", string.Join(" ", additionalOptions)));
|
||||
|
||||
vcProjectFileContent.AppendLine(" </PropertyGroup>");
|
||||
}
|
||||
|
||||
@@ -326,34 +346,18 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
vcProjectFileContent.AppendLine(" </ItemGroup>");
|
||||
vcFiltersFileContent.AppendLine(" </ItemGroup>");
|
||||
|
||||
// IntelliSense information
|
||||
|
||||
var additionalOptions = new List<string>();
|
||||
switch (project.Configurations[0].TargetBuildOptions.CompileEnv.CppVersion)
|
||||
{
|
||||
case CppVersion.Cpp14:
|
||||
additionalOptions.Add("/std:c++14");
|
||||
break;
|
||||
case CppVersion.Cpp17:
|
||||
additionalOptions.Add("/std:c++17");
|
||||
break;
|
||||
case CppVersion.Cpp20:
|
||||
additionalOptions.Add("/std:c++20");
|
||||
break;
|
||||
case CppVersion.Latest:
|
||||
additionalOptions.Add("/std:c++latest");
|
||||
break;
|
||||
// IntelliSense information
|
||||
vcProjectFileContent.AppendLine(" <PropertyGroup>");
|
||||
vcProjectFileContent.AppendLine(string.Format(" <NMakePreprocessorDefinitions>$(NMakePreprocessorDefinitions){0}</NMakePreprocessorDefinitions>", (project.Defines.Count > 0 ? (";" + string.Join(";", project.Defines)) : "")));
|
||||
vcProjectFileContent.AppendLine(string.Format(" <NMakeIncludeSearchPath>$(NMakeIncludeSearchPath){0}</NMakeIncludeSearchPath>", (project.SearchPaths.Length > 0 ? (";" + string.Join(";", project.SearchPaths)) : "")));
|
||||
vcProjectFileContent.AppendLine(" <NMakeForcedIncludes>$(NMakeForcedIncludes)</NMakeForcedIncludes>");
|
||||
vcProjectFileContent.AppendLine(" <NMakeAssemblySearchPath>$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>");
|
||||
vcProjectFileContent.AppendLine(" <NMakeForcedUsingAssemblies>$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>");
|
||||
vcProjectFileContent.AppendLine(" <AdditionalOptions>$(AdditionalOptions)</AdditionalOptions>");
|
||||
vcProjectFileContent.AppendLine(" </PropertyGroup>");
|
||||
}
|
||||
|
||||
vcProjectFileContent.AppendLine(" <PropertyGroup>");
|
||||
vcProjectFileContent.AppendLine(string.Format(" <NMakePreprocessorDefinitions>$(NMakePreprocessorDefinitions){0}</NMakePreprocessorDefinitions>", (project.Defines.Count > 0 ? (";" + string.Join(";", project.Defines)) : "")));
|
||||
vcProjectFileContent.AppendLine(string.Format(" <NMakeIncludeSearchPath>$(NMakeIncludeSearchPath){0}</NMakeIncludeSearchPath>", (project.SearchPaths.Length > 0 ? (";" + string.Join(";", project.SearchPaths)) : "")));
|
||||
vcProjectFileContent.AppendLine(" <NMakeForcedIncludes>$(NMakeForcedIncludes)</NMakeForcedIncludes>");
|
||||
vcProjectFileContent.AppendLine(" <NMakeAssemblySearchPath>$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>");
|
||||
vcProjectFileContent.AppendLine(" <NMakeForcedUsingAssemblies>$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>");
|
||||
vcProjectFileContent.AppendLine(string.Format(" <AdditionalOptions>{0}</AdditionalOptions>", string.Join(" ", additionalOptions)));
|
||||
vcProjectFileContent.AppendLine(" </PropertyGroup>");
|
||||
|
||||
foreach (var platform in platforms)
|
||||
{
|
||||
if (platform is IVisualStudioProjectCustomizer customizer)
|
||||
|
||||
@@ -434,6 +434,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
|
||||
// Collect all unique configurations
|
||||
var configurations = new HashSet<SolutionConfiguration>();
|
||||
var mainArchitectures = solution.MainProject.Targets.SelectMany(x => x.Architectures).Distinct().ToArray();
|
||||
foreach (var project in projects)
|
||||
{
|
||||
if (project.Configurations == null || project.Configurations.Count == 0)
|
||||
@@ -445,6 +446,10 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
|
||||
foreach (var configuration in project.Configurations)
|
||||
{
|
||||
// Skip architectures which are not included in the game project
|
||||
if (!mainArchitectures.Contains(configuration.Architecture))
|
||||
continue;
|
||||
|
||||
configurations.Add(new SolutionConfiguration(configuration));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user