discord.zig/build.zig
2024-11-08 17:58:43 +00:00

72 lines
2.2 KiB
Zig

const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
// these are boiler plate code until you know what you are doing
// and you need to add additional options
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast });
// this is your own program
const dzig = b.addModule("discord.zig", .{
.root_source_file = b.path("src/discord.zig"),
.link_libc = true,
});
const websocket = b.dependency("websocket", .{
.target = target,
.optimize = optimize,
});
const zig_tls = b.dependency("zig-tls", .{
.target = target,
.optimize = optimize,
});
const zlib = b.dependency("zlib", .{});
const zmpl = b.dependency("zmpl", .{
.target = target,
.optimize = optimize,
});
const deque = b.dependency("zig-deque", .{
.target = target,
.optimize = optimize,
});
const marin = b.addExecutable(.{
.name = "marin",
.root_source_file = b.path("src/test.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
// now install your own executable after it's built correctly
dzig.addImport("ws", websocket.module("websocket"));
dzig.addImport("tls12", zig_tls.module("zig-tls12"));
dzig.addImport("zlib", zlib.module("zlib"));
dzig.addImport("zmpl", zmpl.module("zmpl"));
dzig.addImport("deque", deque.module("zig-deque"));
marin.root_module.addImport("discord.zig", dzig);
marin.root_module.addImport("ws", websocket.module("websocket"));
marin.root_module.addImport("tls12", zig_tls.module("zig-tls12"));
marin.root_module.addImport("zlib", zlib.module("zlib"));
marin.root_module.addImport("zmpl", zmpl.module("zmpl"));
marin.root_module.addImport("deque", deque.module("zig-deque"));
//b.installArtifact(marin);
// test
const run_cmd = b.addRunArtifact(marin);
run_cmd.step.dependOn(b.getInstallStep());
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}