Add glslang for Linux

This commit is contained in:
2021-01-10 19:57:01 +01:00
parent 09720ee758
commit 8d7d2431df
12 changed files with 84 additions and 14 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+7
View File
@@ -36,6 +36,13 @@ public class glslang : DepsModule
options.OutputFiles.Add(Path.Combine(depsRoot, "SPIRV.lib"));
break;
case TargetPlatform.Linux:
options.OutputFiles.Add(Path.Combine(depsRoot, "libGenericCodeGen.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libglslang.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libHLSL.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libMachineIndependent.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libOSDependent.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libOGLCompiler.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libSPIRV.a"));
break;
default: throw new InvalidPlatformException(options.Platform.Target);
}
+2
View File
@@ -32,6 +32,8 @@ public class spirv_tools : DepsModule
options.OutputFiles.Add(Path.Combine(depsRoot, "SPIRV-Tools-opt.lib"));
break;
case TargetPlatform.Linux:
options.OutputFiles.Add(Path.Combine(depsRoot, "libSPIRV-Tools.a"));
options.OutputFiles.Add(Path.Combine(depsRoot, "libSPIRV-Tools-opt.a"));
break;
default: throw new InvalidPlatformException(options.Platform.Target);
}
@@ -21,7 +21,12 @@ namespace Flax.Deps.Dependencies
case TargetPlatform.Windows:
return new[]
{
TargetPlatform.Windows,
TargetPlatform.Linux,
};
case TargetPlatform.Linux:
return new[]
{
TargetPlatform.Linux,
};
default: return new TargetPlatform[0];
}
@@ -36,20 +41,8 @@ namespace Flax.Deps.Dependencies
var buildDir = root;
var solutionPath = Path.Combine(buildDir, "glslang.sln");
var configuration = "Release";
var cmakeArgs = string.Format("-DCMAKE_INSTALL_PREFIX=\"{0}\" -DENABLE_CTEST=OFF -DENABLE_HLSL=ON -DENABLE_SPVREMAPPER=ON -DENABLE_GLSLANG_BINARIES=OFF", installDir);
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");
var outputFiles = new[]
{
Path.Combine(libsRoot, "GenericCodeGen.lib"),
Path.Combine(libsRoot, "MachineIndependent.lib"),
Path.Combine(libsRoot, "HLSL.lib"),
Path.Combine(libsRoot, "OSDependent.lib"),
Path.Combine(libsRoot, "OGLCompiler.lib"),
Path.Combine(libsRoot, "SPIRV-Tools-opt.lib"),
Path.Combine(libsRoot, "SPIRV-Tools.lib"),
Path.Combine(libsRoot, "SPIRV.lib"),
Path.Combine(libsRoot, "glslang.lib"),
};
// Get the source
CloneGitRepoFast(root, "https://github.com/FlaxEngine/glslang.git");
@@ -63,6 +56,19 @@ namespace Flax.Deps.Dependencies
{
case TargetPlatform.Windows:
{
var outputFiles = new[]
{
Path.Combine(libsRoot, "GenericCodeGen.lib"),
Path.Combine(libsRoot, "MachineIndependent.lib"),
Path.Combine(libsRoot, "HLSL.lib"),
Path.Combine(libsRoot, "OSDependent.lib"),
Path.Combine(libsRoot, "OGLCompiler.lib"),
Path.Combine(libsRoot, "SPIRV-Tools-opt.lib"),
Path.Combine(libsRoot, "SPIRV-Tools.lib"),
Path.Combine(libsRoot, "SPIRV.lib"),
Path.Combine(libsRoot, "glslang.lib"),
};
// Build for Win64
File.Delete(Path.Combine(buildDir, "CMakeCache.txt"));
RunCmake(buildDir, TargetPlatform.Windows, TargetArchitecture.x64, cmakeArgs);
@@ -75,6 +81,34 @@ namespace Flax.Deps.Dependencies
}
break;
}
case TargetPlatform.Linux:
{
var outputFiles = new[]
{
Path.Combine(libsRoot, "libGenericCodeGen.a"),
Path.Combine(libsRoot, "libMachineIndependent.a"),
Path.Combine(libsRoot, "libHLSL.a"),
Path.Combine(libsRoot, "libOSDependent.a"),
Path.Combine(libsRoot, "libOGLCompiler.a"),
Path.Combine(libsRoot, "libSPIRV-Tools-opt.a"),
Path.Combine(libsRoot, "libSPIRV-Tools.a"),
Path.Combine(libsRoot, "libSPIRV.a"),
Path.Combine(libsRoot, "libglslang.a"),
};
// Build for Linux
RunCmake(root, TargetPlatform.Linux, TargetArchitecture.x64, cmakeArgs);
Utilities.Run("cmake", string.Format("--build . --config {0} --target install", configuration), null, buildDir, Utilities.RunOptions.None);
Utilities.Run("make", null, null, root, Utilities.RunOptions.None);
var depsFolder = GetThirdPartyFolder(options, TargetPlatform.Linux, TargetArchitecture.x64);
foreach (var file in outputFiles)
{
var dst = Path.Combine(depsFolder, Path.GetFileName(file));
Utilities.FileCopy(file, dst);
//Utilities.Run("strip", string.Format("-s \"{0}\"", dst), null, null, Utilities.RunOptions.None);
}
break;
}
}
}