1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule("typdown", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const lib = b.addLibrary(.{
.name = "typdown",
.linkage = .dynamic,
.root_module = mod,
});
const installed_lib = b.addInstallArtifact(lib, .{});
// when emitting headers will be fixed
//installed_lib.emitted_h = lib.getEmittedH();
const example = b.addExecutable(.{
.name = "example",
.root_module = b.createModule(.{
.link_libc = true,
.target = target,
.optimize = optimize,
}),
});
example.root_module.addCSourceFile(.{
.file = b.path("examples/main.c"),
});
example.root_module.linkLibrary(lib);
example.root_module.addIncludePath(b.path("include"));
b.getInstallStep().dependOn(&installed_lib.step);
const mod_tests = b.addTest(.{
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
const examples_step = b.step("examples", "Run examples");
examples_step.dependOn(&installed_lib.step);
const example_run = b.addRunArtifact(example);
examples_step.dependOn(&example_run.step);
}
|