@@ -119,7 +119,7 @@ pub const PhantomModule = struct {
119119 provides : ? Provides = null ,
120120
121121 pub const Provides = struct {
122- scenes : ? []const []const u8 = null ,
122+ scenes : ? []const [: 0 ]const u8 = null ,
123123 displays : ? []const []const u8 = null ,
124124 platforms : ? []const []const u8 = null ,
125125 imageFormats : ? []const []const u8 = null ,
@@ -217,7 +217,7 @@ pub fn TypeFor(comptime kind: std.meta.FieldEnum(PhantomModule.Provides)) type {
217217
218218 for (mod .getProvider ().value (kind )) | name | {
219219 fields [i ] = .{
220- .name = name ,
220+ .name = @ptrCast ( name ++ &[ _ ] u8 { 0 }) ,
221221 .value = i ,
222222 };
223223 i += 1 ;
@@ -268,9 +268,14 @@ pub fn get(b: *std.Build, platform: anytype, phantom: *std.Build.Module) !*@impo
268268 const pkg = @field (buildDeps .packages , dep [1 ]);
269269 if (@hasDecl (pkg , "build_zig" )) {
270270 const buildZig = pkg .build_zig ;
271- if (@hasDecl (buildZig , "phantomModule" ) and @TypeOf (@field (buildZig , "phantomModule" )) == PhantomModule ) {
272- if (buildZig .phantomModule .getProvider ().has (.platform , @tagName (platform ))) {
273- return try @field (buildZig .phantomPlatform , @tagName (platform )).create (b , phantom );
271+ if (@hasDecl (buildZig , "phantomModule" ) and @TypeOf (@field (buildZig , "phantomModule" )) == PhantomModule and @hasDecl (buildZig , "phantomPlatform" )) {
272+ if (buildZig .phantomModule .getProvider ().has (.platforms , @tagName (platform ))) {
273+ inline for (comptime std .mem .declarations (buildZig .phantomPlatform )) | decl | {
274+ if (std .mem .eql (u8 , decl .name , @tagName (platform ))) {
275+ return try @field (buildZig .phantomPlatform , decl .name ).create (b , phantom );
276+ }
277+ }
278+ unreachable ;
274279 }
275280 }
276281 }
0 commit comments