Compile glslang for Windows on ARM

This commit is contained in:
2024-05-11 18:58:25 +03:00
parent 2226ff32dc
commit ca40e6140a
2 changed files with 18 additions and 14 deletions

View File

@@ -1,3 +0,0 @@
// This header is generated by the make-revision script.
#define GLSLANG_PATCH_LEVEL 3559

View File

@@ -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 })