| ... | ... | @@ -47,11 +47,11 @@ pub fn execute(args: [][]u8) !void { |
| 47 | 47 | try w.print(";\n", .{}); |
| 48 | 48 | try w.print("\n", .{}); |
| 49 | 49 | try w.print("{}\n", .{"pub const c_include_dirs = &[_][]const u8{"}); |
| 50 | | try print_incl_dirs_to(w, top_module); |
| 50 | try print_incl_dirs_to(w, top_module, &std.ArrayList([]const u8).init(gpa)); |
| 51 | 51 | try w.print("{};\n", .{"}"}); |
| 52 | 52 | try w.print("\n", .{}); |
| 53 | 53 | try w.print("{}\n", .{"pub const c_source_files = &[_][]const u8{"}); |
| 54 | | try print_csrc_dirs_to(w, top_module); |
| 54 | try print_csrc_dirs_to(w, top_module, &std.ArrayList([]const u8).init(gpa)); |
| 55 | 55 | try w.print("{};\n", .{"}"}); |
| 56 | 56 | } |
| 57 | 57 | |
| ... | ... | @@ -119,20 +119,28 @@ fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32) an |
| 119 | 119 | try w.print("{}", .{try u.concat(&[_][]const u8{r,"}"})}); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | | fn print_incl_dirs_to(w: std.fs.File.Writer, mod: u.Module) anyerror!void { |
| 122 | fn print_incl_dirs_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8)) anyerror!void { |
| 123 | if (u.list_contains(list, mod.clean_path)) { |
| 124 | return; |
| 125 | } |
| 126 | try list.append(mod.clean_path); |
| 123 | 127 | for (mod.c_include_dirs) |it| { |
| 124 | 128 | try w.print(" cache ++ \"/{}/{}\",\n", .{mod.clean_path, it}); |
| 125 | 129 | } |
| 126 | 130 | for (mod.deps) |d| { |
| 127 | | try print_incl_dirs_to(w, d); |
| 131 | try print_incl_dirs_to(w, d, list); |
| 128 | 132 | } |
| 129 | 133 | } |
| 130 | 134 | |
| 131 | | fn print_csrc_dirs_to(w: std.fs.File.Writer, mod: u.Module) anyerror!void { |
| 135 | fn print_csrc_dirs_to(w: std.fs.File.Writer, mod: u.Module, list: *std.ArrayList([]const u8)) anyerror!void { |
| 136 | if (u.list_contains(list, mod.clean_path)) { |
| 137 | return; |
| 138 | } |
| 139 | try list.append(mod.clean_path); |
| 132 | 140 | for (mod.c_source_files) |it| { |
| 133 | 141 | try w.print(" cache ++ \"/{}/{}\",\n", .{mod.clean_path, it}); |
| 134 | 142 | } |
| 135 | 143 | for (mod.deps) |d| { |
| 136 | | try print_csrc_dirs_to(w, d); |
| 144 | try print_csrc_dirs_to(w, d, list); |
| 137 | 145 | } |
| 138 | 146 | } |