Bump to Zig 0.11/raylib 4.6-dev
This commit is contained in:
parent
9c5197bad4
commit
edbd73e6be
19 changed files with 478 additions and 402 deletions
49
build.zig
49
build.zig
|
|
@ -1,13 +1,7 @@
|
|||
//
|
||||
// build
|
||||
// Zig version: 0.9.0
|
||||
// Author: Nikolas Wipper
|
||||
// Date: 2020-02-15
|
||||
//
|
||||
// raylib-zig (c) Nikolas Wipper 2020-2023
|
||||
|
||||
const std = @import("std");
|
||||
const Builder = std.build.Builder;
|
||||
const raylib = @import("lib.zig");
|
||||
|
||||
const Program = struct {
|
||||
name: []const u8,
|
||||
|
|
@ -15,9 +9,28 @@ const Program = struct {
|
|||
desc: []const u8,
|
||||
};
|
||||
|
||||
pub fn build(b: *Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
pub fn getArtifact(b: *std.Build, target: std.zig.CrossTarget, optimize: std.builtin.Mode) *std.Build.Step.Compile {
|
||||
const raylib = b.dependency("raylib", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
return raylib.artifact("raylib");
|
||||
}
|
||||
|
||||
pub fn getModule(b: *std.Build) *std.Build.Module {
|
||||
return b.addModule("raylib", .{ .source_file = .{ .path = "lib/raylib-zig.zig" } });
|
||||
}
|
||||
|
||||
pub const math = struct {
|
||||
pub fn getModule(b: *std.Build) *std.Build.Module {
|
||||
return b.addModule("raylib-math", .{ .source_file = .{ .path = "lib/raylib-zig-math.zig" } });
|
||||
}
|
||||
};
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const examples = [_]Program{
|
||||
.{
|
||||
|
|
@ -84,18 +97,20 @@ pub fn build(b: *Builder) void {
|
|||
|
||||
const examples_step = b.step("examples", "Builds all the examples");
|
||||
const system_lib = b.option(bool, "system-raylib", "link to preinstalled raylib libraries") orelse false;
|
||||
_ = system_lib;
|
||||
|
||||
var raylib = getModule(b);
|
||||
var raylib_math = math.getModule(b);
|
||||
var raylib_artifact = getArtifact(b, target, optimize);
|
||||
|
||||
for (examples) |ex| {
|
||||
const exe = b.addExecutable(ex.name, ex.path);
|
||||
const exe = b.addExecutable(.{ .name = ex.name, .root_source_file = .{ .path = ex.path }, .optimize = optimize, .target = target });
|
||||
|
||||
exe.setBuildMode(mode);
|
||||
exe.setTarget(target);
|
||||
exe.linkLibrary(raylib_artifact);
|
||||
exe.addModule("raylib", raylib);
|
||||
exe.addModule("raylib-math", raylib_math);
|
||||
|
||||
raylib.link(exe, system_lib);
|
||||
raylib.addAsPackage("raylib", exe);
|
||||
raylib.math.addAsPackage("raylib-math", exe);
|
||||
|
||||
const run_cmd = exe.run();
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
const run_step = b.step(ex.name, ex.desc);
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
examples_step.dependOn(&exe.step);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue