Repository navigation
Expand file tree
/
Copy pathbuild.zig
More file actions
53 lines (47 loc) · 2.45 KB
/
Copy pathbuild.zig
File metadata and controls
53 lines (47 loc) · 2.45 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
43
44
45
46
47
48
49
50
51
52
53
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
const cflags = [_][]const u8{ "-Wall", "-Wextra", "-Werror=return-type", "-std=gnu11", "-O2" };
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("olaf_c", null);
if (target.getCpuArch() == .wasm32 and target.getOsTag() == .wasi) {
exe.addCSourceFile("src/hash-table.c", &cflags);
exe.addCSourceFile("src/pffft.c", &cflags);
exe.addCSourceFile("src/olaf.c", &cflags);
exe.addCSourceFile("src/olaf_config.c", &cflags);
exe.addCSourceFile("src/olaf_db_mem.c", &cflags);
exe.addCSourceFile("src/olaf_ep_extractor.c", &cflags);
exe.addCSourceFile("src/olaf_fp_db_writer.c", &cflags);
exe.addCSourceFile("src/olaf_fp_extractor.c", &cflags);
exe.addCSourceFile("src/olaf_fp_matcher.c", &cflags);
exe.addCSourceFile("src/olaf_reader_stream.c", &cflags);
exe.addCSourceFile("src/olaf_runner.c", &cflags);
exe.addCSourceFile("src/olaf_stream_processor.c", &cflags);
exe.linkLibC();
} else {
exe.addCSourceFile("src/hash-table.c", &cflags);
exe.addCSourceFile("src/mdb.c", &cflags);
exe.addCSourceFile("src/midl.c", &cflags);
exe.addCSourceFile("src/pffft.c", &cflags);
exe.addCSourceFile("src/olaf.c", &cflags);
exe.addCSourceFile("src/olaf_config.c", &cflags);
exe.addCSourceFile("src/olaf_db.c", &cflags);
exe.addCSourceFile("src/olaf_ep_extractor.c", &cflags);
exe.addCSourceFile("src/olaf_fp_db_writer.c", &cflags);
exe.addCSourceFile("src/olaf_fp_extractor.c", &cflags);
exe.addCSourceFile("src/olaf_fp_matcher.c", &cflags);
exe.addCSourceFile("src/olaf_reader_stream.c", &cflags);
exe.addCSourceFile("src/olaf_runner.c", &cflags);
exe.addCSourceFile("src/olaf_stream_processor.c", &cflags);
exe.linkLibC();
}
exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();
}