| ... | ... | @@ -31,26 +31,6 @@ pub const ModFile = struct { |
| 31 | 31 | const name = doc.mapping.get("name").?.string; |
| 32 | 32 | const main = doc.mapping.get("main").?.string; |
| 33 | 33 | |
| 34 | | const cinclude_list = &std.ArrayList([]const u8).init(alloc); |
| 35 | | if (doc.mapping.get("c_include_dirs")) |val| { |
| 36 | | if (val == .sequence) { |
| 37 | | for (val.sequence) |item, i| { |
| 38 | | u.assert(item == .string, "modfile: {}[{}] is not a string", .{"c_include_dirs", i}); |
| 39 | | try cinclude_list.append(item.string); |
| 40 | | } |
| 41 | | } |
| 42 | | } |
| 43 | | |
| 44 | | const csrc_list = &std.ArrayList([]const u8).init(alloc); |
| 45 | | if (doc.mapping.get("c_source_files")) |val| { |
| 46 | | if (val == .sequence) { |
| 47 | | for (val.sequence) |item, i| { |
| 48 | | u.assert(item == .string, "modfile: {}[{}] is not a string", .{"c_source_files", i}); |
| 49 | | try csrc_list.append(item.string); |
| 50 | | } |
| 51 | | } |
| 52 | | } |
| 53 | | |
| 54 | 34 | const dep_list = &std.ArrayList(u.Dep).init(alloc); |
| 55 | 35 | if (doc.mapping.get("dependencies")) |dep_seq| { |
| 56 | 36 | if (dep_seq == .sequence) { |
| ... | ... | @@ -71,8 +51,8 @@ pub const ModFile = struct { |
| 71 | 51 | .alloc = alloc, |
| 72 | 52 | .name = name, |
| 73 | 53 | .main = main, |
| 74 | | .c_include_dirs = cinclude_list.items, |
| 75 | | .c_source_files = csrc_list.items, |
| 54 | .c_include_dirs = try doc.mapping.get_string_array(alloc, "c_include_dirs"), |
| 55 | .c_source_files = try doc.mapping.get_string_array(alloc, "c_source_files"), |
| 76 | 56 | .deps = dep_list.items, |
| 77 | 57 | }; |
| 78 | 58 | } |