Closed jpiechowka closed 2 months ago
const std = @import("std");
const builtin = @import("builtin");
pub fn build(b: *std.Build) void {
b.verbose = true;
comptime {
if (builtin.zig_version.minor < 13) @compileError("ps1z requires zig version >= 0.13.0");
}
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "ps1z",
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const rl = b.dependency("raylib", .{
.target = target,
.optimize = optimize,
});
// you need to link to the output of the build process
// that was done by the raylib package
// in this case, duck is outputting a library
// to which your project need to link as well
exe.linkLibrary(rl.artifact("raylib"));
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
});
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_exe_unit_tests.step);
}
Thank you, it works!
There is another problem that I lose all of the configuration options from addRaylib()
pub fn addRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, options: Options) !*std.Build.Step.Compile {
const raylib_dep = b.dependencyFromBuildZig(BuildScript, .{
.target = target,
.optimize = optimize,
.raudio = options.raudio,
.rmodels = options.rmodels,
.rshapes = options.rshapes,
.rtext = options.rtext,
.rtextures = options.rtextures,
.platform_drm = options.platform_drm,
.shared = options.shared,
.linux_display_backend = options.linux_display_backend,
.opengl_version = options.opengl_version,
});
@jpiechowka Is this issue addressed? Does it require some change? Please, send a PR if required.
@jpiechowka Is this issue addressed? Does it require some change? Please, send a PR if required.
The main problem was addressed. I think I can figure the config later when I have some time.
Issue description
On the latest Zig version, build fails with
error: file exists in multiple modules
on master branch. I have added Raylib as git submodule from master inside my repository:Environment
OS: Windows 11 Arch: x86-64 ZIG:
0.14.0-dev.185+c40708a2c
Code Example
build.zig
:build.zig.zon
: