authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-07 18:12:20-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-07 18:12:20-07:00
log01e34c1cd9a1cb56563e6c611c19d864c81de3c3
tree65bc0cdfe318234e6f203f84be9a925efe9c8567
parentea792011d188cff29872c4dd8e732af60765852c

std.build.ConfigHeaderStep: stub out cmake style


1 files changed, 26 insertions(+), 1 deletions(-)

lib/std/build/ConfigHeaderStep.zig+26-1
......@@ -151,6 +151,20 @@ fn make(step: *Step) !void {
151151
152152 try output.appendSlice("/* This file was generated by ConfigHeaderStep using the Zig Build System. */\n");
153153
154 switch (self.style) {
155 .autoconf => try render_autoconf(contents, &output, &values_copy, src_path),
156 .cmake => try render_cmake(contents, &output, &values_copy, src_path),
157 }
158
159 try dir.writeFile(self.output_basename, output.items);
160}
161
162fn render_autoconf(
163 contents: []const u8,
164 output: *std.ArrayList(u8),
165 values_copy: *std.StringHashMap(Value),
166 src_path: []const u8,
167) !void {
154168 var any_errors = false;
155169 var line_index: u32 = 0;
156170 var line_it = std.mem.split(u8, contents, "\n");
......@@ -216,6 +230,17 @@ fn make(step: *Step) !void {
216230 if (any_errors) {
217231 return error.HeaderConfigFailed;
218232 }
233}
219234
220 try dir.writeFile(self.output_basename, output.items);
235fn render_cmake(
236 contents: []const u8,
237 output: *std.ArrayList(u8),
238 values_copy: *std.StringHashMap(Value),
239 src_path: []const u8,
240) !void {
241 _ = contents;
242 _ = output;
243 _ = values_copy;
244 _ = src_path;
245 @panic("TODO: render_cmake is not implemented yet");
221246}