mirror of
https://github.com/ziglang/zig.git
synced 2025-12-27 00:23:22 +00:00
New API introduced: std.Build.addModule This function exposes a zig module with the given name, which can be used by packages that depend on this one via std.Build.Dependency.module. std.Build.Pkg and related functionality is deleted. Every use case has a straightforward upgrade path using the new Module struct. std.Build.OptionsStep.getPackage is replaced by std.Build.OptionsStep.createModule. std.Build.CompileStep.addPackagePath is replaced by std.Build.CompileStep.addAnonymousModule. This partially addresses #14307 by renaming some of the instances of "package" to "module". Closes #14278
18 lines
464 B
Zig
18 lines
464 B
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "test",
|
|
.root_source_file = .{ .path = "test.zig" },
|
|
.optimize = optimize,
|
|
});
|
|
exe.addAnonymousModule("my_pkg", .{ .source_file = .{ .path = "pkg.zig" } });
|
|
|
|
const run = exe.run();
|
|
|
|
const test_step = b.step("test", "Test it");
|
|
test_step.dependOn(&run.step);
|
|
}
|