This repository was archived by the owner on Jul 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Installation
JonSnowbd edited this page Sep 26, 2021
·
2 revisions
Installing Slingworks to your zig projects is a very simple process. Before we begin, make sure you've installed all of the dependencies Slingworks requires, such as Zig, Fmod, and x11 dev libraries on ubuntu.
Begin your zig project with zig init-exe in your directory, this will set up your executable build.zig steps.
mkdir example
cd example
zig init-exe
Then you submodule Slingworks wherever you want inside your project.
git init
git submodule add https://github.com/JonSnowbd/slingworks src/deps/slingworks
git submodule update --init --recursive
In your build.zig import src/deps/slingworks/build.zig and call into its .link(exe) method to have Slingworks
install the necessary binaries to the build output, and add all the packages.
const std = @import("std");
const slingBuild = @import("src/deps/slingworks/build.zig");
pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("underburrow", "src/main.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
slingBuild.link(exe);
slingBuild.addBinaryContent("assets") catch unreachable;
exe.install();
const run_cmd = exe.run();
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);
}After this you can test your installation by importing the sling package and calling run like so;
const sling = @import("sling");
pub fn main() void {
sling.run();
}