/ build.zig
build.zig
 1  const std = @import("std");
 2  
 3  pub fn build(b: *std.Build) void {
 4      const circle_sources = [_][]const u8{
 5          "act.comm.c",
 6          "act.informative.c",
 7          "act.item.c",
 8          "act.movement.c",
 9          "act.offensive.c",
10          "act.other.c",
11          "act.social.c",
12          "act.wizard.c",
13          "alias.c",
14          "ban.c",
15          "boards.c",
16          "bsd-snprintf.c",
17          "castle.c",
18          "class.c",
19          "comm.c",
20          "config.c",
21          "constants.c",
22          "db.c",
23          "fight.c",
24          "graph.c",
25          "handler.c",
26          "house.c",
27          "interpreter.c",
28          "limits.c",
29          "magic.c",
30          "mail.c",
31          "mobact.c",
32          "modify.c",
33          "objsave.c",
34          "olc.c",
35          "random.c",
36          "shop.c",
37          "spec_assign.c",
38          "spec_procs.c",
39          "spell_parser.c",
40          "spells.c",
41          "utils.c",
42          "weather.c",
43      };
44  
45      const target = b.standardTargetOptions(.{});
46      const optimize = b.standardOptimizeOption(.{});
47  
48      const circle = b.addExecutable(.{
49          .name = "circle",
50          .root_module = b.createModule(.{
51              .target = target,
52              .optimize = optimize,
53          }),
54      });
55  
56      const loopMUD = b.addExecutable(.{
57          .name = "loopMUD",
58          .root_module = b.createModule(.{
59              .root_source_file = b.path("src/main.zig"),
60              .target = target,
61              .optimize = optimize,
62          }),
63      });
64  
65      circle.addCSourceFiles(.{
66          .root = b.path("circle3.1/src"),
67          .files = &circle_sources,
68      });
69  
70      circle.linkSystemLibrary("crypt");
71      circle.linkLibC();
72  
73      b.installArtifact(circle);
74      b.installArtifact(loopMUD);
75  
76      const zio = b.dependency("zio", .{
77          .target = target,
78          .optimize = optimize,
79      });
80  
81      loopMUD.root_module.addImport("zio", zio.module("zio"));
82  
83      const clean_step = b.step("clean", "Clean up");
84      clean_step.dependOn(&b.addRemoveDirTree(b.path("zig-out")).step);
85      clean_step.dependOn(&b.addRemoveDirTree(b.path(".zig-cache")).step);
86  }