From 01e34c1cd9a1cb56563e6c611c19d864c81de3c3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 7 Jan 2023 18:12:20 -0700 Subject: std.build.ConfigHeaderStep: stub out cmake style --- lib/std/build/ConfigHeaderStep.zig | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/std/build/ConfigHeaderStep.zig b/lib/std/build/ConfigHeaderStep.zig index fcfd876b53..23a21a1481 100644 --- a/lib/std/build/ConfigHeaderStep.zig +++ b/lib/std/build/ConfigHeaderStep.zig @@ -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"); } -- cgit v1.2.3