Skip to content

Commit 33b2829

Browse files
committed
fix android-libc.txt generation
Previously, the libc paths file `android-libc.txt` was written to the folder from which the user ran `zig build`. This caused problems when using raylib as a dependency in other zig projects, since raylib is not built in the project root, but the `android-libc.txt` file was still generated in the project root. The file should now be generated in .zig-cache, which should fix the isssue (and leave the project root folder cleaner).
1 parent 11e15ab commit 33b2829

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

build.zig

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,15 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
238238
raylib.addSystemIncludePath( .{ .cwd_relative = androidAsmPath});
239239
raylib.addSystemIncludePath(.{ .cwd_relative = androidGluePath});
240240

241-
const libcFile = try std.fs.cwd().createFile("android-libc.txt", .{});
242-
const writer = libcFile.writer();
243-
const libc = std.zig.LibCInstallation{
241+
var libcData = std.ArrayList(u8).init(b.allocator).writer();
242+
const writer = libcData.writer();
243+
try (std.zig.LibCInstallation{
244244
.include_dir = androidIncludePath,
245245
.sys_include_dir = androidIncludePath,
246246
.crt_dir = androidApiSpecificPath,
247-
};
248-
try libc.render(writer);
249-
libcFile.close();
250-
251-
raylib.setLibCFile(b.path("android-libc.txt"));
247+
}).render(writer);
248+
const libcFile = b.addWriteFiles().add("android-libc.txt", try libcData.toOwnedSlice());
249+
raylib.setLibCFile(libcFile);
252250

253251
if (options.opengl_version == .auto) {
254252
raylib.root_module.linkSystemLibrary("GLESv2", .{});

0 commit comments

Comments
 (0)