working enet connection

This commit is contained in:
David Allemang
2024-03-05 17:23:32 -05:00
parent bd05dae216
commit e9663d62fa
4 changed files with 59 additions and 5 deletions

View File

@@ -2,7 +2,6 @@ const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const enet_real = b.dependency("enet_real", .{});
@@ -11,6 +10,7 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
.link_libc = true,
.sanitize_c = false,
});
enet.addCSourceFiles(.{
.root = enet_real.path(""),
@@ -30,7 +30,7 @@ pub fn build(b: *std.Build) void {
const client = b.addExecutable(.{
.name = "client",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = .{ .path = "src/client.zig" },
.target = target,
.optimize = optimize,
});
@@ -39,7 +39,7 @@ pub fn build(b: *std.Build) void {
const server = b.addExecutable(.{
.name = "server",
.root_source_file = .{ .path = "src/main.zig" },
.root_source_file = .{ .path = "src/server.zig" },
.target = target,
.optimize = optimize,
});
@@ -66,13 +66,13 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
client.root_module.addImport("enet", enet);
client_tests.root_module.addImport("enet", enet);
const server_tests = b.addTest(.{
.root_source_file = .{ .path = "src/server.zig" },
.target = target,
.optimize = optimize,
});
server.root_module.addImport("enet", enet);
server_tests.root_module.addImport("enet", enet);
const run_client_tests = b.addRunArtifact(client_tests);
const run_server_tests = b.addRunArtifact(server_tests);