Updates Zig
This commit is contained in:
parent
8ca5c953f1
commit
67e1f44f0f
3 changed files with 30 additions and 30 deletions
38
build.zig
38
build.zig
|
|
@ -33,12 +33,12 @@ pub fn build(b: *std.Build) void {
|
||||||
.optimize = optimize_external,
|
.optimize = optimize_external,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
dear_imgui_lib.addIncludePath(upstream.path(""));
|
dear_imgui_lib.root_module.addIncludePath(upstream.path(""));
|
||||||
dear_imgui_lib.addIncludePath(b.path("src/include"));
|
dear_imgui_lib.root_module.addIncludePath(b.path("src/include"));
|
||||||
dear_imgui_lib.installHeadersDirectory(b.path("src/include"), "", .{});
|
dear_imgui_lib.installHeadersDirectory(b.path("src/include"), "", .{});
|
||||||
dear_imgui_lib.installHeadersDirectory(upstream.path("."), "", .{});
|
dear_imgui_lib.installHeadersDirectory(upstream.path("."), "", .{});
|
||||||
dear_imgui_lib.linkLibC();
|
dear_imgui_lib.root_module.link_libc = true;
|
||||||
dear_imgui_lib.addCSourceFiles(.{
|
dear_imgui_lib.root_module.addCSourceFiles(.{
|
||||||
.root = upstream.path(""),
|
.root = upstream.path(""),
|
||||||
.files = &.{
|
.files = &.{
|
||||||
"imgui.cpp",
|
"imgui.cpp",
|
||||||
|
|
@ -49,7 +49,7 @@ pub fn build(b: *std.Build) void {
|
||||||
},
|
},
|
||||||
.flags = flags,
|
.flags = flags,
|
||||||
});
|
});
|
||||||
dear_imgui_lib.addCSourceFiles(.{
|
dear_imgui_lib.root_module.addCSourceFiles(.{
|
||||||
.root = b.path("src/cached"),
|
.root = b.path("src/cached"),
|
||||||
.files = &.{
|
.files = &.{
|
||||||
"dcimgui.cpp",
|
"dcimgui.cpp",
|
||||||
|
|
@ -67,14 +67,14 @@ pub fn build(b: *std.Build) void {
|
||||||
.optimize = optimize_external,
|
.optimize = optimize_external,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
dear_imgui_vulkan_lib.linkLibrary(dear_imgui_lib);
|
dear_imgui_vulkan_lib.root_module.linkLibrary(dear_imgui_lib);
|
||||||
dear_imgui_vulkan_lib.addCSourceFile(.{ .file = upstream.path("backends/imgui_impl_vulkan.cpp"), .flags = flags });
|
dear_imgui_vulkan_lib.root_module.addCSourceFile(.{ .file = upstream.path("backends/imgui_impl_vulkan.cpp"), .flags = flags });
|
||||||
dear_imgui_vulkan_lib.addCSourceFile(.{ .file = b.path("src/cached/dcimgui_impl_vulkan.cpp"), .flags = flags });
|
dear_imgui_vulkan_lib.root_module.addCSourceFile(.{ .file = b.path("src/cached/dcimgui_impl_vulkan.cpp"), .flags = flags });
|
||||||
dear_imgui_vulkan_lib.addIncludePath(b.path("src/include"));
|
dear_imgui_vulkan_lib.root_module.addIncludePath(b.path("src/include"));
|
||||||
dear_imgui_vulkan_lib.addIncludePath(upstream.path(""));
|
dear_imgui_vulkan_lib.root_module.addIncludePath(upstream.path(""));
|
||||||
dear_imgui_vulkan_lib.addIncludePath(upstream.path("backends"));
|
dear_imgui_vulkan_lib.root_module.addIncludePath(upstream.path("backends"));
|
||||||
const vulkan_headers = b.dependency("Vulkan-Headers", .{});
|
const vulkan_headers = b.dependency("Vulkan-Headers", .{});
|
||||||
dear_imgui_vulkan_lib.addIncludePath(vulkan_headers.path("include"));
|
dear_imgui_vulkan_lib.root_module.addIncludePath(vulkan_headers.path("include"));
|
||||||
dear_imgui_vulkan_lib.root_module.addCMacro("IMGUI_IMPL_VULKAN_NO_PROTOTYPES", "1"); // Assumed in generator
|
dear_imgui_vulkan_lib.root_module.addCMacro("IMGUI_IMPL_VULKAN_NO_PROTOTYPES", "1"); // Assumed in generator
|
||||||
dear_imgui_vulkan_lib.installHeadersDirectory(upstream.path("backends"), "", .{});
|
dear_imgui_vulkan_lib.installHeadersDirectory(upstream.path("backends"), "", .{});
|
||||||
dear_imgui_vulkan_lib.installHeadersDirectory(vulkan_headers.path("include"), "", .{});
|
dear_imgui_vulkan_lib.installHeadersDirectory(vulkan_headers.path("include"), "", .{});
|
||||||
|
|
@ -88,14 +88,14 @@ pub fn build(b: *std.Build) void {
|
||||||
.optimize = optimize_external,
|
.optimize = optimize_external,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
dear_imgui_sdl3_lib.linkLibrary(dear_imgui_lib);
|
dear_imgui_sdl3_lib.root_module.linkLibrary(dear_imgui_lib);
|
||||||
dear_imgui_sdl3_lib.addCSourceFile(.{ .file = upstream.path("backends/imgui_impl_sdl3.cpp"), .flags = flags });
|
dear_imgui_sdl3_lib.root_module.addCSourceFile(.{ .file = upstream.path("backends/imgui_impl_sdl3.cpp"), .flags = flags });
|
||||||
dear_imgui_sdl3_lib.addCSourceFile(.{ .file = b.path("src/cached/dcimgui_impl_sdl3.cpp"), .flags = flags });
|
dear_imgui_sdl3_lib.root_module.addCSourceFile(.{ .file = b.path("src/cached/dcimgui_impl_sdl3.cpp"), .flags = flags });
|
||||||
dear_imgui_sdl3_lib.addIncludePath(b.path("src/include"));
|
dear_imgui_sdl3_lib.root_module.addIncludePath(b.path("src/include"));
|
||||||
dear_imgui_sdl3_lib.addIncludePath(upstream.path(""));
|
dear_imgui_sdl3_lib.root_module.addIncludePath(upstream.path(""));
|
||||||
dear_imgui_sdl3_lib.addIncludePath(upstream.path("backends"));
|
dear_imgui_sdl3_lib.root_module.addIncludePath(upstream.path("backends"));
|
||||||
const sdl = b.dependency("sdl", .{});
|
const sdl = b.dependency("sdl", .{});
|
||||||
dear_imgui_sdl3_lib.addIncludePath(sdl.path("include"));
|
dear_imgui_sdl3_lib.root_module.addIncludePath(sdl.path("include"));
|
||||||
dear_imgui_sdl3_lib.installHeadersDirectory(upstream.path("backends"), "", .{});
|
dear_imgui_sdl3_lib.installHeadersDirectory(upstream.path("backends"), "", .{});
|
||||||
b.installArtifact(dear_imgui_sdl3_lib);
|
b.installArtifact(dear_imgui_sdl3_lib);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
.name = .dear_imgui,
|
.name = .dear_imgui,
|
||||||
.fingerprint = 0xc1cc609af54040bd,
|
.fingerprint = 0xc1cc609af54040bd,
|
||||||
.version = "1.0.0",
|
.version = "1.0.0",
|
||||||
.minimum_zig_version = "0.16.0-dev.1484+d0ba6642b",
|
.minimum_zig_version = "0.16.0-dev.2193+fc517bd01",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.@"dear-imgui" = .{
|
.@"dear-imgui" = .{
|
||||||
.url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.92.2b-docking.tar.gz",
|
.url = "https://github.com/ocornut/imgui/archive/refs/tags/v1.92.2b-docking.tar.gz",
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ const Symbols = struct {
|
||||||
|
|
||||||
/// Returns true if there's already a public symbol with this name.
|
/// Returns true if there's already a public symbol with this name.
|
||||||
pub fn put(self: *@This(), name: []const u8) !bool {
|
pub fn put(self: *@This(), name: []const u8) !bool {
|
||||||
const trimmed = std.mem.trimRight(u8, name, "_");
|
const trimmed = std.mem.trimEnd(u8, name, "_");
|
||||||
if (self.public.contains(trimmed)) return false;
|
if (self.public.contains(trimmed)) return false;
|
||||||
try self.front_buf.put(trimmed, {});
|
try self.front_buf.put(trimmed, {});
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -174,7 +174,7 @@ const Header = struct {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main(init: std.process.Init.Minimal) !void {
|
||||||
// Allocator and command line args
|
// Allocator and command line args
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{
|
var gpa = std.heap.GeneralPurposeAllocator(.{
|
||||||
.thread_safe = false,
|
.thread_safe = false,
|
||||||
|
|
@ -185,7 +185,7 @@ pub fn main() !void {
|
||||||
var threaded_io: Io.Threaded = .init_single_threaded;
|
var threaded_io: Io.Threaded = .init_single_threaded;
|
||||||
const io = threaded_io.io();
|
const io = threaded_io.io();
|
||||||
|
|
||||||
var args = try std.process.argsWithAllocator(allocator);
|
var args = try init.args.iterateAllocator(allocator);
|
||||||
defer args.deinit();
|
defer args.deinit();
|
||||||
std.debug.assert(args.skip());
|
std.debug.assert(args.skip());
|
||||||
const in_path = args.next().?;
|
const in_path = args.next().?;
|
||||||
|
|
@ -195,10 +195,10 @@ pub fn main() !void {
|
||||||
const internal_path = args.next();
|
const internal_path = args.next();
|
||||||
std.debug.assert(args.next() == null);
|
std.debug.assert(args.next() == null);
|
||||||
|
|
||||||
const out = try std.fs.cwd().createFile(out_path, .{});
|
const out = try Dir.cwd().createFile(io, out_path, .{});
|
||||||
defer out.close();
|
defer out.close(io);
|
||||||
var writer_buf: [4096]u8 = undefined;
|
var writer_buf: [4096]u8 = undefined;
|
||||||
var file_writer = out.writerStreaming(&writer_buf);
|
var file_writer = out.writerStreaming(io, &writer_buf);
|
||||||
const writer = &file_writer.interface;
|
const writer = &file_writer.interface;
|
||||||
|
|
||||||
// Write the prefix
|
// Write the prefix
|
||||||
|
|
@ -217,7 +217,7 @@ pub fn main() !void {
|
||||||
defer symbols.deinit();
|
defer symbols.deinit();
|
||||||
|
|
||||||
// Write the source
|
// Write the source
|
||||||
const main_source = try std.fs.cwd().readFileAlloc(in_path, allocator, .limited(max_size));
|
const main_source = try Dir.cwd().readFileAlloc(io, in_path, allocator, .limited(max_size));
|
||||||
defer allocator.free(main_source);
|
defer allocator.free(main_source);
|
||||||
try writeSource(
|
try writeSource(
|
||||||
allocator,
|
allocator,
|
||||||
|
|
@ -230,7 +230,7 @@ pub fn main() !void {
|
||||||
|
|
||||||
// Write the internal source, if supplied
|
// Write the internal source, if supplied
|
||||||
if (internal_path) |p| {
|
if (internal_path) |p| {
|
||||||
const internal_source = try std.fs.cwd().readFileAlloc(p, allocator, .limited(max_size));
|
const internal_source = try Dir.cwd().readFileAlloc(io, p, allocator, .limited(max_size));
|
||||||
defer allocator.free(internal_source);
|
defer allocator.free(internal_source);
|
||||||
|
|
||||||
try writer.writeAll("pub const internal = struct {\n");
|
try writer.writeAll("pub const internal = struct {\n");
|
||||||
|
|
@ -312,7 +312,7 @@ fn getDeclarations(allocator: Allocator, header: *const Header) !Declarations {
|
||||||
for (header.structs) |ty| {
|
for (header.structs) |ty| {
|
||||||
if (skip(ty.conditionals)) continue;
|
if (skip(ty.conditionals)) continue;
|
||||||
|
|
||||||
const trimmed = std.mem.trimRight(u8, ty.name, "_");
|
const trimmed = std.mem.trimEnd(u8, ty.name, "_");
|
||||||
|
|
||||||
var kind: DeclarationKind = .normal;
|
var kind: DeclarationKind = .normal;
|
||||||
if (ty.forward_declaration) {
|
if (ty.forward_declaration) {
|
||||||
|
|
@ -349,7 +349,7 @@ fn getDeclarations(allocator: Allocator, header: *const Header) !Declarations {
|
||||||
for (header.enums) |e| {
|
for (header.enums) |e| {
|
||||||
if (skip(e.conditionals)) continue;
|
if (skip(e.conditionals)) continue;
|
||||||
|
|
||||||
const trimmed = std.mem.trimRight(u8, e.name, "_");
|
const trimmed = std.mem.trimEnd(u8, e.name, "_");
|
||||||
try declarations.put(trimmed, .normal);
|
try declarations.put(trimmed, .normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue