-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.zig
38 lines (35 loc) · 1.24 KB
/
build.zig
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
const std = @import("std");
pub fn build(b: *std.Build) void {
const upstream = b.dependency("lz4", .{});
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode") orelse .static;
const strip = b.option(bool, "strip", "Omit debug information");
const pic = b.option(bool, "pie", "Produce Position Independent Code");
const lz4 = b.addLibrary(.{
.linkage = linkage,
.name = "lz4",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.pic = pic,
.strip = strip,
.link_libc = true,
}),
});
b.installArtifact(lz4);
lz4.root_module.addIncludePath(upstream.path("lib"));
lz4.installHeader(upstream.path("lib/lz4.h"), "lz4/lz4.h");
lz4.installHeader(upstream.path("lib/lz4hc.h"), "lz4/lz4hc.h");
lz4.installHeader(upstream.path("lib/lz4frame.h"), "lz4/lz4frame.h");
lz4.root_module.addCSourceFiles(.{
.root = upstream.path("lib"),
.files = &.{
"lz4.c",
"lz4file.c",
"lz4frame.c",
"lz4hc.c",
"xxhash.c",
},
});
}