@@ -12,6 +12,7 @@ const TextureFormat = enum {
1212const TextureInfoV1 = struct {
1313 destination_path : []const u8 ,
1414 source_path : []const u8 ,
15+ dep_path : []const u8 ,
1516 format : TextureFormat ,
1617 width : ? u32 ,
1718 height : ? u32 ,
@@ -24,11 +25,13 @@ pub fn main() !void {
2425 const parsed_args = args .parseForCurrentProcess (struct {
2526 input : []const u8 = "" ,
2627 output : []const u8 = "" ,
28+ dep : []const u8 = "" ,
2729 @"generate-metadata" : bool = false ,
2830
2931 pub const shorthands = .{
3032 .i = "input" ,
3133 .o = "output" ,
34+ .d = "dep" ,
3235 };
3336 }, std .heap .page_allocator , .print ) catch unreachable ;
3437 defer parsed_args .deinit ();
@@ -51,6 +54,7 @@ pub fn main() !void {
5154
5255 var texture_info = std .mem .zeroes (TextureInfoV1 );
5356 texture_info .destination_path = try arena .dupe (u8 , parsed_args .options .output );
57+ texture_info .dep_path = try arena .dupe (u8 , parsed_args .options .dep );
5458
5559 var buffer : [1024 ]u8 = undefined ;
5660 while (try in_stream .readUntilDelimiterOrEof (& buffer , '\n ' )) | line | {
@@ -228,6 +232,16 @@ fn executeTextureConversionV1(desc: *TextureInfoV1, arena: std.mem.Allocator) !v
228232 var cmd = std .process .Child .init (@ptrCast (argv .items ), std .heap .page_allocator );
229233 try cmd .spawn ();
230234
235+ // Write the .dep file
236+ {
237+ var file = try std .fs .cwd ().createFile (desc .dep_path , .{});
238+ defer file .close ();
239+
240+ // Add the source image as input
241+ try file .writeAll ("INPUT: " );
242+ try file .writeAll (source_absolute_path );
243+ }
244+
231245 const term = try cmd .wait ();
232246 std .debug .assert (term == .Exited );
233247}
0 commit comments