Edited build.zig
This commit is contained in:
parent
e4d253fdfa
commit
64bb7e839f
1 changed files with 16 additions and 12 deletions
28
build.zig
28
build.zig
|
|
@ -48,15 +48,9 @@ pub fn build(b: *Build) !void {
|
||||||
|
|
||||||
try cppflags.appendSlice(base_flags);
|
try cppflags.appendSlice(base_flags);
|
||||||
|
|
||||||
// ------------------
|
|
||||||
// SPIRV-Tools
|
|
||||||
// ------------------
|
|
||||||
|
|
||||||
generateHeaders(b.allocator);
|
|
||||||
|
|
||||||
_ = std.fs.openDirAbsolute(sdkPath("/External/spirv-tools"), .{}) catch |err| {
|
_ = std.fs.openDirAbsolute(sdkPath("/External/spirv-tools"), .{}) catch |err| {
|
||||||
if (err == error.FileNotFound) {
|
if (err == error.FileNotFound) {
|
||||||
log.err("SPIRV-Tools build directory was not found - ensure sources have been cloned with `./update_glslang_sources.py --site zig`/.", .{});
|
log.err("SPIRV-Tools build directory was not found - ensure sources have been cloned with `./update_glslang_sources.py --site zig`.", .{});
|
||||||
}
|
}
|
||||||
|
|
||||||
std.process.exit(1);
|
std.process.exit(1);
|
||||||
|
|
@ -95,6 +89,8 @@ pub fn build(b: *Build) !void {
|
||||||
|
|
||||||
var glslang_lib: *std.Build.Step.Compile = undefined;
|
var glslang_lib: *std.Build.Step.Compile = undefined;
|
||||||
|
|
||||||
|
generateHeaders(b.allocator);
|
||||||
|
|
||||||
if (shared) {
|
if (shared) {
|
||||||
glslang_lib = b.addSharedLibrary(.{
|
glslang_lib = b.addSharedLibrary(.{
|
||||||
.name = "glslang",
|
.name = "glslang",
|
||||||
|
|
@ -103,6 +99,8 @@ pub fn build(b: *Build) !void {
|
||||||
.target = target,
|
.target = target,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
glslang_lib.rdynamic = true;
|
||||||
|
|
||||||
glslang_lib.defineCMacro("GLSLANG_IS_SHARED_LIBRARY", "");
|
glslang_lib.defineCMacro("GLSLANG_IS_SHARED_LIBRARY", "");
|
||||||
glslang_lib.defineCMacro("GLSLANG_EXPORTING", "");
|
glslang_lib.defineCMacro("GLSLANG_EXPORTING", "");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -119,6 +117,12 @@ pub fn build(b: *Build) !void {
|
||||||
.flags = cppflags.items,
|
.flags = cppflags.items,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
glslang_lib.linkLibrary(tools_lib);
|
||||||
|
addIncludes(b, glslang_lib);
|
||||||
|
|
||||||
|
glslang_lib.linkLibCpp();
|
||||||
|
|
||||||
|
// OS-specific headers
|
||||||
if (tag == .windows) {
|
if (tag == .windows) {
|
||||||
glslang_lib.addCSourceFiles(.{
|
glslang_lib.addCSourceFiles(.{
|
||||||
.files = &sources_win,
|
.files = &sources_win,
|
||||||
|
|
@ -135,6 +139,8 @@ pub fn build(b: *Build) !void {
|
||||||
glslang_lib.defineCMacro("GLSLANG_OSINCLUDE_UNIX", "");
|
glslang_lib.defineCMacro("GLSLANG_OSINCLUDE_UNIX", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Add HLSL sources
|
||||||
if (enable_hlsl) {
|
if (enable_hlsl) {
|
||||||
glslang_lib.addCSourceFiles(.{
|
glslang_lib.addCSourceFiles(.{
|
||||||
.files = &sources_hlsl,
|
.files = &sources_hlsl,
|
||||||
|
|
@ -146,8 +152,8 @@ pub fn build(b: *Build) !void {
|
||||||
glslang_lib.defineCMacro("ENABLE_HLSL", "0");
|
glslang_lib.defineCMacro("ENABLE_HLSL", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
glslang_lib.linkLibrary(tools_lib);
|
|
||||||
|
|
||||||
|
// Add SPIRV-Tools-opt sources
|
||||||
if (enable_opt) {
|
if (enable_opt) {
|
||||||
glslang_lib.addCSourceFiles(.{
|
glslang_lib.addCSourceFiles(.{
|
||||||
.files = &sources_opt,
|
.files = &sources_opt,
|
||||||
|
|
@ -163,15 +169,12 @@ pub fn build(b: *Build) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addIncludes(b, glslang_lib);
|
|
||||||
|
|
||||||
glslang_lib.linkLibCpp();
|
|
||||||
|
|
||||||
const build_step = b.step("glslang-library", "Build the glslang library");
|
const build_step = b.step("glslang-library", "Build the glslang library");
|
||||||
build_step.dependOn(&b.addInstallArtifact(glslang_lib, .{}).step);
|
build_step.dependOn(&b.addInstallArtifact(glslang_lib, .{}).step);
|
||||||
|
|
||||||
b.installArtifact(glslang_lib);
|
b.installArtifact(glslang_lib);
|
||||||
|
|
||||||
|
|
||||||
if (standalone_glslang) {
|
if (standalone_glslang) {
|
||||||
const glslang_exe = b.addExecutable(.{
|
const glslang_exe = b.addExecutable(.{
|
||||||
.name = "glslang",
|
.name = "glslang",
|
||||||
|
|
@ -210,6 +213,7 @@ pub fn build(b: *Build) !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (standalone_spvremap) {
|
if (standalone_spvremap) {
|
||||||
const spirv_remap = b.addExecutable(.{
|
const spirv_remap = b.addExecutable(.{
|
||||||
.name = "spirv-remap",
|
.name = "spirv-remap",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue