init
This commit is contained in:
34
build.zig
34
build.zig
@@ -58,31 +58,29 @@ pub fn build(b: *std.Build) void {
|
||||
// If neither case applies to you, feel free to delete the declaration you
|
||||
// don't need and to put everything under a single module.
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "zig_template",
|
||||
.name = "reader",
|
||||
.root_module = b.createModule(.{
|
||||
// b.createModule defines a new module just like b.addModule but,
|
||||
// unlike b.addModule, it does not expose the module to consumers of
|
||||
// this package, which is why in this case we don't have to give it a name.
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
// Target and optimization levels must be explicitly wired in when
|
||||
// defining an executable or library (in the root module), and you
|
||||
// can also hardcode a specific target for an executable or library
|
||||
// definition if desireable (e.g. firmware for embedded devices).
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
// List of modules available for import in source files part of the
|
||||
// root module.
|
||||
.imports = &.{
|
||||
// Here "zig_template" is the name you will use in your source code to
|
||||
// import this module (e.g. `@import("zig_template")`). The name is
|
||||
// repeated because you are allowed to rename your imports, which
|
||||
// can be extremely useful in case of collisions (which can happen
|
||||
// importing modules from different packages).
|
||||
.{ .name = "zig_template", .module = mod },
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
// Select the right pre-compiled libltkc static archive for the target arch.
|
||||
const arch_suffix: []const u8 = switch (target.result.cpu.arch) {
|
||||
.x86_64 => "x86_64",
|
||||
.x86 => "x86",
|
||||
.arm, .armeb, .thumb, .thumbeb => "armv7l",
|
||||
else => @panic("unsupported target architecture for libltkc vendor libs"),
|
||||
};
|
||||
exe.root_module.addIncludePath(b.path("vendor/libltkc"));
|
||||
exe.addObjectFile(b.path(b.fmt("vendor/libltkc/libltkc_{s}.a", .{arch_suffix})));
|
||||
exe.addObjectFile(b.path(b.fmt("vendor/libltkc/libltkcimpinj_{s}.a", .{arch_suffix})));
|
||||
exe.addObjectFile(b.path(b.fmt("vendor/libltkc/libxml2_{s}.a", .{arch_suffix})));
|
||||
exe.linkSystemLibrary("ssl");
|
||||
exe.linkSystemLibrary("crypto");
|
||||
exe.linkLibC();
|
||||
|
||||
// This declares intent for the executable to be installed into the
|
||||
// install prefix when running `zig build` (i.e. when executing the default
|
||||
// step). By default the install prefix is `zig-out/` but can be overridden
|
||||
|
||||
Reference in New Issue
Block a user