-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.zig
75 lines (64 loc) · 2.29 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const std = @import("std");
const Target = std.Target;
const CrossTarget = std.zig.CrossTarget;
pub fn build(b: *std.build.Builder) void {
// Standard release options allow the person running `zig build` to select
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
const mode = b.standardReleaseOptions();
const target = CrossTarget{
.cpu_arch = Target.Cpu.Arch.arm,
.os_tag = Target.Os.Tag.linux,
.abi = Target.Abi.musleabihf,
};
const exif = b.addStaticLibrary("exif", null);
exif.setTarget(target);
exif.setBuildMode(mode);
exif.linkLibC();
exif.addIncludeDir("packages/c");
exif.addCSourceFiles(&.{
"packages/c/libexif/exif-data.c",
"packages/c/libexif/exif-utils.c",
"packages/c/libexif/exif-format.c",
"packages/c/libexif/exif-content.c",
"packages/c/libexif/exif-loader.c",
"packages/c/libexif/exif-mnote-data.c",
"packages/c/libexif/exif-entry.c",
"packages/c/libexif/exif-gps-ifd.c",
"packages/c/libexif/exif-tag.c",
"packages/c/libexif/exif-ifd.c",
"packages/c/libexif/exif-log.c",
"packages/c/libexif/exif-mem.c",
}, &.{
"-Wall",
"-W",
"-Wstrict-prototypes",
"-Wwrite-strings",
"-Wno-missing-field-initializers",
});
const exe = b.addExecutable("capable_camera_firmware", "src/main.zig");
exe.linkSystemLibrary("c");
exe.linkLibrary(exif);
exe.addIncludeDir("packages/c");
exe.addPackagePath("zhp", "packages/zhp/src/zhp.zig");
exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();
const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
const bench_exe = b.addExecutable("benchmark", "src/benchmark.zig");
bench_exe.setTarget(target);
bench_exe.setBuildMode(mode);
bench_exe.install();
const bench_run_cmd = bench_exe.run();
bench_run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
bench_run_cmd.addArgs(args);
}
const bench_run_step = b.step("run-bench", "Run benchmark tool");
bench_run_step.dependOn(&bench_run_cmd.step);
}