@@ -2,7 +2,7 @@ const std = @import("std");
22const builtin = @import ("builtin" );
33
44/// Minimum supported version of Zig
5- const min_ver = "0.15.1 " ;
5+ const min_ver = "0.16.0-dev.2349+204fa8959 " ;
66
77const emccOutputDir = "zig-out" ++ std .fs .path .sep_str ++ "htmlout" ++ std .fs .path .sep_str ;
88const emccOutputFile = "index.html" ;
@@ -197,7 +197,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
197197 }
198198
199199 var c_source_files : std .ArrayList ([]const u8 ) = try .initCapacity (b .allocator , 2 );
200- c_source_files .appendSliceAssumeCapacity (&.{ "src/rcore.c" });
200+ c_source_files .appendSliceAssumeCapacity (&.{"src/rcore.c" });
201201
202202 if (options .rshapes ) {
203203 try c_source_files .append (b .allocator , "src/rshapes.c" );
@@ -448,7 +448,7 @@ pub const Options = struct {
448448 .linux_display_backend = b .option (LinuxDisplayBackend , "linux_display_backend" , "Linux display backend to use" ) orelse defaults .linux_display_backend ,
449449 .opengl_version = b .option (OpenglVersion , "opengl_version" , "OpenGL version to use" ) orelse defaults .opengl_version ,
450450 .config = b .option ([]const u8 , "config" , "Compile with custom define macros overriding config.h" ) orelse &.{},
451- .android_ndk = b .option ([]const u8 , "android_ndk" , "specify path to android ndk" ) orelse std . process . getEnvVarOwned ( b . allocator , "ANDROID_NDK_HOME" ) catch "" ,
451+ .android_ndk = b .option ([]const u8 , "android_ndk" , "specify path to android ndk" ) orelse b . graph . environ_map . get ( "ANDROID_NDK_HOME" ) orelse "" ,
452452 .android_api_version = b .option ([]const u8 , "android_api_version" , "specify target android API level" ) orelse defaults .android_api_version ,
453453 };
454454 }
@@ -523,15 +523,17 @@ fn addExamples(
523523) ! * std.Build.Step {
524524 const all = b .step (module , "All " ++ module ++ " examples" );
525525 const module_subpath = b .pathJoin (&.{ "examples" , module });
526- var dir = try std .fs .cwd ().openDir (b .pathFromRoot (module_subpath ), .{ .iterate = true });
527- defer dir .close ();
526+
527+ var dir = try std .Io .Dir .cwd ().openDir (b .graph .io , b .pathFromRoot (module_subpath ), .{ .iterate = true });
528+ defer dir .close (b .graph .io );
528529
529530 var iter = dir .iterate ();
530- while (try iter .next ()) | entry | {
531+ while (try iter .next (b . graph . io )) | entry | {
531532 if (entry .kind != .file ) continue ;
532533 const extension_idx = std .mem .lastIndexOf (u8 , entry .name , ".c" ) orelse continue ;
533534 const name = entry .name [0.. extension_idx ];
534- const path = b .pathJoin (&.{ module_subpath , entry .name });
535+ const filename = try std .fmt .allocPrint (b .allocator , "{s}.c" , .{name });
536+ const path = b .pathJoin (&.{ module_subpath , filename });
535537
536538 // zig's mingw headers do not include pthread.h
537539 if (std .mem .eql (u8 , "core_loading_thread" , name ) and target .result .os .tag == .windows ) continue ;
@@ -553,12 +555,11 @@ fn addExamples(
553555 });
554556
555557 if (std .mem .eql (u8 , name , "rlgl_standalone" )) {
556- //TODO: Make rlgl_standalone example work
557- continue ;
558+ exe_mod . addIncludePath ( b . path ( "src" ));
559+ exe_mod . addIncludePath ( b . path ( "src/external/glfw/include" )) ;
558560 }
559561 if (std .mem .eql (u8 , name , "raylib_opengl_interop" )) {
560- //TODO: Make raylib_opengl_interop example work
561- continue ;
562+ exe_mod .addIncludePath (b .path ("src/external" ));
562563 }
563564
564565 const emcc_flags = emsdk .emccDefaultFlags (b .allocator , .{ .optimize = optimize });
@@ -650,6 +651,7 @@ fn addExamples(
650651 all .dependOn (& install_cmd .step );
651652 }
652653 }
654+
653655 return all ;
654656}
655657
0 commit comments