Add Khronos license information to generated bindings

This commit is contained in:
Robin Voetter
2020-07-08 01:41:03 +02:00
parent f2edf4f674
commit 0928b25a53
3 changed files with 13 additions and 0 deletions

View File

@@ -6,6 +6,9 @@ const mem = std.mem;
const Allocator = mem.Allocator;
const preamble =
\\
\\// This file is generated from the Khronos Vulkan XML API Registry
\\
\\const std = @import("std");
\\const builtin = @import("builtin");
\\const root = @import("root");
@@ -294,6 +297,7 @@ fn Renderer(comptime WriterType: type) type {
}
fn render(self: *Self) !void {
try self.renderCopyright();
try self.writer.writeAll(preamble);
for (self.registry.api_constants) |api_constant| {
@@ -309,6 +313,13 @@ fn Renderer(comptime WriterType: type) type {
try self.renderWrappers();
}
fn renderCopyright(self: *Self) !void {
var it = mem.split(self.registry.copyright, "\n");
while (it.next()) |line| {
try self.writer.print("// {}\n", .{line});
}
}
fn renderApiConstant(self: *Self, api_constant: reg.ApiConstant) !void {
try self.writer.writeAll("pub const ");
try self.renderName(api_constant.name);