fixing build
This commit is contained in:
13
build.zig
13
build.zig
@@ -4,16 +4,18 @@ const Step = std.Build.Step;
|
||||
const ImplementationDesc = struct {
|
||||
name: []const u8,
|
||||
root_source_file: []const u8,
|
||||
custom: ?*const fn (*std.Build, *std.Build.Module) anyerror!void = null,
|
||||
};
|
||||
|
||||
const implementations = [_]ImplementationDesc{
|
||||
.{
|
||||
.name = "soft",
|
||||
.root_source_file = "src/soft/lib.zig",
|
||||
.custom = customSoft,
|
||||
},
|
||||
};
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
@@ -47,6 +49,10 @@ pub fn build(b: *std.Build) void {
|
||||
|
||||
lib_mod.addSystemIncludePath(vulkan_headers.path("include"));
|
||||
|
||||
if (impl.custom) |custom| {
|
||||
try custom(b, lib_mod);
|
||||
}
|
||||
|
||||
const lib = b.addLibrary(.{
|
||||
.name = b.fmt("vulkan_{s}", .{impl.name}),
|
||||
.root_module = lib_mod,
|
||||
@@ -82,3 +88,8 @@ pub fn build(b: *std.Build) void {
|
||||
test_c_step.dependOn(&run_c_test.step);
|
||||
}
|
||||
}
|
||||
|
||||
fn customSoft(b: *std.Build, mod: *std.Build.Module) !void {
|
||||
const cpuinfo = b.lazyDependency("cpuinfo", .{}) orelse return error.UnresolvedDependency;
|
||||
mod.addImport("cpuinfo", cpuinfo.module("cpuinfo"));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
.url = "git+https://github.com/catmeow72/vulkan-zig/#8961518db28f88d2cf09ea68e146923de2cfa7f0",
|
||||
.hash = "vulkan-0.0.0-r7Ytx6hBAwD8X_TN32qlkzul4riK6vFvjtK9fZfRvALg",
|
||||
},
|
||||
.cpuinfo = .{
|
||||
.url = "git+https://github.com/Kbz-8/cpuinfo-zig#77f82a1248194e7fb706967343c66021f8522766",
|
||||
.hash = "cpuinfo-0.1.0-V7dMLcghAADJuG7dkd3MnwDPZ232pBK_8uGjxY43eP5u",
|
||||
.lazy = true,
|
||||
},
|
||||
},
|
||||
|
||||
.paths = .{
|
||||
|
||||
@@ -2,6 +2,7 @@ const std = @import("std");
|
||||
const vk = @import("vulkan");
|
||||
const Instance = @import("Instance.zig");
|
||||
const common = @import("common");
|
||||
const root = @import("root");
|
||||
|
||||
const dispatchable = common.dispatchable;
|
||||
|
||||
@@ -13,10 +14,10 @@ common_physical_device: common.PhysicalDevice,
|
||||
|
||||
pub fn init(self: *Self) !void {
|
||||
self.common_physical_device.props = .{
|
||||
.api_version = @bitCast(common.DRIVER_VULKAN_VERSION),
|
||||
.driver_version = @bitCast(common.DRIVER_VERSION),
|
||||
.vendor_id = 0x0601,
|
||||
.device_id = 0x060103,
|
||||
.api_version = @bitCast(root.VULKAN_VERSION),
|
||||
.driver_version = @bitCast(root.DRIVER_VERSION),
|
||||
.vendor_id = common.VULKAN_VENDOR_ID,
|
||||
.device_id = root.DEVICE_ID,
|
||||
.device_type = .cpu,
|
||||
.device_name = [_]u8{0} ** vk.MAX_PHYSICAL_DEVICE_NAME_SIZE,
|
||||
.pipeline_cache_uuid = undefined,
|
||||
|
||||
@@ -4,6 +4,10 @@ const common = @import("common");
|
||||
|
||||
const Instance = @import("Instance.zig");
|
||||
|
||||
pub const VULKAN_VERSION = vk.makeApiVersion(0, 1, 0, 0);
|
||||
pub const DRIVER_VERSION = vk.makeApiVersion(0, 0, 0, 1);
|
||||
pub const DEVICE_ID = 0x600DCAFE;
|
||||
|
||||
const global_pfn_map = std.StaticStringMap(vk.PfnVoidFunction).initComptime(.{
|
||||
.{ "vkGetInstanceProcAddr", @as(vk.PfnVoidFunction, @ptrCast(&common.icd.getInstanceProcAddr)) },
|
||||
.{ "vkCreateInstance", @as(vk.PfnVoidFunction, @ptrCast(&Instance.create)) },
|
||||
|
||||
@@ -7,8 +7,7 @@ pub const dispatchable = @import("dispatchable.zig");
|
||||
pub const Instance = @import("Instance.zig");
|
||||
pub const PhysicalDevice = @import("PhysicalDevice.zig");
|
||||
|
||||
pub const DRIVER_VERSION = vk.makeApiVersion(0, 0, 0, 1);
|
||||
pub const DRIVER_VULKAN_VERSION = vk.makeApiVersion(0, 1, 0, 0);
|
||||
pub const VULKAN_VENDOR_ID = @typeInfo(vk.VendorId).@"enum".fields[@typeInfo(vk.VendorId).@"enum".fields.len - 1].value + 1;
|
||||
|
||||
pub const std_options: std.Options = .{
|
||||
.log_level = .info,
|
||||
|
||||
Reference in New Issue
Block a user