-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathbuild.zig
More file actions
42 lines (31 loc) · 1.01 KB
/
build.zig
File metadata and controls
42 lines (31 loc) · 1.01 KB
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
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const t = target.result;
const copts: []const []const u8 =
b.option([]const []const u8, "copt", "") orelse &.{};
var flags = std.array_list.Managed([]const u8).init(b.allocator);
defer flags.deinit();
try flags.appendSlice(&.{
"-pedantic",
"-std=gnu99",
});
try flags.appendSlice(copts);
const pkg_ent = b.addLibrary(.{
.name = "ent",
.root_module = b.createModule(.{ .target = target, .optimize = optimize }),
});
pkg_ent.linkLibC();
pkg_ent.addIncludePath(b.path(""));
pkg_ent.addCSourceFiles(.{
.root = b.path(""),
.files = &.{"ent.c"},
.flags = flags.items,
});
pkg_ent.installHeader(b.path("ent.h"), "ent/ent.h");
if (t.os.tag == .windows) {
pkg_ent.linkSystemLibrary("bcrypt");
}
b.installArtifact(pkg_ent);
}