std.build.ConfigHeaderStep: stub out cmake style

This commit is contained in:
Andrew Kelley 2023-01-07 18:12:20 -07:00
parent ea792011d1
commit 01e34c1cd9

View File

@ -151,6 +151,20 @@ fn make(step: *Step) !void {
try output.appendSlice("/* This file was generated by ConfigHeaderStep using the Zig Build System. */\n");
switch (self.style) {
.autoconf => try render_autoconf(contents, &output, &values_copy, src_path),
.cmake => try render_cmake(contents, &output, &values_copy, src_path),
}
try dir.writeFile(self.output_basename, output.items);
}
fn render_autoconf(
contents: []const u8,
output: *std.ArrayList(u8),
values_copy: *std.StringHashMap(Value),
src_path: []const u8,
) !void {
var any_errors = false;
var line_index: u32 = 0;
var line_it = std.mem.split(u8, contents, "\n");
@ -216,6 +230,17 @@ fn make(step: *Step) !void {
if (any_errors) {
return error.HeaderConfigFailed;
}
try dir.writeFile(self.output_basename, output.items);
}
fn render_cmake(
contents: []const u8,
output: *std.ArrayList(u8),
values_copy: *std.StringHashMap(Value),
src_path: []const u8,
) !void {
_ = contents;
_ = output;
_ = values_copy;
_ = src_path;
@panic("TODO: render_cmake is not implemented yet");
}