| ... | @@ -30,12 +30,26 @@ pub fn execute(args: [][]u8) !void { | ... | @@ -30,12 +30,26 @@ pub fn execute(args: [][]u8) !void { |
| 30 | \\ for (packages) |pkg| { | 30 | \\ for (packages) |pkg| { |
| 31 | \\ exe.addPackage(pkg); | 31 | \\ exe.addPackage(pkg); |
| 32 | \\ } | 32 | \\ } |
| | 33 | \\ for (c_inlude_dirs) |dir| { |
| | 34 | \\ exe.addIncludeDir(dir); |
| | 35 | \\ } |
| | 36 | \\ for (c_source_files) |fpath| { |
| | 37 | \\ exe.addCSourceFile(fpath, &[_][]const u8{}); |
| | 38 | \\ } |
| 33 | \\} | 39 | \\} |
| 34 | }); | 40 | }); |
| 35 | try w.print("\n", .{}); | 41 | try w.print("\n", .{}); |
| 36 | try w.print("pub const packages = ", .{}); | 42 | try w.print("pub const packages = ", .{}); |
| 37 | try print_deps(w, dir, top_module, 0); | 43 | try print_deps(w, dir, top_module, 0); |
| 38 | try w.print(";\n", .{}); | 44 | try w.print(";\n", .{}); |
| | 45 | try w.print("\n", .{}); |
| | 46 | try w.print("{}\n", .{"pub const c_inlude_dirs = &[_][]const u8{"}); |
| | 47 | try print_incl_dirs_to(w, top_module); |
| | 48 | try w.print("{};\n", .{"}"}); |
| | 49 | try w.print("\n", .{}); |
| | 50 | try w.print("{}\n", .{"pub const c_source_files = &[_][]const u8{"}); |
| | 51 | try print_csrc_dirs_to(w, top_module); |
| | 52 | try w.print("{};\n", .{"}"}); |
| 39 | } | 53 | } |
| 40 | | 54 | |
| 41 | fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module { | 55 | fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module { |
| ... | @@ -66,6 +80,8 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module { | ... | @@ -66,6 +80,8 @@ fn fetch_deps(dir: []const u8, mpath: []const u8) anyerror!u.Module { |
| 66 | return u.Module{ | 80 | return u.Module{ |
| 67 | .name = m.name, | 81 | .name = m.name, |
| 68 | .main = m.main, | 82 | .main = m.main, |
| | 83 | .c_include_dirs = m.c_include_dirs, |
| | 84 | .c_source_files = m.c_source_files, |
| 69 | .deps = moduledeps.items, | 85 | .deps = moduledeps.items, |
| 70 | .clean_path = "", | 86 | .clean_path = "", |
| 71 | }; | 87 | }; |
| ... | @@ -99,3 +115,21 @@ fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32) an | ... | @@ -99,3 +115,21 @@ fn print_deps(w: std.fs.File.Writer, dir: []const u8, m: u.Module, tabs: i32) an |
| 99 | } | 115 | } |
| 100 | try w.print("{}", .{try u.concat(&[_][]const u8{r,"}"})}); | 116 | try w.print("{}", .{try u.concat(&[_][]const u8{r,"}"})}); |
| 101 | } | 117 | } |
| | 118 | |
| | 119 | fn print_incl_dirs_to(w: std.fs.File.Writer, mod: u.Module) anyerror!void { |
| | 120 | for (mod.c_include_dirs) |it| { |
| | 121 | try w.print(" cache ++ \"/{}/{}\",\n", .{mod.clean_path, it}); |
| | 122 | } |
| | 123 | for (mod.deps) |d| { |
| | 124 | try print_incl_dirs_to(w, d); |
| | 125 | } |
| | 126 | } |
| | 127 | |
| | 128 | fn print_csrc_dirs_to(w: std.fs.File.Writer, mod: u.Module) anyerror!void { |
| | 129 | for (mod.c_source_files) |it| { |
| | 130 | try w.print(" cache ++ \"/{}/{}\",\n", .{mod.clean_path, it}); |
| | 131 | } |
| | 132 | for (mod.deps) |d| { |
| | 133 | try print_csrc_dirs_to(w, d); |
| | 134 | } |
| | 135 | } |