Build.zig: small fix (useless import list).
This commit is contained in:
parent
4273f96573
commit
670d0ac9f3
1 changed files with 13 additions and 19 deletions
32
build.zig
32
build.zig
|
|
@ -42,7 +42,7 @@ pub fn build(b: *std.Build) void {
|
|||
});
|
||||
|
||||
// Compile libipc as a static library with C bindings.
|
||||
const lib_static_c = b.addLibrary(.{
|
||||
const static_lib = b.addLibrary(.{
|
||||
.name = "ipc", // name of the library
|
||||
.linkage = .static,
|
||||
.root_module = b.createModule(.{
|
||||
|
|
@ -52,11 +52,11 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
// Tell the compiler we need libc.
|
||||
lib_static_c.root_module.link_libc = true;
|
||||
b.installArtifact(lib_static_c);
|
||||
static_lib.root_module.link_libc = true;
|
||||
b.installArtifact(static_lib);
|
||||
|
||||
// Compile libipc as a dynamic library with C bindings.
|
||||
const lib_dynamic_c = b.addLibrary(.{
|
||||
const dynamic_lib = b.addLibrary(.{
|
||||
.name = "ipc", // name of the library
|
||||
.linkage = .dynamic,
|
||||
.version = .{ .major = 0, .minor = 2, .patch = 3 },
|
||||
|
|
@ -67,8 +67,8 @@ pub fn build(b: *std.Build) void {
|
|||
}),
|
||||
});
|
||||
// Tell the compiler we need libc.
|
||||
lib_dynamic_c.root_module.link_libc = true;
|
||||
b.installArtifact(lib_dynamic_c);
|
||||
dynamic_lib.root_module.link_libc = true;
|
||||
b.installArtifact(dynamic_lib);
|
||||
|
||||
// pong service using the c client.
|
||||
const pong_with_c_bindings = b.addExecutable(.{
|
||||
|
|
@ -80,16 +80,10 @@ pub fn build(b: *std.Build) void {
|
|||
.root_source_file = b.path("src/examples/pong-with-c-bindings.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
// List of modules available for import in source files part of the
|
||||
// root module.
|
||||
.imports = &.{
|
||||
// Here "ipc" is the name you will use in your source code to
|
||||
// import this module (e.g. `@import("ipc")`). 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 = "ipc", .module = mod },
|
||||
},
|
||||
|
||||
// There is no list of modules to import since the application
|
||||
// uses `libipc.h` to type-check the API then it is statically
|
||||
// linked to libipc (see `linkLibrary(static_lib)`).
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -99,15 +93,15 @@ pub fn build(b: *std.Build) void {
|
|||
// by passing `--prefix` or `-p`.
|
||||
b.installArtifact(pong_with_c_bindings);
|
||||
|
||||
// Link the executable to the library.
|
||||
pong_with_c_bindings.linkLibrary(lib_static_c);
|
||||
// Statically link the executable to the library.
|
||||
pong_with_c_bindings.linkLibrary(static_lib);
|
||||
|
||||
// This creates a top level step. Top level steps have a name and can be
|
||||
// invoked by name when running `zig build` (e.g. `zig build run`).
|
||||
// This will evaluate the `run` step rather than the default step.
|
||||
// For a top level step to actually do something, it must depend on other
|
||||
// steps (e.g. a Run step, as we will see in a moment).
|
||||
const run_step = b.step("run", "Run the app");
|
||||
const run_step = b.step("run-pong", "Run the pong client");
|
||||
|
||||
// This creates a RunArtifact step in the build graph. A RunArtifact step
|
||||
// invokes an executable compiled by Zig. Steps will only be executed by the
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue