Added dissasembler and extra options

This commit is contained in:
Kai Angulo 2024-06-03 01:52:25 -07:00
parent a49840f365
commit 812c09ec9b
3 changed files with 41 additions and 2 deletions

View file

@ -26,17 +26,28 @@ pub fn build(b: *Build) !void {
const standalone_glslang = b.option(bool, "standalone", "Build glslang.exe standalone command-line compiler.") orelse false;
const standalone_spvremap = b.option(bool, "standalone-remap", "Build spirv-remap.exe standalone command-line remapper.") orelse false;
if (shared and (standalone_glslang or standalone_spvremap)) {
log.err("Cannot build standalone sources with shared glslang. Recompile without `-Dshared` or `-Dstandalone/-Dstandalone-remap`", .{});
std.process.exit(1);
}
const tools_libs: spvtools.SPVLibs = spvtools.buildSpirv(b, optimize, target, shared_tools, debug, spirv_header_name) catch |err| {
log.err("Error building SPIRV-Tools: {s}", .{ @errorName(err) });
std.process.exit(1);
};
const tag = target.result.os.tag;
var cppflags = std.ArrayList([]const u8).init(b.allocator);
if (!debug) {
try cppflags.append("-g0");
}
if (tag == .windows and shared) {
try cppflags.append("-rdynamic");
}
try cppflags.append("-std=c++17");
const base_flags = &.{
@ -94,8 +105,6 @@ pub fn build(b: *Build) !void {
.flags = cppflags.items,
});
const tag = target.result.os.tag;
if (tag == .windows) {
glslang_lib.addCSourceFiles(.{
.files = &sources_win,
@ -159,6 +168,10 @@ pub fn build(b: *Build) !void {
.target = target,
});
if (shared) {
glslang_exe.defineCMacro("GLSLANG_IS_SHARED_LIBRARY", "");
}
const install_glslang_step = b.step("glslang-standalone", "Build and install glslang.exe");
install_glslang_step.dependOn(&b.addInstallArtifact(glslang_exe, .{}).step);
glslang_exe.addCSourceFiles(.{
@ -197,6 +210,10 @@ pub fn build(b: *Build) !void {
.target = target,
});
if (shared) {
spirv_remap.defineCMacro("GLSLANG_IS_SHARED_LIBRARY", "");
}
const install_remap_step = b.step("spirv-remap", "Build and install spirv-remap.exe");
install_remap_step.dependOn(&b.addInstallArtifact(spirv_remap, .{}).step);
spirv_remap.addCSourceFiles(.{