master
1const std = @import("std");
2
3pub fn build(b: *std.Build) void {
4 const target = b.standardTargetOptions(.{});
5 const optimize = b.standardOptimizeOption(.{});
6
7 const shared_mod = b.createModule(.{
8 .root_source_file = b.path("mod.zig"),
9 .target = target,
10 .optimize = optimize,
11 });
12 const lib_mod = b.createModule(.{
13 .root_source_file = b.path("lib.zig"),
14 .target = target,
15 .optimize = optimize,
16 });
17 const exe_mod = b.createModule(.{
18 .root_source_file = b.path("main.zig"),
19 .target = target,
20 .optimize = optimize,
21 });
22
23 lib_mod.addImport("mod", shared_mod);
24 exe_mod.addImport("mod", shared_mod);
25
26 const lib = b.addLibrary(.{
27 .linkage = .static,
28 .name = "lib",
29 .root_module = lib_mod,
30 });
31
32 exe_mod.linkLibrary(lib);
33
34 const exe = b.addExecutable(.{
35 .name = "app",
36 .root_module = exe_mod,
37 });
38
39 b.installArtifact(exe);
40}