Update project setup script
This commit is contained in:
parent
79ee589441
commit
ec45e33189
2 changed files with 18 additions and 21 deletions
|
|
@ -10,33 +10,31 @@ mkdir "$PROJECT_NAME" && cd "$PROJECT_NAME" || exit
|
|||
touch build.zig
|
||||
echo "generating project files..."
|
||||
echo 'const std = @import("std");
|
||||
const Builder = std.build.Builder;
|
||||
const raylib = @import("raylib-zig/lib.zig"); //call .Pkg() with the folder raylib-zig is in relative to project build.zig
|
||||
const rl = @import("raylib-zig/build.zig");
|
||||
|
||||
|
||||
pub fn build(b: *Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const system_lib = b.option(bool, "system-raylib", "link to preinstalled raylib libraries") orelse false;
|
||||
var raylib = rl.getModule(b);
|
||||
var raylib_math = rl.math.getModule(b);
|
||||
|
||||
const exe = b.addExecutable("'$PROJECT_NAME'", "src/main.zig");
|
||||
exe.setBuildMode(mode);
|
||||
exe.setTarget(target);
|
||||
const exe = b.addExecutable(.{ .name = "'$PROJECT_NAME'", .root_source_file = .{ .path = "src/main.zig" }, .optimize = optimize, .target = target });
|
||||
|
||||
rl.link(b, exe, target, optimize);
|
||||
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_step = b.step("run", "run '$PROJECT_NAME'");
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
const run_step = b.step("run", "Run '$PROJECT_NAME'");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
exe.install();
|
||||
b.installArtifact(exe);
|
||||
}
|
||||
' >> build.zig
|
||||
|
||||
mkdir src
|
||||
cp ../examples/core/basic_window.zig src/main.zig
|
||||
cp ../build.zig.zon .
|
||||
echo "cloning raylib-zig inside of project..."
|
||||
git clone ../ raylib-zig --recursive
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue