-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnappy_lib.zig
53 lines (48 loc) · 1.39 KB
/
snappy_lib.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const std = @import("std");
pub fn configure(
comptime basedir: []const u8,
comptime dep_dirs: anytype,
comptime root_dep_dirs: anytype,
allocator: std.mem.Allocator,
lib: *std.build.LibExeObjStep,
target: std.zig.CrossTarget,
mode: std.builtin.Mode,
) *std.build.LibExeObjStep {
_ = root_dep_dirs;
_ = allocator;
lib.setTarget(target);
lib.setBuildMode(mode);
lib.linkLibC();
lib.linkLibCpp();
lib.addIncludeDir(basedir ++ "/include");
lib.addIncludeDir(dep_dirs.get("zpp").? ++ "/include");
lib.addIncludeDir(basedir ++ "/snappy");
switch (target.getOsTag()) {
.windows => {
lib.addIncludeDir(basedir ++ "/snappy/platform-include/win");
},
.macos => {
lib.addIncludeDir(basedir ++ "/snappy/platform-include/mac");
},
else => {
lib.addIncludeDir(basedir ++ "/snappy/platform-include/linux");
}
}
lib.addCSourceFiles(&.{
basedir ++ "/src/lib.cpp",
basedir ++ "/snappy/snappy-c.cc",
basedir ++ "/snappy/snappy-sinksource.cc",
basedir ++ "/snappy/snappy-stubs-internal.cc",
basedir ++ "/snappy/snappy.cc",
}, &.{
"-std=c++14",
"-Wall",
"-Wextra",
"-Werror",
"-fno-exceptions",
"-fno-rtti",
"-DNDEBUG",
"-DHAVE_CONFIG_H=1",
});
return lib;
}