| ... | @@ -151,6 +151,20 @@ fn make(step: *Step) !void { | ... | @@ -151,6 +151,20 @@ fn make(step: *Step) !void { |
| 151 | | 151 | |
| 152 | try output.appendSlice("/* This file was generated by ConfigHeaderStep using the Zig Build System. */\n"); | 152 | try output.appendSlice("/* This file was generated by ConfigHeaderStep using the Zig Build System. */\n"); |
| 153 | | 153 | |
| | 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 | |
| | 162 | fn render_autoconf( |
| | 163 | contents: []const u8, |
| | 164 | output: *std.ArrayList(u8), |
| | 165 | values_copy: *std.StringHashMap(Value), |
| | 166 | src_path: []const u8, |
| | 167 | ) !void { |
| 154 | var any_errors = false; | 168 | var any_errors = false; |
| 155 | var line_index: u32 = 0; | 169 | var line_index: u32 = 0; |
| 156 | var line_it = std.mem.split(u8, contents, "\n"); | 170 | var line_it = std.mem.split(u8, contents, "\n"); |
| ... | @@ -216,6 +230,17 @@ fn make(step: *Step) !void { | ... | @@ -216,6 +230,17 @@ fn make(step: *Step) !void { |
| 216 | if (any_errors) { | 230 | if (any_errors) { |
| 217 | return error.HeaderConfigFailed; | 231 | return error.HeaderConfigFailed; |
| 218 | } | 232 | } |
| | 233 | } |
| 219 | | 234 | |
| 220 | try dir.writeFile(self.output_basename, output.items); | 235 | fn 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"); |
| 221 | } | 246 | } |