You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building with the Zig build system and raygui is enabled, a file named 'raygui.c' is leftover from the build process, and git counts it as a new file to add.
Environment
X86_64, Archlinux, OpenGL 4.6, NVidia 3060 mobile
Issue Screenshot
The extra file in the VSCode file explorer
Code Example
I am using Raylib as part of a project written in Zig, so here is my build.zig
const std = @import("std");
const raylibBuild = @import("raylib/src/build.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "Celestial",
.root_source_file = .{ .path = "Celestial/main.zig" },
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
// Add zig-ecs as a module
const ecs_module = b.addModule("zig-ecs", .{
.source_file = std.build.FileSource{ .path = "zig-ecs/src/ecs.zig" },
});
exe.addModule("ecs", ecs_module);
// Add raylib as a module
const raylib = raylibBuild.addRaylib(b, target, optimize, .{
.raudio = true,
.rmodels = true,
.rshapes = true,
.rtext = true,
.rtextures = true,
// Enable raygui
.raygui = true,
.platform_drm = false,
});
raylib.installHeader("raylib/src/raylib.h", "raylib.h");
raylib.installHeader("raylib/src/raymath.h", "raymath.h");
raylib.installHeader("raylib/src/rlgl.h", "rlgl.h");
// I could have just copied the header, but using a git submodule is more convenient if I ever need a more recent version
raylib.installHeader("raygui/src/raygui.h", "raygui.h");
exe.linkLibrary(raylib);
// the exe needs the headers too
exe.installHeader("raylib/src/raylib.h", "raylib.h");
exe.installHeader("raygui/src/raygui.h", "raygui.h");
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
// pass through arguments to the application
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
// Unit tests are important
const unit_tests = b.addTest(.{
.root_source_file = .{ .path = "Celestial/main.zig" },
.target = target,
.optimize = optimize,
});
const run_unit_tests = b.addRunArtifact(unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_unit_tests.step);
}
The issue happens around line 56 of raylib/src/build.zig
// For one, using the create() method directly is generally not a good idea, so addWriteFiles is used instead.
var gen_step = b.addWriteFiles();
raylib.step.dependOn(&gen_step.step);
if (options.raygui) {
//Instead of hardcoding the path into the source directory, the raygui.c file is put into the zig cache, as it should.
const raygui_c_path = gen_step.add("raygui.c", "#define RAYGUI_IMPLEMENTATION\n#include \"raygui.h\"\n");
raylib.addCSourceFile(.{ .file = raygui_c_path, .flags = raylib_flags });
raylib.addIncludePath(.{ .path = srcdir });
raylib.addIncludePath(.{ .path = srcdir ++ "/../../raygui/src" });
}
I decided to apply the change, and as far as I can tell it works as it should.
The text was updated successfully, but these errors were encountered:
Issue description
When building with the Zig build system and raygui is enabled, a file named 'raygui.c' is leftover from the build process, and git counts it as a new file to add.
Environment
X86_64, Archlinux, OpenGL 4.6, NVidia 3060 mobile
Issue Screenshot
The extra file in the VSCode file explorer
![image](https://private-user-images.githubusercontent.com/69832658/275111533-210b13c9-788e-4188-9366-562b8136fd28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1OTI4NzgsIm5iZiI6MTcyNTU5MjU3OCwicGF0aCI6Ii82OTgzMjY1OC8yNzUxMTE1MzMtMjEwYjEzYzktNzg4ZS00MTg4LTkzNjYtNTYyYjgxMzZmZDI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA2VDAzMTYxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg3ZWFhNjA3MTZmNDMxMmU2YjAwMjkxYmVmNTFhNTUwMzM3ZjRjYjFkZjllODAzYjRmODQ0NGQ4ZTRlZTYxN2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5xHMp4umJt5c0mgcZCGbQY8q6rxXBPqvalAHSCa4RGQ)
Code Example
I am using Raylib as part of a project written in Zig, so here is my build.zig
The issue happens around line 56 of raylib/src/build.zig
To fix the issue, the code could be changed to:
I decided to apply the change, and as far as I can tell it works as it should.
The text was updated successfully, but these errors were encountered: