mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
parent
bbad0fa411
commit
bea9e9c7f8
@ -1627,6 +1627,7 @@ pub const TestStep = struct {
|
||||
filter: ?[]const u8,
|
||||
target: Target,
|
||||
exec_cmd_args: ?[]const ?[]const u8,
|
||||
include_dirs: ArrayList([]const u8),
|
||||
|
||||
pub fn init(builder: &Builder, root_src: []const u8) TestStep {
|
||||
const step_name = builder.fmt("test {}", root_src);
|
||||
@ -1641,6 +1642,7 @@ pub const TestStep = struct {
|
||||
.link_libs = BufSet.init(builder.allocator),
|
||||
.target = Target { .Native = {} },
|
||||
.exec_cmd_args = null,
|
||||
.include_dirs = ArrayList([]const u8).init(builder.allocator),
|
||||
};
|
||||
}
|
||||
|
||||
@ -1648,6 +1650,10 @@ pub const TestStep = struct {
|
||||
self.verbose = value;
|
||||
}
|
||||
|
||||
pub fn addIncludeDir(self: &TestStep, path: []const u8) void {
|
||||
self.include_dirs.append(path) catch unreachable;
|
||||
}
|
||||
|
||||
pub fn setBuildMode(self: &TestStep, mode: builtin.Mode) void {
|
||||
self.build_mode = mode;
|
||||
}
|
||||
@ -1746,6 +1752,11 @@ pub const TestStep = struct {
|
||||
}
|
||||
}
|
||||
|
||||
for (self.include_dirs.toSliceConst()) |include_path| {
|
||||
try zig_args.append("-isystem");
|
||||
try zig_args.append(builder.pathFromRoot(include_path));
|
||||
}
|
||||
|
||||
for (builder.include_paths.toSliceConst()) |include_path| {
|
||||
try zig_args.append("-isystem");
|
||||
try zig_args.append(builder.pathFromRoot(include_path));
|
||||
|
@ -1,6 +1,6 @@
|
||||
const Builder = @import("std").build.Builder;
|
||||
|
||||
pub fn build(b: &Builder) !void {
|
||||
pub fn build(b: &Builder) void {
|
||||
const mode = b.standardReleaseOptions();
|
||||
const exe = b.addExecutable("YOUR_NAME_HERE", "src/main.zig");
|
||||
exe.setBuildMode(mode);
|
||||
|
Loading…
Reference in New Issue
Block a user