46 lines
1.1 KiB
Zig
46 lines
1.1 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const enet_src = b.dependency("enet_src", .{});
|
|
|
|
const lib = b.addLibrary(.{
|
|
.name = "enet",
|
|
.linkage = .static,
|
|
.root_module = b.createModule(.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
});
|
|
|
|
lib.root_module.addCSourceFiles(.{
|
|
.root = enet_src.path(""),
|
|
.files = &[_][]const u8{
|
|
"callbacks.c",
|
|
"compress.c",
|
|
"host.c",
|
|
"list.c",
|
|
"packet.c",
|
|
"peer.c",
|
|
"protocol.c",
|
|
"unix.c",
|
|
"win32.c",
|
|
},
|
|
});
|
|
|
|
|
|
if (target.result.os.tag == .windows) {
|
|
lib.root_module.linkSystemLibrary("ws2_32", .{});
|
|
lib.root_module.linkSystemLibrary("winmm", .{});
|
|
}
|
|
|
|
lib.root_module.addIncludePath(enet_src.path("include"));
|
|
lib.root_module.link_libc = true;
|
|
|
|
lib.installHeadersDirectory(enet_src.path("include/enet"), "enet", .{});
|
|
|
|
b.installArtifact(lib);
|
|
}
|