mirror of
https://github.com/Not-Nik/raylib-zig.git
synced 2025-09-09 12:07:27 +00:00
adapt projectSetup.sh for use with lib.zig and raylib submodule
This commit is contained in:
parent
8771f17efb
commit
7fc94954b9
2
lib.zig
2
lib.zig
@ -84,7 +84,7 @@ pub fn Pkg(pkgdir: comptime []const u8) type {
|
||||
std.debug.warn("unable to create child process for git. build interrupted\n", .{});
|
||||
std.os.exit(1);
|
||||
};
|
||||
|
||||
git_proc.cwd = pkgdir;
|
||||
const term = git_proc.spawnAndWait() catch {
|
||||
std.debug.warn("unable to spawn child process for git. build interrupted\n", .{});
|
||||
std.os.exit(1);
|
||||
|
@ -6,27 +6,35 @@ fi
|
||||
|
||||
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").Pkg("raylib-zig"); //call .Pkg() with the folder raylib-zig is in relative to project build.zig
|
||||
|
||||
echo 'const Builder = @import("std").build.Builder;
|
||||
|
||||
pub fn build(b: *Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
const exe = b.addExecutable("'"$PROJECT_NAME"'", "src/main.zig");
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const system_lib = b.option(bool, "system-raylib", "link to preinstalled raylib libraries") orelse false;
|
||||
|
||||
const exe = b.addExecutable("'$PROJECT_NAME'", "src/main.zig");
|
||||
exe.setBuildMode(mode);
|
||||
exe.linkSystemLibrary("raylib");
|
||||
exe.addPackagePath("raylib", "raylib-zig/raylib-zig.zig");
|
||||
exe.install();
|
||||
exe.setTarget(target);
|
||||
|
||||
raylib.link(exe, system_lib);
|
||||
raylib.addAsPackage("raylib", exe);
|
||||
raylib.math.addAsPackage("raylib-math", exe);
|
||||
|
||||
const run_cmd = exe.run();
|
||||
run_cmd.step.dependOn(b.getInstallStep());
|
||||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
const run_step = b.step("run", "run '$PROJECT_NAME'");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
exe.install();
|
||||
}
|
||||
' >> build.zig
|
||||
|
||||
mkdir src
|
||||
mkdir raylib-zig
|
||||
cp ../lib/* raylib-zig
|
||||
cp ../examples/core/basic_window.zig src
|
||||
mv src/basic_window.zig src/main.zig
|
||||
cp ../examples/core/basic_window.zig src/main.zig
|
||||
echo "cloning raylib-zig inside of project..."
|
||||
git clone ../ raylib-zig
|
||||
|
Loading…
x
Reference in New Issue
Block a user