mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
combine std.build and std.build.Builder into std.Build
I've been wanting to do this for along time.
This commit is contained in:
parent
73cf7b6429
commit
36e2d992dd
31
build.zig
31
build.zig
@ -1,19 +1,18 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = std.builtin;
|
const builtin = std.builtin;
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const tests = @import("test/tests.zig");
|
const tests = @import("test/tests.zig");
|
||||||
const BufMap = std.BufMap;
|
const BufMap = std.BufMap;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
const io = std.io;
|
const io = std.io;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const InstallDirectoryOptions = std.build.InstallDirectoryOptions;
|
const InstallDirectoryOptions = std.Build.InstallDirectoryOptions;
|
||||||
const assert = std.debug.assert;
|
const assert = std.debug.assert;
|
||||||
|
|
||||||
const zig_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
|
const zig_version = std.builtin.Version{ .major = 0, .minor = 11, .patch = 0 };
|
||||||
const stack_size = 32 * 1024 * 1024;
|
const stack_size = 32 * 1024 * 1024;
|
||||||
|
|
||||||
pub fn build(b: *Builder) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const release = b.option(bool, "release", "Build in release mode") orelse false;
|
const release = b.option(bool, "release", "Build in release mode") orelse false;
|
||||||
const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false;
|
const only_c = b.option(bool, "only-c", "Translate the Zig compiler to C code, with only the C backend enabled") orelse false;
|
||||||
const target = t: {
|
const target = t: {
|
||||||
@ -477,7 +476,7 @@ pub fn build(b: *Builder) !void {
|
|||||||
try addWasiUpdateStep(b, version);
|
try addWasiUpdateStep(b, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn addWasiUpdateStep(b: *Builder, version: [:0]const u8) !void {
|
fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
|
||||||
const semver = try std.SemanticVersion.parse(version);
|
const semver = try std.SemanticVersion.parse(version);
|
||||||
|
|
||||||
var target: std.zig.CrossTarget = .{
|
var target: std.zig.CrossTarget = .{
|
||||||
@ -514,10 +513,10 @@ fn addWasiUpdateStep(b: *Builder, version: [:0]const u8) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn addCompilerStep(
|
fn addCompilerStep(
|
||||||
b: *Builder,
|
b: *std.Build,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
target: std.zig.CrossTarget,
|
target: std.zig.CrossTarget,
|
||||||
) *std.build.LibExeObjStep {
|
) *std.Build.LibExeObjStep {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "zig",
|
.name = "zig",
|
||||||
.root_source_file = .{ .path = "src/main.zig" },
|
.root_source_file = .{ .path = "src/main.zig" },
|
||||||
@ -543,9 +542,9 @@ const exe_cflags = [_][]const u8{
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn addCmakeCfgOptionsToExe(
|
fn addCmakeCfgOptionsToExe(
|
||||||
b: *Builder,
|
b: *std.Build,
|
||||||
cfg: CMakeConfig,
|
cfg: CMakeConfig,
|
||||||
exe: *std.build.LibExeObjStep,
|
exe: *std.Build.LibExeObjStep,
|
||||||
use_zig_libcxx: bool,
|
use_zig_libcxx: bool,
|
||||||
) !void {
|
) !void {
|
||||||
if (exe.target.isDarwin()) {
|
if (exe.target.isDarwin()) {
|
||||||
@ -624,7 +623,7 @@ fn addCmakeCfgOptionsToExe(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn addStaticLlvmOptionsToExe(exe: *std.build.LibExeObjStep) !void {
|
fn addStaticLlvmOptionsToExe(exe: *std.Build.LibExeObjStep) !void {
|
||||||
// Adds the Zig C++ sources which both stage1 and stage2 need.
|
// Adds the Zig C++ sources which both stage1 and stage2 need.
|
||||||
//
|
//
|
||||||
// We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
|
// We need this because otherwise zig_clang_cc1_main.cpp ends up pulling
|
||||||
@ -661,9 +660,9 @@ fn addStaticLlvmOptionsToExe(exe: *std.build.LibExeObjStep) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn addCxxKnownPath(
|
fn addCxxKnownPath(
|
||||||
b: *Builder,
|
b: *std.Build,
|
||||||
ctx: CMakeConfig,
|
ctx: CMakeConfig,
|
||||||
exe: *std.build.LibExeObjStep,
|
exe: *std.Build.LibExeObjStep,
|
||||||
objname: []const u8,
|
objname: []const u8,
|
||||||
errtxt: ?[]const u8,
|
errtxt: ?[]const u8,
|
||||||
need_cpp_includes: bool,
|
need_cpp_includes: bool,
|
||||||
@ -696,7 +695,7 @@ fn addCxxKnownPath(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void {
|
fn addCMakeLibraryList(exe: *std.Build.LibExeObjStep, list: []const u8) void {
|
||||||
var it = mem.tokenize(u8, list, ";");
|
var it = mem.tokenize(u8, list, ";");
|
||||||
while (it.next()) |lib| {
|
while (it.next()) |lib| {
|
||||||
if (mem.startsWith(u8, lib, "-l")) {
|
if (mem.startsWith(u8, lib, "-l")) {
|
||||||
@ -710,7 +709,7 @@ fn addCMakeLibraryList(exe: *std.build.LibExeObjStep, list: []const u8) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CMakeConfig = struct {
|
const CMakeConfig = struct {
|
||||||
llvm_linkage: std.build.LibExeObjStep.Linkage,
|
llvm_linkage: std.Build.LibExeObjStep.Linkage,
|
||||||
cmake_binary_dir: []const u8,
|
cmake_binary_dir: []const u8,
|
||||||
cmake_prefix_path: []const u8,
|
cmake_prefix_path: []const u8,
|
||||||
cmake_static_library_prefix: []const u8,
|
cmake_static_library_prefix: []const u8,
|
||||||
@ -727,7 +726,7 @@ const CMakeConfig = struct {
|
|||||||
|
|
||||||
const max_config_h_bytes = 1 * 1024 * 1024;
|
const max_config_h_bytes = 1 * 1024 * 1024;
|
||||||
|
|
||||||
fn findConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?[]const u8 {
|
fn findConfigH(b: *std.Build, config_h_path_option: ?[]const u8) ?[]const u8 {
|
||||||
if (config_h_path_option) |path| {
|
if (config_h_path_option) |path| {
|
||||||
var config_h_or_err = fs.cwd().openFile(path, .{});
|
var config_h_or_err = fs.cwd().openFile(path, .{});
|
||||||
if (config_h_or_err) |*file| {
|
if (config_h_or_err) |*file| {
|
||||||
@ -773,7 +772,7 @@ fn findConfigH(b: *Builder, config_h_path_option: ?[]const u8) ?[]const u8 {
|
|||||||
} else unreachable; // TODO should not need `else unreachable`.
|
} else unreachable; // TODO should not need `else unreachable`.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig {
|
fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {
|
||||||
var ctx: CMakeConfig = .{
|
var ctx: CMakeConfig = .{
|
||||||
.llvm_linkage = undefined,
|
.llvm_linkage = undefined,
|
||||||
.cmake_binary_dir = undefined,
|
.cmake_binary_dir = undefined,
|
||||||
@ -862,7 +861,7 @@ fn parseConfigH(b: *Builder, config_h_text: []const u8) ?CMakeConfig {
|
|||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn toNativePathSep(b: *Builder, s: []const u8) []u8 {
|
fn toNativePathSep(b: *std.Build, s: []const u8) []u8 {
|
||||||
const duplicated = b.allocator.dupe(u8, s) catch unreachable;
|
const duplicated = b.allocator.dupe(u8, s) catch unreachable;
|
||||||
for (duplicated) |*byte| switch (byte.*) {
|
for (duplicated) |*byte| switch (byte.*) {
|
||||||
'/' => byte.* = fs.path.sep,
|
'/' => byte.* = fs.path.sep,
|
||||||
|
|||||||
@ -9528,9 +9528,9 @@ fn foo(comptime T: type, ptr: *T) T {
|
|||||||
To add standard build options to a <code class="file">build.zig</code> file:
|
To add standard build options to a <code class="file">build.zig</code> file:
|
||||||
</p>
|
</p>
|
||||||
{#code_begin|syntax|build#}
|
{#code_begin|syntax|build#}
|
||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "example",
|
.name = "example",
|
||||||
@ -10551,9 +10551,9 @@ const separator = if (builtin.os.tag == .windows) '\\' else '/';
|
|||||||
<p>This <code class="file">build.zig</code> file is automatically generated
|
<p>This <code class="file">build.zig</code> file is automatically generated
|
||||||
by <kbd>zig init-exe</kbd>.</p>
|
by <kbd>zig init-exe</kbd>.</p>
|
||||||
{#code_begin|syntax|build_executable#}
|
{#code_begin|syntax|build_executable#}
|
||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// what target to build for. Here we do not override the defaults, which
|
||||||
// means any target is allowed, and the default is native. Other options
|
// means any target is allowed, and the default is native. Other options
|
||||||
@ -10588,9 +10588,9 @@ pub fn build(b: *Builder) void {
|
|||||||
<p>This <code class="file">build.zig</code> file is automatically generated
|
<p>This <code class="file">build.zig</code> file is automatically generated
|
||||||
by <kbd>zig init-lib</kbd>.</p>
|
by <kbd>zig init-lib</kbd>.</p>
|
||||||
{#code_begin|syntax|build_library#}
|
{#code_begin|syntax|build_library#}
|
||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const lib = b.addStaticLibrary(.{
|
const lib = b.addStaticLibrary(.{
|
||||||
.name = "example",
|
.name = "example",
|
||||||
@ -10961,9 +10961,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
{#end_syntax_block#}
|
{#end_syntax_block#}
|
||||||
{#code_begin|syntax|build_c#}
|
{#code_begin|syntax|build_c#}
|
||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const lib = b.addSharedLibrary("mathtest", "mathtest.zig", b.version(1, 0, 0));
|
const lib = b.addSharedLibrary("mathtest", "mathtest.zig", b.version(1, 0, 0));
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
@ -11025,9 +11025,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
{#end_syntax_block#}
|
{#end_syntax_block#}
|
||||||
{#code_begin|syntax|build_object#}
|
{#code_begin|syntax|build_object#}
|
||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const obj = b.addObject("base64", "base64.zig");
|
const obj = b.addObject("base64", "base64.zig");
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
|
|||||||
@ -3,7 +3,6 @@ const std = @import("std");
|
|||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const io = std.io;
|
const io = std.io;
|
||||||
const fmt = std.fmt;
|
const fmt = std.fmt;
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const process = std.process;
|
const process = std.process;
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
@ -42,7 +41,7 @@ pub fn main() !void {
|
|||||||
return error.InvalidArgs;
|
return error.InvalidArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
const builder = try Builder.create(
|
const builder = try std.Build.create(
|
||||||
allocator,
|
allocator,
|
||||||
zig_exe,
|
zig_exe,
|
||||||
build_root,
|
build_root,
|
||||||
@ -58,7 +57,7 @@ pub fn main() !void {
|
|||||||
const stdout_stream = io.getStdOut().writer();
|
const stdout_stream = io.getStdOut().writer();
|
||||||
|
|
||||||
var install_prefix: ?[]const u8 = null;
|
var install_prefix: ?[]const u8 = null;
|
||||||
var dir_list = Builder.DirList{};
|
var dir_list = std.Build.DirList{};
|
||||||
|
|
||||||
// before arg parsing, check for the NO_COLOR environment variable
|
// before arg parsing, check for the NO_COLOR environment variable
|
||||||
// if it exists, default the color setting to .off
|
// if it exists, default the color setting to .off
|
||||||
@ -230,7 +229,7 @@ pub fn main() !void {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void {
|
fn usage(builder: *std.Build, already_ran_build: bool, out_stream: anytype) !void {
|
||||||
// run the build script to collect the options
|
// run the build script to collect the options
|
||||||
if (!already_ran_build) {
|
if (!already_ran_build) {
|
||||||
builder.resolveInstallPrefix(null, .{});
|
builder.resolveInstallPrefix(null, .{});
|
||||||
@ -330,7 +329,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usageAndErr(builder: *Builder, already_ran_build: bool, out_stream: anytype) void {
|
fn usageAndErr(builder: *std.Build, already_ran_build: bool, out_stream: anytype) void {
|
||||||
usage(builder, already_ran_build, out_stream) catch {};
|
usage(builder, already_ran_build, out_stream) catch {};
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const std = @import("std");
|
|||||||
// Although this function looks imperative, note that its job is to
|
// Although this function looks imperative, note that its job is to
|
||||||
// declaratively construct a build graph that will be executed by an external
|
// declaratively construct a build graph that will be executed by an external
|
||||||
// runner.
|
// runner.
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// what target to build for. Here we do not override the defaults, which
|
||||||
// means any target is allowed, and the default is native. Other options
|
// means any target is allowed, and the default is native. Other options
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const std = @import("std");
|
|||||||
// Although this function looks imperative, note that its job is to
|
// Although this function looks imperative, note that its job is to
|
||||||
// declaratively construct a build graph that will be executed by an external
|
// declaratively construct a build graph that will be executed by an external
|
||||||
// runner.
|
// runner.
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
// Standard target options allows the person running `zig build` to choose
|
// Standard target options allows the person running `zig build` to choose
|
||||||
// what target to build for. Here we do not override the defaults, which
|
// what target to build for. Here we do not override the defaults, which
|
||||||
// means any target is allowed, and the default is native. Other options
|
// means any target is allowed, and the default is native. Other options
|
||||||
|
|||||||
1771
lib/std/Build.zig
Normal file
1771
lib/std/Build.zig
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,5 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = std.build;
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
|
||||||
const Builder = build.Builder;
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
|
|
||||||
@ -10,14 +8,14 @@ const CheckFileStep = @This();
|
|||||||
pub const base_id = .check_file;
|
pub const base_id = .check_file;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
expected_matches: []const []const u8,
|
expected_matches: []const []const u8,
|
||||||
source: build.FileSource,
|
source: std.Build.FileSource,
|
||||||
max_bytes: usize = 20 * 1024 * 1024,
|
max_bytes: usize = 20 * 1024 * 1024,
|
||||||
|
|
||||||
pub fn create(
|
pub fn create(
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
source: build.FileSource,
|
source: std.Build.FileSource,
|
||||||
expected_matches: []const []const u8,
|
expected_matches: []const []const u8,
|
||||||
) *CheckFileStep {
|
) *CheckFileStep {
|
||||||
const self = builder.allocator.create(CheckFileStep) catch unreachable;
|
const self = builder.allocator.create(CheckFileStep) catch unreachable;
|
||||||
@ -1,6 +1,5 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const assert = std.debug.assert;
|
const assert = std.debug.assert;
|
||||||
const build = std.build;
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const macho = std.macho;
|
const macho = std.macho;
|
||||||
const math = std.math;
|
const math = std.math;
|
||||||
@ -10,21 +9,20 @@ const testing = std.testing;
|
|||||||
const CheckObjectStep = @This();
|
const CheckObjectStep = @This();
|
||||||
|
|
||||||
const Allocator = mem.Allocator;
|
const Allocator = mem.Allocator;
|
||||||
const Builder = build.Builder;
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
const EmulatableRunStep = std.Build.EmulatableRunStep;
|
||||||
const EmulatableRunStep = build.EmulatableRunStep;
|
|
||||||
|
|
||||||
pub const base_id = .check_object;
|
pub const base_id = .check_object;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
source: build.FileSource,
|
source: std.Build.FileSource,
|
||||||
max_bytes: usize = 20 * 1024 * 1024,
|
max_bytes: usize = 20 * 1024 * 1024,
|
||||||
checks: std.ArrayList(Check),
|
checks: std.ArrayList(Check),
|
||||||
dump_symtab: bool = false,
|
dump_symtab: bool = false,
|
||||||
obj_format: std.Target.ObjectFormat,
|
obj_format: std.Target.ObjectFormat,
|
||||||
|
|
||||||
pub fn create(builder: *Builder, source: build.FileSource, obj_format: std.Target.ObjectFormat) *CheckObjectStep {
|
pub fn create(builder: *std.Build, source: std.Build.FileSource, obj_format: std.Target.ObjectFormat) *CheckObjectStep {
|
||||||
const gpa = builder.allocator;
|
const gpa = builder.allocator;
|
||||||
const self = gpa.create(CheckObjectStep) catch unreachable;
|
const self = gpa.create(CheckObjectStep) catch unreachable;
|
||||||
self.* = .{
|
self.* = .{
|
||||||
@ -44,7 +42,7 @@ pub fn runAndCompare(self: *CheckObjectStep) *EmulatableRunStep {
|
|||||||
const dependencies_len = self.step.dependencies.items.len;
|
const dependencies_len = self.step.dependencies.items.len;
|
||||||
assert(dependencies_len > 0);
|
assert(dependencies_len > 0);
|
||||||
const exe_step = self.step.dependencies.items[dependencies_len - 1];
|
const exe_step = self.step.dependencies.items[dependencies_len - 1];
|
||||||
const exe = exe_step.cast(std.build.LibExeObjStep).?;
|
const exe = exe_step.cast(std.Build.LibExeObjStep).?;
|
||||||
const emulatable_step = EmulatableRunStep.create(self.builder, "EmulatableRun", exe);
|
const emulatable_step = EmulatableRunStep.create(self.builder, "EmulatableRun", exe);
|
||||||
emulatable_step.step.dependOn(&self.step);
|
emulatable_step.step.dependOn(&self.step);
|
||||||
return emulatable_step;
|
return emulatable_step;
|
||||||
@ -216,10 +214,10 @@ const ComputeCompareExpected = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Check = struct {
|
const Check = struct {
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
actions: std.ArrayList(Action),
|
actions: std.ArrayList(Action),
|
||||||
|
|
||||||
fn create(b: *Builder) Check {
|
fn create(b: *std.Build) Check {
|
||||||
return .{
|
return .{
|
||||||
.builder = b,
|
.builder = b,
|
||||||
.actions = std.ArrayList(Action).init(b.allocator),
|
.actions = std.ArrayList(Action).init(b.allocator),
|
||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const ConfigHeaderStep = @This();
|
const ConfigHeaderStep = @This();
|
||||||
const Step = std.build.Step;
|
const Step = std.Build.Step;
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub const base_id: Step.Id = .config_header;
|
pub const base_id: Step.Id = .config_header;
|
||||||
|
|
||||||
@ -24,15 +23,15 @@ pub const Value = union(enum) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
source: std.build.FileSource,
|
source: std.Build.FileSource,
|
||||||
style: Style,
|
style: Style,
|
||||||
values: std.StringHashMap(Value),
|
values: std.StringHashMap(Value),
|
||||||
max_bytes: usize = 2 * 1024 * 1024,
|
max_bytes: usize = 2 * 1024 * 1024,
|
||||||
output_dir: []const u8,
|
output_dir: []const u8,
|
||||||
output_basename: []const u8,
|
output_basename: []const u8,
|
||||||
|
|
||||||
pub fn create(builder: *Builder, source: std.build.FileSource, style: Style) *ConfigHeaderStep {
|
pub fn create(builder: *std.Build, source: std.Build.FileSource, style: Style) *ConfigHeaderStep {
|
||||||
const self = builder.allocator.create(ConfigHeaderStep) catch @panic("OOM");
|
const self = builder.allocator.create(ConfigHeaderStep) catch @panic("OOM");
|
||||||
const name = builder.fmt("configure header {s}", .{source.getDisplayName()});
|
const name = builder.fmt("configure header {s}", .{source.getDisplayName()});
|
||||||
self.* = .{
|
self.* = .{
|
||||||
@ -5,11 +5,9 @@
|
|||||||
//! without having to verify if it's possible to be ran against.
|
//! without having to verify if it's possible to be ran against.
|
||||||
|
|
||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = std.build;
|
const Step = std.Build.Step;
|
||||||
const Step = std.build.Step;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const Builder = std.build.Builder;
|
const RunStep = std.Build.RunStep;
|
||||||
const LibExeObjStep = std.build.LibExeObjStep;
|
|
||||||
const RunStep = std.build.RunStep;
|
|
||||||
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const process = std.process;
|
const process = std.process;
|
||||||
@ -22,7 +20,7 @@ pub const base_id = .emulatable_run;
|
|||||||
const max_stdout_size = 1 * 1024 * 1024; // 1 MiB
|
const max_stdout_size = 1 * 1024 * 1024; // 1 MiB
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
|
|
||||||
/// The artifact (executable) to be run by this step
|
/// The artifact (executable) to be run by this step
|
||||||
exe: *LibExeObjStep,
|
exe: *LibExeObjStep,
|
||||||
@ -47,7 +45,7 @@ hide_foreign_binaries_warning: bool,
|
|||||||
/// binary through emulation when any of the emulation options such as `enable_rosetta` are set to true.
|
/// binary through emulation when any of the emulation options such as `enable_rosetta` are set to true.
|
||||||
/// When set to false, and the binary is foreign, running the executable is skipped.
|
/// When set to false, and the binary is foreign, running the executable is skipped.
|
||||||
/// Asserts given artifact is an executable.
|
/// Asserts given artifact is an executable.
|
||||||
pub fn create(builder: *Builder, name: []const u8, artifact: *LibExeObjStep) *EmulatableRunStep {
|
pub fn create(builder: *std.Build, name: []const u8, artifact: *LibExeObjStep) *EmulatableRunStep {
|
||||||
std.debug.assert(artifact.kind == .exe or artifact.kind == .test_exe);
|
std.debug.assert(artifact.kind == .exe or artifact.kind == .test_exe);
|
||||||
const self = builder.allocator.create(EmulatableRunStep) catch unreachable;
|
const self = builder.allocator.create(EmulatableRunStep) catch unreachable;
|
||||||
|
|
||||||
@ -1,19 +1,14 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
|
||||||
const Builder = build.Builder;
|
|
||||||
const BufMap = std.BufMap;
|
|
||||||
const mem = std.mem;
|
|
||||||
|
|
||||||
const FmtStep = @This();
|
const FmtStep = @This();
|
||||||
|
|
||||||
pub const base_id = .fmt;
|
pub const base_id = .fmt;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
argv: [][]const u8,
|
argv: [][]const u8,
|
||||||
|
|
||||||
pub fn create(builder: *Builder, paths: []const []const u8) *FmtStep {
|
pub fn create(builder: *std.Build, paths: []const []const u8) *FmtStep {
|
||||||
const self = builder.allocator.create(FmtStep) catch unreachable;
|
const self = builder.allocator.create(FmtStep) catch unreachable;
|
||||||
const name = "zig fmt";
|
const name = "zig fmt";
|
||||||
self.* = FmtStep{
|
self.* = FmtStep{
|
||||||
@ -1,26 +1,23 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const Builder = build.Builder;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const LibExeObjStep = std.build.LibExeObjStep;
|
const InstallArtifactStep = @This();
|
||||||
const InstallDir = std.build.InstallDir;
|
|
||||||
|
|
||||||
pub const base_id = .install_artifact;
|
pub const base_id = .install_artifact;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
artifact: *LibExeObjStep,
|
artifact: *LibExeObjStep,
|
||||||
dest_dir: InstallDir,
|
dest_dir: InstallDir,
|
||||||
pdb_dir: ?InstallDir,
|
pdb_dir: ?InstallDir,
|
||||||
h_dir: ?InstallDir,
|
h_dir: ?InstallDir,
|
||||||
|
|
||||||
const Self = @This();
|
pub fn create(builder: *std.Build, artifact: *LibExeObjStep) *InstallArtifactStep {
|
||||||
|
|
||||||
pub fn create(builder: *Builder, artifact: *LibExeObjStep) *Self {
|
|
||||||
if (artifact.install_step) |s| return s;
|
if (artifact.install_step) |s| return s;
|
||||||
|
|
||||||
const self = builder.allocator.create(Self) catch unreachable;
|
const self = builder.allocator.create(InstallArtifactStep) catch unreachable;
|
||||||
self.* = Self{
|
self.* = InstallArtifactStep{
|
||||||
.builder = builder,
|
.builder = builder,
|
||||||
.step = Step.init(.install_artifact, builder.fmt("install {s}", .{artifact.step.name}), builder.allocator, make),
|
.step = Step.init(.install_artifact, builder.fmt("install {s}", .{artifact.step.name}), builder.allocator, make),
|
||||||
.artifact = artifact,
|
.artifact = artifact,
|
||||||
@ -64,7 +61,7 @@ pub fn create(builder: *Builder, artifact: *LibExeObjStep) *Self {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step) !void {
|
fn make(step: *Step) !void {
|
||||||
const self = @fieldParentPtr(Self, "step", step);
|
const self = @fieldParentPtr(InstallArtifactStep, "step", step);
|
||||||
const builder = self.builder;
|
const builder = self.builder;
|
||||||
|
|
||||||
const full_dest_path = builder.getInstallPath(self.dest_dir, self.artifact.out_filename);
|
const full_dest_path = builder.getInstallPath(self.dest_dir, self.artifact.out_filename);
|
||||||
@ -1,19 +1,17 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const Builder = build.Builder;
|
|
||||||
const InstallDir = std.build.InstallDir;
|
|
||||||
const InstallDirStep = @This();
|
const InstallDirStep = @This();
|
||||||
const log = std.log;
|
const log = std.log;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
options: Options,
|
options: Options,
|
||||||
/// This is used by the build system when a file being installed comes from one
|
/// This is used by the build system when a file being installed comes from one
|
||||||
/// package but is being installed by another.
|
/// package but is being installed by another.
|
||||||
override_source_builder: ?*Builder = null,
|
override_source_builder: ?*std.Build = null,
|
||||||
|
|
||||||
pub const base_id = .install_dir;
|
pub const base_id = .install_dir;
|
||||||
|
|
||||||
@ -31,7 +29,7 @@ pub const Options = struct {
|
|||||||
/// `@import("test.zig")` would be a compile error.
|
/// `@import("test.zig")` would be a compile error.
|
||||||
blank_extensions: []const []const u8 = &.{},
|
blank_extensions: []const []const u8 = &.{},
|
||||||
|
|
||||||
fn dupe(self: Options, b: *Builder) Options {
|
fn dupe(self: Options, b: *std.Build) Options {
|
||||||
return .{
|
return .{
|
||||||
.source_dir = b.dupe(self.source_dir),
|
.source_dir = b.dupe(self.source_dir),
|
||||||
.install_dir = self.install_dir.dupe(b),
|
.install_dir = self.install_dir.dupe(b),
|
||||||
@ -43,7 +41,7 @@ pub const Options = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub fn init(
|
pub fn init(
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
options: Options,
|
options: Options,
|
||||||
) InstallDirStep {
|
) InstallDirStep {
|
||||||
builder.pushInstalledFile(options.install_dir, options.install_subdir);
|
builder.pushInstalledFile(options.install_dir, options.install_subdir);
|
||||||
@ -1,24 +1,22 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
const FileSource = std.Build.FileSource;
|
||||||
const Builder = build.Builder;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const FileSource = std.build.FileSource;
|
|
||||||
const InstallDir = std.build.InstallDir;
|
|
||||||
const InstallFileStep = @This();
|
const InstallFileStep = @This();
|
||||||
|
|
||||||
pub const base_id = .install_file;
|
pub const base_id = .install_file;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
source: FileSource,
|
source: FileSource,
|
||||||
dir: InstallDir,
|
dir: InstallDir,
|
||||||
dest_rel_path: []const u8,
|
dest_rel_path: []const u8,
|
||||||
/// This is used by the build system when a file being installed comes from one
|
/// This is used by the build system when a file being installed comes from one
|
||||||
/// package but is being installed by another.
|
/// package but is being installed by another.
|
||||||
override_source_builder: ?*Builder = null,
|
override_source_builder: ?*std.Build = null,
|
||||||
|
|
||||||
pub fn init(
|
pub fn init(
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
source: FileSource,
|
source: FileSource,
|
||||||
dir: InstallDir,
|
dir: InstallDir,
|
||||||
dest_rel_path: []const u8,
|
dest_rel_path: []const u8,
|
||||||
@ -7,11 +7,10 @@ const InstallRawStep = @This();
|
|||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
const ArenaAllocator = std.heap.ArenaAllocator;
|
const ArenaAllocator = std.heap.ArenaAllocator;
|
||||||
const ArrayListUnmanaged = std.ArrayListUnmanaged;
|
const ArrayListUnmanaged = std.ArrayListUnmanaged;
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const File = std.fs.File;
|
const File = std.fs.File;
|
||||||
const InstallDir = std.build.InstallDir;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const LibExeObjStep = std.build.LibExeObjStep;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const Step = std.build.Step;
|
const Step = std.Build.Step;
|
||||||
const elf = std.elf;
|
const elf = std.elf;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const io = std.io;
|
const io = std.io;
|
||||||
@ -25,12 +24,12 @@ pub const RawFormat = enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
artifact: *LibExeObjStep,
|
artifact: *LibExeObjStep,
|
||||||
dest_dir: InstallDir,
|
dest_dir: InstallDir,
|
||||||
dest_filename: []const u8,
|
dest_filename: []const u8,
|
||||||
options: CreateOptions,
|
options: CreateOptions,
|
||||||
output_file: std.build.GeneratedFile,
|
output_file: std.Build.GeneratedFile,
|
||||||
|
|
||||||
pub const CreateOptions = struct {
|
pub const CreateOptions = struct {
|
||||||
format: ?RawFormat = null,
|
format: ?RawFormat = null,
|
||||||
@ -39,7 +38,12 @@ pub const CreateOptions = struct {
|
|||||||
pad_to: ?u64 = null,
|
pad_to: ?u64 = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn create(builder: *Builder, artifact: *LibExeObjStep, dest_filename: []const u8, options: CreateOptions) *InstallRawStep {
|
pub fn create(
|
||||||
|
builder: *std.Build,
|
||||||
|
artifact: *LibExeObjStep,
|
||||||
|
dest_filename: []const u8,
|
||||||
|
options: CreateOptions,
|
||||||
|
) *InstallRawStep {
|
||||||
const self = builder.allocator.create(InstallRawStep) catch unreachable;
|
const self = builder.allocator.create(InstallRawStep) catch unreachable;
|
||||||
self.* = InstallRawStep{
|
self.* = InstallRawStep{
|
||||||
.step = Step.init(.install_raw, builder.fmt("install raw binary {s}", .{artifact.step.name}), builder.allocator, make),
|
.step = Step.init(.install_raw, builder.fmt("install raw binary {s}", .{artifact.step.name}), builder.allocator, make),
|
||||||
@ -53,7 +57,7 @@ pub fn create(builder: *Builder, artifact: *LibExeObjStep, dest_filename: []cons
|
|||||||
},
|
},
|
||||||
.dest_filename = dest_filename,
|
.dest_filename = dest_filename,
|
||||||
.options = options,
|
.options = options,
|
||||||
.output_file = std.build.GeneratedFile{ .step = &self.step },
|
.output_file = std.Build.GeneratedFile{ .step = &self.step },
|
||||||
};
|
};
|
||||||
self.step.dependOn(&artifact.step);
|
self.step.dependOn(&artifact.step);
|
||||||
|
|
||||||
@ -61,8 +65,8 @@ pub fn create(builder: *Builder, artifact: *LibExeObjStep, dest_filename: []cons
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getOutputSource(self: *const InstallRawStep) std.build.FileSource {
|
pub fn getOutputSource(self: *const InstallRawStep) std.Build.FileSource {
|
||||||
return std.build.FileSource{ .generated = &self.output_file };
|
return std.Build.FileSource{ .generated = &self.output_file };
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *Step) !void {
|
fn make(step: *Step) !void {
|
||||||
@ -9,32 +9,30 @@ const ArrayList = std.ArrayList;
|
|||||||
const StringHashMap = std.StringHashMap;
|
const StringHashMap = std.StringHashMap;
|
||||||
const Sha256 = std.crypto.hash.sha2.Sha256;
|
const Sha256 = std.crypto.hash.sha2.Sha256;
|
||||||
const Allocator = mem.Allocator;
|
const Allocator = mem.Allocator;
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
|
||||||
const Builder = build.Builder;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
const NativeTargetInfo = std.zig.system.NativeTargetInfo;
|
const NativeTargetInfo = std.zig.system.NativeTargetInfo;
|
||||||
const FileSource = std.build.FileSource;
|
const FileSource = std.Build.FileSource;
|
||||||
const PkgConfigPkg = Builder.PkgConfigPkg;
|
const PkgConfigPkg = std.Build.PkgConfigPkg;
|
||||||
const PkgConfigError = Builder.PkgConfigError;
|
const PkgConfigError = std.Build.PkgConfigError;
|
||||||
const ExecError = Builder.ExecError;
|
const ExecError = std.Build.ExecError;
|
||||||
const Pkg = std.build.Pkg;
|
const Pkg = std.Build.Pkg;
|
||||||
const VcpkgRoot = std.build.VcpkgRoot;
|
const VcpkgRoot = std.Build.VcpkgRoot;
|
||||||
const InstallDir = std.build.InstallDir;
|
const InstallDir = std.Build.InstallDir;
|
||||||
const InstallArtifactStep = std.build.InstallArtifactStep;
|
const InstallArtifactStep = std.Build.InstallArtifactStep;
|
||||||
const GeneratedFile = std.build.GeneratedFile;
|
const GeneratedFile = std.Build.GeneratedFile;
|
||||||
const InstallRawStep = std.build.InstallRawStep;
|
const InstallRawStep = std.Build.InstallRawStep;
|
||||||
const EmulatableRunStep = std.build.EmulatableRunStep;
|
const EmulatableRunStep = std.Build.EmulatableRunStep;
|
||||||
const CheckObjectStep = std.build.CheckObjectStep;
|
const CheckObjectStep = std.Build.CheckObjectStep;
|
||||||
const RunStep = std.build.RunStep;
|
const RunStep = std.Build.RunStep;
|
||||||
const OptionsStep = std.build.OptionsStep;
|
const OptionsStep = std.Build.OptionsStep;
|
||||||
const ConfigHeaderStep = std.build.ConfigHeaderStep;
|
const ConfigHeaderStep = std.Build.ConfigHeaderStep;
|
||||||
const LibExeObjStep = @This();
|
const LibExeObjStep = @This();
|
||||||
|
|
||||||
pub const base_id = .lib_exe_obj;
|
pub const base_id = .lib_exe_obj;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
target: CrossTarget,
|
target: CrossTarget,
|
||||||
target_info: NativeTargetInfo,
|
target_info: NativeTargetInfo,
|
||||||
@ -84,7 +82,7 @@ initial_memory: ?u64 = null,
|
|||||||
max_memory: ?u64 = null,
|
max_memory: ?u64 = null,
|
||||||
shared_memory: bool = false,
|
shared_memory: bool = false,
|
||||||
global_base: ?u64 = null,
|
global_base: ?u64 = null,
|
||||||
c_std: Builder.CStd,
|
c_std: std.Build.CStd,
|
||||||
override_lib_dir: ?[]const u8,
|
override_lib_dir: ?[]const u8,
|
||||||
main_pkg_path: ?[]const u8,
|
main_pkg_path: ?[]const u8,
|
||||||
exec_cmd_args: ?[]const ?[]const u8,
|
exec_cmd_args: ?[]const ?[]const u8,
|
||||||
@ -108,7 +106,7 @@ object_src: []const u8,
|
|||||||
link_objects: ArrayList(LinkObject),
|
link_objects: ArrayList(LinkObject),
|
||||||
include_dirs: ArrayList(IncludeDir),
|
include_dirs: ArrayList(IncludeDir),
|
||||||
c_macros: ArrayList([]const u8),
|
c_macros: ArrayList([]const u8),
|
||||||
installed_headers: ArrayList(*std.build.Step),
|
installed_headers: ArrayList(*Step),
|
||||||
output_dir: ?[]const u8,
|
output_dir: ?[]const u8,
|
||||||
is_linking_libc: bool = false,
|
is_linking_libc: bool = false,
|
||||||
is_linking_libcpp: bool = false,
|
is_linking_libcpp: bool = false,
|
||||||
@ -226,7 +224,7 @@ pub const CSourceFile = struct {
|
|||||||
source: FileSource,
|
source: FileSource,
|
||||||
args: []const []const u8,
|
args: []const []const u8,
|
||||||
|
|
||||||
pub fn dupe(self: CSourceFile, b: *Builder) CSourceFile {
|
pub fn dupe(self: CSourceFile, b: *std.Build) CSourceFile {
|
||||||
return .{
|
return .{
|
||||||
.source = self.source.dupe(b),
|
.source = self.source.dupe(b),
|
||||||
.args = b.dupeStrings(self.args),
|
.args = b.dupeStrings(self.args),
|
||||||
@ -297,7 +295,7 @@ pub const EmitOption = union(enum) {
|
|||||||
emit: void,
|
emit: void,
|
||||||
emit_to: []const u8,
|
emit_to: []const u8,
|
||||||
|
|
||||||
fn getArg(self: @This(), b: *Builder, arg_name: []const u8) ?[]const u8 {
|
fn getArg(self: @This(), b: *std.Build, arg_name: []const u8) ?[]const u8 {
|
||||||
return switch (self) {
|
return switch (self) {
|
||||||
.no_emit => b.fmt("-fno-{s}", .{arg_name}),
|
.no_emit => b.fmt("-fno-{s}", .{arg_name}),
|
||||||
.default => null,
|
.default => null,
|
||||||
@ -307,7 +305,7 @@ pub const EmitOption = union(enum) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn create(builder: *Builder, options: Options) *LibExeObjStep {
|
pub fn create(builder: *std.Build, options: Options) *LibExeObjStep {
|
||||||
const name = builder.dupe(options.name);
|
const name = builder.dupe(options.name);
|
||||||
const root_src: ?FileSource = if (options.root_source_file) |rsrc| rsrc.dupe(builder) else null;
|
const root_src: ?FileSource = if (options.root_source_file) |rsrc| rsrc.dupe(builder) else null;
|
||||||
if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) {
|
if (mem.indexOf(u8, name, "/") != null or mem.indexOf(u8, name, "\\") != null) {
|
||||||
@ -343,9 +341,9 @@ pub fn create(builder: *Builder, options: Options) *LibExeObjStep {
|
|||||||
.lib_paths = ArrayList([]const u8).init(builder.allocator),
|
.lib_paths = ArrayList([]const u8).init(builder.allocator),
|
||||||
.rpaths = ArrayList([]const u8).init(builder.allocator),
|
.rpaths = ArrayList([]const u8).init(builder.allocator),
|
||||||
.framework_dirs = ArrayList([]const u8).init(builder.allocator),
|
.framework_dirs = ArrayList([]const u8).init(builder.allocator),
|
||||||
.installed_headers = ArrayList(*std.build.Step).init(builder.allocator),
|
.installed_headers = ArrayList(*Step).init(builder.allocator),
|
||||||
.object_src = undefined,
|
.object_src = undefined,
|
||||||
.c_std = Builder.CStd.C99,
|
.c_std = std.Build.CStd.C99,
|
||||||
.override_lib_dir = null,
|
.override_lib_dir = null,
|
||||||
.main_pkg_path = null,
|
.main_pkg_path = null,
|
||||||
.exec_cmd_args = null,
|
.exec_cmd_args = null,
|
||||||
@ -461,7 +459,7 @@ pub fn installHeadersDirectory(
|
|||||||
|
|
||||||
pub fn installHeadersDirectoryOptions(
|
pub fn installHeadersDirectoryOptions(
|
||||||
a: *LibExeObjStep,
|
a: *LibExeObjStep,
|
||||||
options: std.build.InstallDirStep.Options,
|
options: std.Build.InstallDirStep.Options,
|
||||||
) void {
|
) void {
|
||||||
const install_dir = a.builder.addInstallDirectory(options);
|
const install_dir = a.builder.addInstallDirectory(options);
|
||||||
a.builder.getInstallStep().dependOn(&install_dir.step);
|
a.builder.getInstallStep().dependOn(&install_dir.step);
|
||||||
@ -600,7 +598,7 @@ pub fn linkLibCpp(self: *LibExeObjStep) void {
|
|||||||
/// If the value is omitted, it is set to 1.
|
/// If the value is omitted, it is set to 1.
|
||||||
/// `name` and `value` need not live longer than the function call.
|
/// `name` and `value` need not live longer than the function call.
|
||||||
pub fn defineCMacro(self: *LibExeObjStep, name: []const u8, value: ?[]const u8) void {
|
pub fn defineCMacro(self: *LibExeObjStep, name: []const u8, value: ?[]const u8) void {
|
||||||
const macro = std.build.constructCMacro(self.builder.allocator, name, value);
|
const macro = std.Build.constructCMacro(self.builder.allocator, name, value);
|
||||||
self.c_macros.append(macro) catch unreachable;
|
self.c_macros.append(macro) catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1460,7 +1458,7 @@ fn make(step: *Step) !void {
|
|||||||
if (!self.target.isNative()) {
|
if (!self.target.isNative()) {
|
||||||
try zig_args.appendSlice(&.{
|
try zig_args.appendSlice(&.{
|
||||||
"-target", try self.target.zigTriple(builder.allocator),
|
"-target", try self.target.zigTriple(builder.allocator),
|
||||||
"-mcpu", try build.serializeCpu(builder.allocator, self.target.getCpu()),
|
"-mcpu", try std.Build.serializeCpu(builder.allocator, self.target.getCpu()),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.target.dynamic_linker.get()) |dynamic_linker| {
|
if (self.target.dynamic_linker.get()) |dynamic_linker| {
|
||||||
@ -1902,7 +1900,7 @@ pub fn doAtomicSymLinks(allocator: Allocator, output_path: []const u8, filename_
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn execPkgConfigList(self: *Builder, out_code: *u8) (PkgConfigError || ExecError)![]const PkgConfigPkg {
|
fn execPkgConfigList(self: *std.Build, out_code: *u8) (PkgConfigError || ExecError)![]const PkgConfigPkg {
|
||||||
const stdout = try self.execAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);
|
const stdout = try self.execAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);
|
||||||
var list = ArrayList(PkgConfigPkg).init(self.allocator);
|
var list = ArrayList(PkgConfigPkg).init(self.allocator);
|
||||||
errdefer list.deinit();
|
errdefer list.deinit();
|
||||||
@ -1918,7 +1916,7 @@ fn execPkgConfigList(self: *Builder, out_code: *u8) (PkgConfigError || ExecError
|
|||||||
return list.toOwnedSlice();
|
return list.toOwnedSlice();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getPkgConfigList(self: *Builder) ![]const PkgConfigPkg {
|
fn getPkgConfigList(self: *std.Build) ![]const PkgConfigPkg {
|
||||||
if (self.pkg_config_pkg_list) |res| {
|
if (self.pkg_config_pkg_list) |res| {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1948,7 +1946,7 @@ test "addPackage" {
|
|||||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||||
defer arena.deinit();
|
defer arena.deinit();
|
||||||
|
|
||||||
var builder = try Builder.create(
|
var builder = try std.Build.create(
|
||||||
arena.allocator(),
|
arena.allocator(),
|
||||||
"test",
|
"test",
|
||||||
"test",
|
"test",
|
||||||
@ -1,17 +1,15 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const log = std.log;
|
const log = std.log;
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
|
||||||
const Builder = build.Builder;
|
|
||||||
const LogStep = @This();
|
const LogStep = @This();
|
||||||
|
|
||||||
pub const base_id = .log;
|
pub const base_id = .log;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
data: []const u8,
|
data: []const u8,
|
||||||
|
|
||||||
pub fn init(builder: *Builder, data: []const u8) LogStep {
|
pub fn init(builder: *std.Build, data: []const u8) LogStep {
|
||||||
return LogStep{
|
return LogStep{
|
||||||
.builder = builder,
|
.builder = builder,
|
||||||
.step = Step.init(.log, builder.fmt("log {s}", .{data}), builder.allocator, make),
|
.step = Step.init(.log, builder.fmt("log {s}", .{data}), builder.allocator, make),
|
||||||
@ -1,12 +1,10 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const build = std.build;
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const Step = build.Step;
|
const Step = std.Build.Step;
|
||||||
const Builder = build.Builder;
|
const GeneratedFile = std.Build.GeneratedFile;
|
||||||
const GeneratedFile = build.GeneratedFile;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjStep = build.LibExeObjStep;
|
const FileSource = std.Build.FileSource;
|
||||||
const FileSource = build.FileSource;
|
|
||||||
|
|
||||||
const OptionsStep = @This();
|
const OptionsStep = @This();
|
||||||
|
|
||||||
@ -14,13 +12,13 @@ pub const base_id = .options;
|
|||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
generated_file: GeneratedFile,
|
generated_file: GeneratedFile,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
|
|
||||||
contents: std.ArrayList(u8),
|
contents: std.ArrayList(u8),
|
||||||
artifact_args: std.ArrayList(OptionArtifactArg),
|
artifact_args: std.ArrayList(OptionArtifactArg),
|
||||||
file_source_args: std.ArrayList(OptionFileSourceArg),
|
file_source_args: std.ArrayList(OptionFileSourceArg),
|
||||||
|
|
||||||
pub fn create(builder: *Builder) *OptionsStep {
|
pub fn create(builder: *std.Build) *OptionsStep {
|
||||||
const self = builder.allocator.create(OptionsStep) catch unreachable;
|
const self = builder.allocator.create(OptionsStep) catch unreachable;
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.builder = builder,
|
.builder = builder,
|
||||||
@ -202,7 +200,7 @@ pub fn addOptionArtifact(self: *OptionsStep, name: []const u8, artifact: *LibExe
|
|||||||
self.step.dependOn(&artifact.step);
|
self.step.dependOn(&artifact.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getPackage(self: *OptionsStep, package_name: []const u8) build.Pkg {
|
pub fn getPackage(self: *OptionsStep, package_name: []const u8) std.Build.Pkg {
|
||||||
return .{ .name = package_name, .source = self.getSource() };
|
return .{ .name = package_name, .source = self.getSource() };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +279,7 @@ test "OptionsStep" {
|
|||||||
|
|
||||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||||
defer arena.deinit();
|
defer arena.deinit();
|
||||||
var builder = try Builder.create(
|
var builder = try std.Build.create(
|
||||||
arena.allocator(),
|
arena.allocator(),
|
||||||
"test",
|
"test",
|
||||||
"test",
|
"test",
|
||||||
@ -1,18 +1,16 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const log = std.log;
|
const log = std.log;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
|
||||||
const Builder = build.Builder;
|
|
||||||
const RemoveDirStep = @This();
|
const RemoveDirStep = @This();
|
||||||
|
|
||||||
pub const base_id = .remove_dir;
|
pub const base_id = .remove_dir;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
dir_path: []const u8,
|
dir_path: []const u8,
|
||||||
|
|
||||||
pub fn init(builder: *Builder, dir_path: []const u8) RemoveDirStep {
|
pub fn init(builder: *std.Build, dir_path: []const u8) RemoveDirStep {
|
||||||
return RemoveDirStep{
|
return RemoveDirStep{
|
||||||
.builder = builder,
|
.builder = builder,
|
||||||
.step = Step.init(.remove_dir, builder.fmt("RemoveDir {s}", .{dir_path}), builder.allocator, make),
|
.step = Step.init(.remove_dir, builder.fmt("RemoveDir {s}", .{dir_path}), builder.allocator, make),
|
||||||
@ -1,17 +1,15 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const build = std.build;
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const Builder = build.Builder;
|
const WriteFileStep = std.Build.WriteFileStep;
|
||||||
const LibExeObjStep = build.LibExeObjStep;
|
|
||||||
const WriteFileStep = build.WriteFileStep;
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const process = std.process;
|
const process = std.process;
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
const EnvMap = process.EnvMap;
|
const EnvMap = process.EnvMap;
|
||||||
const Allocator = mem.Allocator;
|
const Allocator = mem.Allocator;
|
||||||
const ExecError = build.Builder.ExecError;
|
const ExecError = std.Build.ExecError;
|
||||||
|
|
||||||
const max_stdout_size = 1 * 1024 * 1024; // 1 MiB
|
const max_stdout_size = 1 * 1024 * 1024; // 1 MiB
|
||||||
|
|
||||||
@ -20,7 +18,7 @@ const RunStep = @This();
|
|||||||
pub const base_id: Step.Id = .run;
|
pub const base_id: Step.Id = .run;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
|
|
||||||
/// See also addArg and addArgs to modifying this directly
|
/// See also addArg and addArgs to modifying this directly
|
||||||
argv: ArrayList(Arg),
|
argv: ArrayList(Arg),
|
||||||
@ -51,11 +49,11 @@ pub const StdIoAction = union(enum) {
|
|||||||
|
|
||||||
pub const Arg = union(enum) {
|
pub const Arg = union(enum) {
|
||||||
artifact: *LibExeObjStep,
|
artifact: *LibExeObjStep,
|
||||||
file_source: build.FileSource,
|
file_source: std.Build.FileSource,
|
||||||
bytes: []u8,
|
bytes: []u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn create(builder: *Builder, name: []const u8) *RunStep {
|
pub fn create(builder: *std.Build, name: []const u8) *RunStep {
|
||||||
const self = builder.allocator.create(RunStep) catch unreachable;
|
const self = builder.allocator.create(RunStep) catch unreachable;
|
||||||
self.* = RunStep{
|
self.* = RunStep{
|
||||||
.builder = builder,
|
.builder = builder,
|
||||||
@ -73,7 +71,7 @@ pub fn addArtifactArg(self: *RunStep, artifact: *LibExeObjStep) void {
|
|||||||
self.step.dependOn(&artifact.step);
|
self.step.dependOn(&artifact.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addFileSourceArg(self: *RunStep, file_source: build.FileSource) void {
|
pub fn addFileSourceArg(self: *RunStep, file_source: std.Build.FileSource) void {
|
||||||
self.argv.append(Arg{
|
self.argv.append(Arg{
|
||||||
.file_source = file_source.dupe(self.builder),
|
.file_source = file_source.dupe(self.builder),
|
||||||
}) catch unreachable;
|
}) catch unreachable;
|
||||||
@ -101,7 +99,7 @@ pub fn addPathDir(self: *RunStep, search_path: []const u8) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// For internal use only, users of `RunStep` should use `addPathDir` directly.
|
/// For internal use only, users of `RunStep` should use `addPathDir` directly.
|
||||||
pub fn addPathDirInternal(step: *Step, builder: *Builder, search_path: []const u8) void {
|
pub fn addPathDirInternal(step: *Step, builder: *std.Build, search_path: []const u8) void {
|
||||||
const env_map = getEnvMapInternal(step, builder.allocator);
|
const env_map = getEnvMapInternal(step, builder.allocator);
|
||||||
|
|
||||||
const key = "PATH";
|
const key = "PATH";
|
||||||
@ -122,7 +120,7 @@ pub fn getEnvMap(self: *RunStep) *EnvMap {
|
|||||||
fn getEnvMapInternal(step: *Step, allocator: Allocator) *EnvMap {
|
fn getEnvMapInternal(step: *Step, allocator: Allocator) *EnvMap {
|
||||||
const maybe_env_map = switch (step.id) {
|
const maybe_env_map = switch (step.id) {
|
||||||
.run => step.cast(RunStep).?.env_map,
|
.run => step.cast(RunStep).?.env_map,
|
||||||
.emulatable_run => step.cast(build.EmulatableRunStep).?.env_map,
|
.emulatable_run => step.cast(std.Build.EmulatableRunStep).?.env_map,
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
return maybe_env_map orelse {
|
return maybe_env_map orelse {
|
||||||
@ -195,7 +193,7 @@ fn make(step: *Step) !void {
|
|||||||
|
|
||||||
pub fn runCommand(
|
pub fn runCommand(
|
||||||
argv: []const []const u8,
|
argv: []const []const u8,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
expected_exit_code: ?u8,
|
expected_exit_code: ?u8,
|
||||||
stdout_action: StdIoAction,
|
stdout_action: StdIoAction,
|
||||||
stderr_action: StdIoAction,
|
stderr_action: StdIoAction,
|
||||||
@ -363,7 +361,7 @@ fn addPathForDynLibs(self: *RunStep, artifact: *LibExeObjStep) void {
|
|||||||
|
|
||||||
/// This should only be used for internal usage, this is called automatically
|
/// This should only be used for internal usage, this is called automatically
|
||||||
/// for the user.
|
/// for the user.
|
||||||
pub fn addPathForDynLibsInternal(step: *Step, builder: *Builder, artifact: *LibExeObjStep) void {
|
pub fn addPathForDynLibsInternal(step: *Step, builder: *std.Build, artifact: *LibExeObjStep) void {
|
||||||
for (artifact.link_objects.items) |link_object| {
|
for (artifact.link_objects.items) |link_object| {
|
||||||
switch (link_object) {
|
switch (link_object) {
|
||||||
.other_step => |other| {
|
.other_step => |other| {
|
||||||
97
lib/std/Build/Step.zig
Normal file
97
lib/std/Build/Step.zig
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
id: Id,
|
||||||
|
name: []const u8,
|
||||||
|
makeFn: *const fn (self: *Step) anyerror!void,
|
||||||
|
dependencies: std.ArrayList(*Step),
|
||||||
|
loop_flag: bool,
|
||||||
|
done_flag: bool,
|
||||||
|
|
||||||
|
pub const Id = enum {
|
||||||
|
top_level,
|
||||||
|
lib_exe_obj,
|
||||||
|
install_artifact,
|
||||||
|
install_file,
|
||||||
|
install_dir,
|
||||||
|
log,
|
||||||
|
remove_dir,
|
||||||
|
fmt,
|
||||||
|
translate_c,
|
||||||
|
write_file,
|
||||||
|
run,
|
||||||
|
emulatable_run,
|
||||||
|
check_file,
|
||||||
|
check_object,
|
||||||
|
config_header,
|
||||||
|
install_raw,
|
||||||
|
options,
|
||||||
|
custom,
|
||||||
|
|
||||||
|
pub fn Type(comptime id: Id) type {
|
||||||
|
return switch (id) {
|
||||||
|
.top_level => Build.TopLevelStep,
|
||||||
|
.lib_exe_obj => Build.LibExeObjStep,
|
||||||
|
.install_artifact => Build.InstallArtifactStep,
|
||||||
|
.install_file => Build.InstallFileStep,
|
||||||
|
.install_dir => Build.InstallDirStep,
|
||||||
|
.log => Build.LogStep,
|
||||||
|
.remove_dir => Build.RemoveDirStep,
|
||||||
|
.fmt => Build.FmtStep,
|
||||||
|
.translate_c => Build.TranslateCStep,
|
||||||
|
.write_file => Build.WriteFileStep,
|
||||||
|
.run => Build.RunStep,
|
||||||
|
.emulatable_run => Build.EmulatableRunStep,
|
||||||
|
.check_file => Build.CheckFileStep,
|
||||||
|
.check_object => Build.CheckObjectStep,
|
||||||
|
.config_header => Build.ConfigHeaderStep,
|
||||||
|
.install_raw => Build.InstallRawStep,
|
||||||
|
.options => Build.OptionsStep,
|
||||||
|
.custom => @compileError("no type available for custom step"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn init(
|
||||||
|
id: Id,
|
||||||
|
name: []const u8,
|
||||||
|
allocator: Allocator,
|
||||||
|
makeFn: *const fn (self: *Step) anyerror!void,
|
||||||
|
) Step {
|
||||||
|
return Step{
|
||||||
|
.id = id,
|
||||||
|
.name = allocator.dupe(u8, name) catch unreachable,
|
||||||
|
.makeFn = makeFn,
|
||||||
|
.dependencies = std.ArrayList(*Step).init(allocator),
|
||||||
|
.loop_flag = false,
|
||||||
|
.done_flag = false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn initNoOp(id: Id, name: []const u8, allocator: Allocator) Step {
|
||||||
|
return init(id, name, allocator, makeNoOp);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn make(self: *Step) !void {
|
||||||
|
if (self.done_flag) return;
|
||||||
|
|
||||||
|
try self.makeFn(self);
|
||||||
|
self.done_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn dependOn(self: *Step, other: *Step) void {
|
||||||
|
self.dependencies.append(other) catch unreachable;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn makeNoOp(self: *Step) anyerror!void {
|
||||||
|
_ = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn cast(step: *Step, comptime T: type) ?*T {
|
||||||
|
if (step.id == T.base_id) {
|
||||||
|
return @fieldParentPtr(T, "step", step);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Step = @This();
|
||||||
|
const std = @import("../std.zig");
|
||||||
|
const Build = std.Build;
|
||||||
|
const Allocator = std.mem.Allocator;
|
||||||
@ -1,9 +1,7 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = std.build;
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const Builder = build.Builder;
|
const CheckFileStep = std.Build.CheckFileStep;
|
||||||
const LibExeObjStep = build.LibExeObjStep;
|
|
||||||
const CheckFileStep = build.CheckFileStep;
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
@ -13,23 +11,23 @@ const TranslateCStep = @This();
|
|||||||
pub const base_id = .translate_c;
|
pub const base_id = .translate_c;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
source: build.FileSource,
|
source: std.Build.FileSource,
|
||||||
include_dirs: std.ArrayList([]const u8),
|
include_dirs: std.ArrayList([]const u8),
|
||||||
c_macros: std.ArrayList([]const u8),
|
c_macros: std.ArrayList([]const u8),
|
||||||
output_dir: ?[]const u8,
|
output_dir: ?[]const u8,
|
||||||
out_basename: []const u8,
|
out_basename: []const u8,
|
||||||
target: CrossTarget,
|
target: CrossTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
output_file: build.GeneratedFile,
|
output_file: std.Build.GeneratedFile,
|
||||||
|
|
||||||
pub const Options = struct {
|
pub const Options = struct {
|
||||||
source_file: build.FileSource,
|
source_file: std.Build.FileSource,
|
||||||
target: CrossTarget,
|
target: CrossTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn create(builder: *Builder, options: Options) *TranslateCStep {
|
pub fn create(builder: *std.Build, options: Options) *TranslateCStep {
|
||||||
const self = builder.allocator.create(TranslateCStep) catch unreachable;
|
const self = builder.allocator.create(TranslateCStep) catch unreachable;
|
||||||
const source = options.source_file.dupe(builder);
|
const source = options.source_file.dupe(builder);
|
||||||
self.* = TranslateCStep{
|
self.* = TranslateCStep{
|
||||||
@ -42,7 +40,7 @@ pub fn create(builder: *Builder, options: Options) *TranslateCStep {
|
|||||||
.out_basename = undefined,
|
.out_basename = undefined,
|
||||||
.target = options.target,
|
.target = options.target,
|
||||||
.optimize = options.optimize,
|
.optimize = options.optimize,
|
||||||
.output_file = build.GeneratedFile{ .step = &self.step },
|
.output_file = std.Build.GeneratedFile{ .step = &self.step },
|
||||||
};
|
};
|
||||||
source.addStepDependencies(&self.step);
|
source.addStepDependencies(&self.step);
|
||||||
return self;
|
return self;
|
||||||
@ -79,7 +77,7 @@ pub fn addCheckFile(self: *TranslateCStep, expected_matches: []const []const u8)
|
|||||||
/// If the value is omitted, it is set to 1.
|
/// If the value is omitted, it is set to 1.
|
||||||
/// `name` and `value` need not live longer than the function call.
|
/// `name` and `value` need not live longer than the function call.
|
||||||
pub fn defineCMacro(self: *TranslateCStep, name: []const u8, value: ?[]const u8) void {
|
pub fn defineCMacro(self: *TranslateCStep, name: []const u8, value: ?[]const u8) void {
|
||||||
const macro = build.constructCMacro(self.builder.allocator, name, value);
|
const macro = std.Build.constructCMacro(self.builder.allocator, name, value);
|
||||||
self.c_macros.append(macro) catch unreachable;
|
self.c_macros.append(macro) catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,7 +1,5 @@
|
|||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
const build = @import("../build.zig");
|
const Step = std.Build.Step;
|
||||||
const Step = build.Step;
|
|
||||||
const Builder = build.Builder;
|
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
|
|
||||||
@ -10,17 +8,17 @@ const WriteFileStep = @This();
|
|||||||
pub const base_id = .write_file;
|
pub const base_id = .write_file;
|
||||||
|
|
||||||
step: Step,
|
step: Step,
|
||||||
builder: *Builder,
|
builder: *std.Build,
|
||||||
output_dir: []const u8,
|
output_dir: []const u8,
|
||||||
files: std.TailQueue(File),
|
files: std.TailQueue(File),
|
||||||
|
|
||||||
pub const File = struct {
|
pub const File = struct {
|
||||||
source: build.GeneratedFile,
|
source: std.Build.GeneratedFile,
|
||||||
basename: []const u8,
|
basename: []const u8,
|
||||||
bytes: []const u8,
|
bytes: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn init(builder: *Builder) WriteFileStep {
|
pub fn init(builder: *std.Build) WriteFileStep {
|
||||||
return WriteFileStep{
|
return WriteFileStep{
|
||||||
.builder = builder,
|
.builder = builder,
|
||||||
.step = Step.init(.write_file, "writefile", builder.allocator, make),
|
.step = Step.init(.write_file, "writefile", builder.allocator, make),
|
||||||
@ -33,7 +31,7 @@ pub fn add(self: *WriteFileStep, basename: []const u8, bytes: []const u8) void {
|
|||||||
const node = self.builder.allocator.create(std.TailQueue(File).Node) catch unreachable;
|
const node = self.builder.allocator.create(std.TailQueue(File).Node) catch unreachable;
|
||||||
node.* = .{
|
node.* = .{
|
||||||
.data = .{
|
.data = .{
|
||||||
.source = build.GeneratedFile{ .step = &self.step },
|
.source = std.Build.GeneratedFile{ .step = &self.step },
|
||||||
.basename = self.builder.dupePath(basename),
|
.basename = self.builder.dupePath(basename),
|
||||||
.bytes = self.builder.dupe(bytes),
|
.bytes = self.builder.dupe(bytes),
|
||||||
},
|
},
|
||||||
@ -43,11 +41,11 @@ pub fn add(self: *WriteFileStep, basename: []const u8, bytes: []const u8) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a file source for the given basename. If the file does not exist, returns `null`.
|
/// Gets a file source for the given basename. If the file does not exist, returns `null`.
|
||||||
pub fn getFileSource(step: *WriteFileStep, basename: []const u8) ?build.FileSource {
|
pub fn getFileSource(step: *WriteFileStep, basename: []const u8) ?std.Build.FileSource {
|
||||||
var it = step.files.first;
|
var it = step.files.first;
|
||||||
while (it) |node| : (it = node.next) {
|
while (it) |node| : (it = node.next) {
|
||||||
if (std.mem.eql(u8, node.data.basename, basename))
|
if (std.mem.eql(u8, node.data.basename, basename))
|
||||||
return build.FileSource{ .generated = &node.data.source };
|
return std.Build.FileSource{ .generated = &node.data.source };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
1863
lib/std/build.zig
1863
lib/std/build.zig
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ pub const AutoArrayHashMapUnmanaged = array_hash_map.AutoArrayHashMapUnmanaged;
|
|||||||
pub const AutoHashMap = hash_map.AutoHashMap;
|
pub const AutoHashMap = hash_map.AutoHashMap;
|
||||||
pub const AutoHashMapUnmanaged = hash_map.AutoHashMapUnmanaged;
|
pub const AutoHashMapUnmanaged = hash_map.AutoHashMapUnmanaged;
|
||||||
pub const BoundedArray = @import("bounded_array.zig").BoundedArray;
|
pub const BoundedArray = @import("bounded_array.zig").BoundedArray;
|
||||||
|
pub const Build = @import("Build.zig");
|
||||||
pub const BufMap = @import("buf_map.zig").BufMap;
|
pub const BufMap = @import("buf_map.zig").BufMap;
|
||||||
pub const BufSet = @import("buf_set.zig").BufSet;
|
pub const BufSet = @import("buf_set.zig").BufSet;
|
||||||
pub const ChildProcess = @import("child_process.zig").ChildProcess;
|
pub const ChildProcess = @import("child_process.zig").ChildProcess;
|
||||||
@ -49,7 +50,6 @@ pub const array_hash_map = @import("array_hash_map.zig");
|
|||||||
pub const atomic = @import("atomic.zig");
|
pub const atomic = @import("atomic.zig");
|
||||||
pub const base64 = @import("base64.zig");
|
pub const base64 = @import("base64.zig");
|
||||||
pub const bit_set = @import("bit_set.zig");
|
pub const bit_set = @import("bit_set.zig");
|
||||||
pub const build = @import("build.zig");
|
|
||||||
pub const builtin = @import("builtin.zig");
|
pub const builtin = @import("builtin.zig");
|
||||||
pub const c = @import("c.zig");
|
pub const c = @import("c.zig");
|
||||||
pub const coff = @import("coff.zig");
|
pub const coff = @import("coff.zig");
|
||||||
@ -96,6 +96,12 @@ pub const wasm = @import("wasm.zig");
|
|||||||
pub const zig = @import("zig.zig");
|
pub const zig = @import("zig.zig");
|
||||||
pub const start = @import("start.zig");
|
pub const start = @import("start.zig");
|
||||||
|
|
||||||
|
///// Deprecated. Use `std.Build` instead.
|
||||||
|
//pub const build = struct {
|
||||||
|
// /// Deprecated. Use `std.Build` instead.
|
||||||
|
// pub const Builder = Build;
|
||||||
|
//};
|
||||||
|
|
||||||
const root = @import("root");
|
const root = @import("root");
|
||||||
const options_override = if (@hasDecl(root, "std_options")) root.std_options else struct {};
|
const options_override = if (@hasDecl(root, "std_options")) root.std_options else struct {};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const lib_a = b.addStaticLibrary(.{
|
const lib_a = b.addStaticLibrary(.{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
@ -37,7 +36,7 @@ pub fn build(b: *Builder) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createScenario(b: *Builder, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test the program");
|
const test_step = b.step("test", "Test the program");
|
||||||
@ -36,7 +35,7 @@ pub fn build(b: *Builder) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createScenario(b: *Builder, optimize: std.builtin.OptimizeMode) *LibExeObjectStep {
|
fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode) *LibExeObjectStep {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ pub fn build(b: *Builder) void {
|
|||||||
exe.addCSourceFile("empty.c", &[0][]const u8{});
|
exe.addCSourceFile("empty.c", &[0][]const u8{});
|
||||||
exe.linkLibC();
|
exe.linkLibC();
|
||||||
|
|
||||||
const run_cmd = std.build.EmulatableRunStep.create(b, "run", exe);
|
const run_cmd = std.Build.EmulatableRunStep.create(b, "run", exe);
|
||||||
run_cmd.expectStdOutEqual("Hello!\n");
|
run_cmd.expectStdOutEqual("Hello!\n");
|
||||||
test_step.dependOn(&run_cmd.step);
|
test_step.dependOn(&run_cmd.step);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
@ -94,7 +93,7 @@ pub fn build(b: *Builder) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn simpleExe(b: *Builder, optimize: std.builtin.OptimizeMode) *LibExeObjectStep {
|
fn simpleExe(b: *std.Build, optimize: std.builtin.OptimizeMode) *LibExeObjectStep {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "main",
|
.name = "main",
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = std.zig.CrossTarget{ .os_tag = .macos };
|
const target = std.zig.CrossTarget{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test the program");
|
const test_step = b.step("test", "Test the program");
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test the program");
|
const test_step = b.step("test", "Test the program");
|
||||||
@ -18,6 +17,6 @@ pub fn build(b: *Builder) void {
|
|||||||
// populate paths to the sysroot here.
|
// populate paths to the sysroot here.
|
||||||
exe.linkFramework("Foundation");
|
exe.linkFramework("Foundation");
|
||||||
|
|
||||||
const run_cmd = std.build.EmulatableRunStep.create(b, "run", exe);
|
const run_cmd = std.Build.EmulatableRunStep.create(b, "run", exe);
|
||||||
test_step.dependOn(&run_cmd.step);
|
test_step.dependOn(&run_cmd.step);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test the program");
|
const test_step = b.step("test", "Test the program");
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
@ -29,14 +28,14 @@ pub fn build(b: *Builder) void {
|
|||||||
const exe = createScenario(b, optimize, target);
|
const exe = createScenario(b, optimize, target);
|
||||||
exe.search_strategy = .paths_first;
|
exe.search_strategy = .paths_first;
|
||||||
|
|
||||||
const run = std.build.EmulatableRunStep.create(b, "run", exe);
|
const run = std.Build.EmulatableRunStep.create(b, "run", exe);
|
||||||
run.cwd = b.pathFromRoot(".");
|
run.cwd = b.pathFromRoot(".");
|
||||||
run.expectStdOutEqual("Hello world");
|
run.expectStdOutEqual("Hello world");
|
||||||
test_step.dependOn(&run.step);
|
test_step.dependOn(&run.step);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createScenario(b: *Builder, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
||||||
const static = b.addStaticLibrary(.{
|
const static = b.addStaticLibrary(.{
|
||||||
.name = "a",
|
.name = "a",
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
@ -44,7 +43,7 @@ fn createScenario(b: *Builder, optimize: std.builtin.OptimizeMode, target: std.z
|
|||||||
});
|
});
|
||||||
static.addCSourceFile("a.c", &.{});
|
static.addCSourceFile("a.c", &.{});
|
||||||
static.linkLibC();
|
static.linkLibC();
|
||||||
static.override_dest_dir = std.build.InstallDir{
|
static.override_dest_dir = std.Build.InstallDir{
|
||||||
.custom = "static",
|
.custom = "static",
|
||||||
};
|
};
|
||||||
static.install();
|
static.install();
|
||||||
@ -57,7 +56,7 @@ fn createScenario(b: *Builder, optimize: std.builtin.OptimizeMode, target: std.z
|
|||||||
});
|
});
|
||||||
dylib.addCSourceFile("a.c", &.{});
|
dylib.addCSourceFile("a.c", &.{});
|
||||||
dylib.linkLibC();
|
dylib.linkLibC();
|
||||||
dylib.override_dest_dir = std.build.InstallDir{
|
dylib.override_dest_dir = std.Build.InstallDir{
|
||||||
.custom = "dynamic",
|
.custom = "dynamic",
|
||||||
};
|
};
|
||||||
dylib.install();
|
dylib.install();
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
@ -14,8 +13,8 @@ pub fn build(b: *Builder) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn testUnwindInfo(
|
fn testUnwindInfo(
|
||||||
b: *Builder,
|
b: *std.Build,
|
||||||
test_step: *std.build.Step,
|
test_step: *std.Build.Step,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
target: std.zig.CrossTarget,
|
target: std.zig.CrossTarget,
|
||||||
dead_strip: bool,
|
dead_strip: bool,
|
||||||
@ -52,7 +51,7 @@ fn testUnwindInfo(
|
|||||||
test_step.dependOn(&run_cmd.step);
|
test_step.dependOn(&run_cmd.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn createScenario(b: *Builder, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
fn createScenario(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
@ -27,8 +26,8 @@ pub fn build(b: *Builder) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn testUuid(
|
fn testUuid(
|
||||||
b: *Builder,
|
b: *std.Build,
|
||||||
test_step: *std.build.Step,
|
test_step: *std.Build.Step,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
target: std.zig.CrossTarget,
|
target: std.zig.CrossTarget,
|
||||||
comptime exp: []const u8,
|
comptime exp: []const u8,
|
||||||
@ -52,7 +51,7 @@ fn testUuid(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn simpleDylib(b: *Builder, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
fn simpleDylib(b: *std.Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget) *LibExeObjectStep {
|
||||||
const dylib = b.addSharedLibrary(.{
|
const dylib = b.addSharedLibrary(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.version = .{ .major = 1, .minor = 0 },
|
.version = .{ .major = 1, .minor = 0 },
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test the program");
|
const test_step = b.step("test", "Test the program");
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
const LibExeObjectStep = std.Build.LibExeObjStep;
|
||||||
const LibExeObjectStep = std.build.LibExeObjStep;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
const target: std.zig.CrossTarget = .{ .os_tag = .macos };
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
// Library with explicitly set cpu features
|
// Library with explicitly set cpu features
|
||||||
const lib = b.addSharedLibrary(.{
|
const lib = b.addSharedLibrary(.{
|
||||||
.name = "lib",
|
.name = "lib",
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const no_export = b.addSharedLibrary(.{
|
const no_export = b.addSharedLibrary(.{
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
2
test/link/wasm/extern/build.zig
vendored
2
test/link/wasm/extern/build.zig
vendored
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "extern",
|
.name = "extern",
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
// Wasm Object file which we will use to infer the features from
|
// Wasm Object file which we will use to infer the features from
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_step = b.step("test", "Test");
|
const test_step = b.step("test", "Test");
|
||||||
test_step.dependOn(b.getInstallStep());
|
test_step.dependOn(b.getInstallStep());
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
// This is the implementation of the test harness.
|
// This is the implementation of the test harness.
|
||||||
// For the actual test cases, see test/compare_output.zig.
|
// For the actual test cases, see test/compare_output.zig.
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const build = std.build;
|
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
const fmt = std.fmt;
|
const fmt = std.fmt;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
@ -9,8 +8,8 @@ const fs = std.fs;
|
|||||||
const OptimizeMode = std.builtin.OptimizeMode;
|
const OptimizeMode = std.builtin.OptimizeMode;
|
||||||
|
|
||||||
pub const CompareOutputContext = struct {
|
pub const CompareOutputContext = struct {
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
step: *build.Step,
|
step: *std.Build.Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
optimize_modes: []const OptimizeMode,
|
optimize_modes: []const OptimizeMode,
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
// This is the implementation of the test harness for running translated
|
// This is the implementation of the test harness for running translated
|
||||||
// C code. For the actual test cases, see test/run_translated_c.zig.
|
// C code. For the actual test cases, see test/run_translated_c.zig.
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const build = std.build;
|
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
const fmt = std.fmt;
|
const fmt = std.fmt;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
|
|
||||||
pub const RunTranslatedCContext = struct {
|
pub const RunTranslatedCContext = struct {
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
step: *build.Step,
|
step: *std.Build.Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
target: std.zig.CrossTarget,
|
target: std.zig.CrossTarget,
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
// This is the implementation of the test harness.
|
// This is the implementation of the test harness.
|
||||||
// For the actual test cases, see test/translate_c.zig.
|
// For the actual test cases, see test/translate_c.zig.
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const build = std.build;
|
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
const fmt = std.fmt;
|
const fmt = std.fmt;
|
||||||
const mem = std.mem;
|
const mem = std.mem;
|
||||||
@ -9,8 +8,8 @@ const fs = std.fs;
|
|||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
|
|
||||||
pub const TranslateCContext = struct {
|
pub const TranslateCContext = struct {
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
step: *build.Step,
|
step: *std.Build.Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const main = b.addTest(.{
|
const main = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
.optimize = b.standardOptimizeOption(.{}),
|
.optimize = b.standardOptimizeOption(.{}),
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
|
|
||||||
// TODO integrate this with the std.build executor API
|
// TODO integrate this with the std.Build executor API
|
||||||
fn isRunnableTarget(t: CrossTarget) bool {
|
fn isRunnableTarget(t: CrossTarget) bool {
|
||||||
if (t.isNative()) return true;
|
if (t.isNative()) return true;
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ fn isRunnableTarget(t: CrossTarget) bool {
|
|||||||
t.getCpuArch() == builtin.cpu.arch);
|
t.getCpuArch() == builtin.cpu.arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const main = b.addTest(.{
|
const main = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
.optimize = b.standardOptimizeOption(.{}),
|
.optimize = b.standardOptimizeOption(.{}),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const main = b.addExecutable(.{
|
const main = b.addExecutable(.{
|
||||||
.name = "main",
|
.name = "main",
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const obj1 = b.addStaticLibrary(.{
|
const obj1 = b.addStaticLibrary(.{
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const CheckFileStep = std.build.CheckFileStep;
|
const CheckFileStep = std.Build.CheckFileStep;
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const target = .{
|
const target = .{
|
||||||
.cpu_arch = .thumb,
|
.cpu_arch = .thumb,
|
||||||
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
|
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
|
|
||||||
// TODO integrate this with the std.build executor API
|
// TODO integrate this with the std.Build executor API
|
||||||
fn isRunnableTarget(t: CrossTarget) bool {
|
fn isRunnableTarget(t: CrossTarget) bool {
|
||||||
if (t.isNative()) return true;
|
if (t.isNative()) return true;
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ fn isRunnableTarget(t: CrossTarget) bool {
|
|||||||
t.getCpuArch() == builtin.cpu.arch);
|
t.getCpuArch() == builtin.cpu.arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
|
|
||||||
// TODO integrate this with the std.build executor API
|
// TODO integrate this with the std.Build executor API
|
||||||
fn isRunnableTarget(t: CrossTarget) bool {
|
fn isRunnableTarget(t: CrossTarget) bool {
|
||||||
if (t.isNative()) return true;
|
if (t.isNative()) return true;
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ fn isRunnableTarget(t: CrossTarget) bool {
|
|||||||
t.getCpuArch() == builtin.cpu.arch);
|
t.getCpuArch() == builtin.cpu.arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const obj = b.addObject(.{
|
const obj = b.addObject(.{
|
||||||
.name = "test",
|
.name = "test",
|
||||||
.root_source_file = .{ .path = "test.zig" },
|
.root_source_file = .{ .path = "test.zig" },
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const target = .{
|
const target = .{
|
||||||
.cpu_arch = .x86_64,
|
.cpu_arch = .x86_64,
|
||||||
.os_tag = .windows,
|
.os_tag = .windows,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
.name = "issue_7030",
|
.name = "issue_7030",
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_artifact = b.addTest(.{
|
const test_artifact = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const target = std.zig.CrossTarget{
|
const target = std.zig.CrossTarget{
|
||||||
.os_tag = .freestanding,
|
.os_tag = .freestanding,
|
||||||
.cpu_arch = .arm,
|
.cpu_arch = .arm,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const zip_add = b.addTest(.{
|
const zip_add = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_exe = b.addTest(.{
|
const test_exe = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "a/test.zig" },
|
.root_source_file = .{ .path = "a/test.zig" },
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const Builder = std.build.Builder;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
|
|
||||||
// TODO integrate this with the std.build executor API
|
// TODO integrate this with the std.Build executor API
|
||||||
fn isRunnableTarget(t: CrossTarget) bool {
|
fn isRunnableTarget(t: CrossTarget) bool {
|
||||||
if (t.isNative()) return true;
|
if (t.isNative()) return true;
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ fn isRunnableTarget(t: CrossTarget) bool {
|
|||||||
t.getCpuArch() == builtin.cpu.arch);
|
t.getCpuArch() == builtin.cpu.arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const obj = b.addObject(.{
|
const obj = b.addObject(.{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const main = b.addTest(.{
|
const main = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
.optimize = b.standardOptimizeOption(.{}),
|
.optimize = b.standardOptimizeOption(.{}),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const lib = b.addSharedLibrary(.{
|
const lib = b.addSharedLibrary(.{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const foo = b.addStaticLibrary(.{
|
const foo = b.addStaticLibrary(.{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const test_exe = b.addTest(.{
|
const test_exe = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "test.zig" },
|
.root_source_file = .{ .path = "test.zig" },
|
||||||
.kind = .test_exe,
|
.kind = .test_exe,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const main = b.addTest(.{
|
const main = b.addTest(.{
|
||||||
.root_source_file = .{ .path = "main.zig" },
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
.optimize = b.standardOptimizeOption(.{}),
|
.optimize = b.standardOptimizeOption(.{}),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const Builder = @import("std").build.Builder;
|
const std = @import("std");
|
||||||
|
|
||||||
pub fn build(b: *Builder) void {
|
pub fn build(b: *std.Build) void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const hello = b.addExecutable(.{
|
const hello = b.addExecutable(.{
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const debug = std.debug;
|
const debug = std.debug;
|
||||||
const build = std.build;
|
|
||||||
const CrossTarget = std.zig.CrossTarget;
|
const CrossTarget = std.zig.CrossTarget;
|
||||||
const io = std.io;
|
const io = std.io;
|
||||||
const fs = std.fs;
|
const fs = std.fs;
|
||||||
@ -9,9 +8,10 @@ const mem = std.mem;
|
|||||||
const fmt = std.fmt;
|
const fmt = std.fmt;
|
||||||
const ArrayList = std.ArrayList;
|
const ArrayList = std.ArrayList;
|
||||||
const OptimizeMode = std.builtin.OptimizeMode;
|
const OptimizeMode = std.builtin.OptimizeMode;
|
||||||
const LibExeObjStep = build.LibExeObjStep;
|
const LibExeObjStep = std.Build.LibExeObjStep;
|
||||||
const Allocator = mem.Allocator;
|
const Allocator = mem.Allocator;
|
||||||
const ExecError = build.Builder.ExecError;
|
const ExecError = std.Build.ExecError;
|
||||||
|
const Step = std.Build.Step;
|
||||||
|
|
||||||
// Cases
|
// Cases
|
||||||
const compare_output = @import("compare_output.zig");
|
const compare_output = @import("compare_output.zig");
|
||||||
@ -462,7 +462,7 @@ const test_targets = blk: {
|
|||||||
|
|
||||||
const max_stdout_size = 1 * 1024 * 1024; // 1 MB
|
const max_stdout_size = 1 * 1024 * 1024; // 1 MB
|
||||||
|
|
||||||
pub fn addCompareOutputTests(b: *build.Builder, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *build.Step {
|
pub fn addCompareOutputTests(b: *std.Build, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *Step {
|
||||||
const cases = b.allocator.create(CompareOutputContext) catch unreachable;
|
const cases = b.allocator.create(CompareOutputContext) catch unreachable;
|
||||||
cases.* = CompareOutputContext{
|
cases.* = CompareOutputContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -477,7 +477,7 @@ pub fn addCompareOutputTests(b: *build.Builder, test_filter: ?[]const u8, optimi
|
|||||||
return cases.step;
|
return cases.step;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addStackTraceTests(b: *build.Builder, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *build.Step {
|
pub fn addStackTraceTests(b: *std.Build, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *Step {
|
||||||
const cases = b.allocator.create(StackTracesContext) catch unreachable;
|
const cases = b.allocator.create(StackTracesContext) catch unreachable;
|
||||||
cases.* = StackTracesContext{
|
cases.* = StackTracesContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -493,7 +493,7 @@ pub fn addStackTraceTests(b: *build.Builder, test_filter: ?[]const u8, optimize_
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn addStandaloneTests(
|
pub fn addStandaloneTests(
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
optimize_modes: []const OptimizeMode,
|
optimize_modes: []const OptimizeMode,
|
||||||
skip_non_native: bool,
|
skip_non_native: bool,
|
||||||
@ -506,7 +506,7 @@ pub fn addStandaloneTests(
|
|||||||
enable_wasmtime: bool,
|
enable_wasmtime: bool,
|
||||||
enable_wine: bool,
|
enable_wine: bool,
|
||||||
enable_symlinks_windows: bool,
|
enable_symlinks_windows: bool,
|
||||||
) *build.Step {
|
) *Step {
|
||||||
const cases = b.allocator.create(StandaloneContext) catch unreachable;
|
const cases = b.allocator.create(StandaloneContext) catch unreachable;
|
||||||
cases.* = StandaloneContext{
|
cases.* = StandaloneContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -532,13 +532,13 @@ pub fn addStandaloneTests(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn addLinkTests(
|
pub fn addLinkTests(
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
optimize_modes: []const OptimizeMode,
|
optimize_modes: []const OptimizeMode,
|
||||||
enable_macos_sdk: bool,
|
enable_macos_sdk: bool,
|
||||||
omit_stage2: bool,
|
omit_stage2: bool,
|
||||||
enable_symlinks_windows: bool,
|
enable_symlinks_windows: bool,
|
||||||
) *build.Step {
|
) *Step {
|
||||||
const cases = b.allocator.create(StandaloneContext) catch unreachable;
|
const cases = b.allocator.create(StandaloneContext) catch unreachable;
|
||||||
cases.* = StandaloneContext{
|
cases.* = StandaloneContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -556,7 +556,7 @@ pub fn addLinkTests(
|
|||||||
return cases.step;
|
return cases.step;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addCliTests(b: *build.Builder, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *build.Step {
|
pub fn addCliTests(b: *std.Build, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *Step {
|
||||||
_ = test_filter;
|
_ = test_filter;
|
||||||
_ = optimize_modes;
|
_ = optimize_modes;
|
||||||
const step = b.step("test-cli", "Test the command line interface");
|
const step = b.step("test-cli", "Test the command line interface");
|
||||||
@ -577,7 +577,7 @@ pub fn addCliTests(b: *build.Builder, test_filter: ?[]const u8, optimize_modes:
|
|||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addAssembleAndLinkTests(b: *build.Builder, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *build.Step {
|
pub fn addAssembleAndLinkTests(b: *std.Build, test_filter: ?[]const u8, optimize_modes: []const OptimizeMode) *Step {
|
||||||
const cases = b.allocator.create(CompareOutputContext) catch unreachable;
|
const cases = b.allocator.create(CompareOutputContext) catch unreachable;
|
||||||
cases.* = CompareOutputContext{
|
cases.* = CompareOutputContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -592,7 +592,7 @@ pub fn addAssembleAndLinkTests(b: *build.Builder, test_filter: ?[]const u8, opti
|
|||||||
return cases.step;
|
return cases.step;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addTranslateCTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
|
pub fn addTranslateCTests(b: *std.Build, test_filter: ?[]const u8) *Step {
|
||||||
const cases = b.allocator.create(TranslateCContext) catch unreachable;
|
const cases = b.allocator.create(TranslateCContext) catch unreachable;
|
||||||
cases.* = TranslateCContext{
|
cases.* = TranslateCContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -607,10 +607,10 @@ pub fn addTranslateCTests(b: *build.Builder, test_filter: ?[]const u8) *build.St
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn addRunTranslatedCTests(
|
pub fn addRunTranslatedCTests(
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
target: std.zig.CrossTarget,
|
target: std.zig.CrossTarget,
|
||||||
) *build.Step {
|
) *Step {
|
||||||
const cases = b.allocator.create(RunTranslatedCContext) catch unreachable;
|
const cases = b.allocator.create(RunTranslatedCContext) catch unreachable;
|
||||||
cases.* = .{
|
cases.* = .{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -625,7 +625,7 @@ pub fn addRunTranslatedCTests(
|
|||||||
return cases.step;
|
return cases.step;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
|
pub fn addGenHTests(b: *std.Build, test_filter: ?[]const u8) *Step {
|
||||||
const cases = b.allocator.create(GenHContext) catch unreachable;
|
const cases = b.allocator.create(GenHContext) catch unreachable;
|
||||||
cases.* = GenHContext{
|
cases.* = GenHContext{
|
||||||
.b = b,
|
.b = b,
|
||||||
@ -640,7 +640,7 @@ pub fn addGenHTests(b: *build.Builder, test_filter: ?[]const u8) *build.Step {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn addPkgTests(
|
pub fn addPkgTests(
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
root_src: []const u8,
|
root_src: []const u8,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
@ -651,7 +651,7 @@ pub fn addPkgTests(
|
|||||||
skip_libc: bool,
|
skip_libc: bool,
|
||||||
skip_stage1: bool,
|
skip_stage1: bool,
|
||||||
skip_stage2: bool,
|
skip_stage2: bool,
|
||||||
) *build.Step {
|
) *Step {
|
||||||
const step = b.step(b.fmt("test-{s}", .{name}), desc);
|
const step = b.step(b.fmt("test-{s}", .{name}), desc);
|
||||||
|
|
||||||
for (test_targets) |test_target| {
|
for (test_targets) |test_target| {
|
||||||
@ -742,8 +742,8 @@ pub fn addPkgTests(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub const StackTracesContext = struct {
|
pub const StackTracesContext = struct {
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
step: *build.Step,
|
step: *Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
optimize_modes: []const OptimizeMode,
|
optimize_modes: []const OptimizeMode,
|
||||||
@ -840,7 +840,7 @@ pub const StackTracesContext = struct {
|
|||||||
const RunAndCompareStep = struct {
|
const RunAndCompareStep = struct {
|
||||||
pub const base_id = .custom;
|
pub const base_id = .custom;
|
||||||
|
|
||||||
step: build.Step,
|
step: Step,
|
||||||
context: *StackTracesContext,
|
context: *StackTracesContext,
|
||||||
exe: *LibExeObjStep,
|
exe: *LibExeObjStep,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
@ -858,7 +858,7 @@ pub const StackTracesContext = struct {
|
|||||||
const allocator = context.b.allocator;
|
const allocator = context.b.allocator;
|
||||||
const ptr = allocator.create(RunAndCompareStep) catch unreachable;
|
const ptr = allocator.create(RunAndCompareStep) catch unreachable;
|
||||||
ptr.* = RunAndCompareStep{
|
ptr.* = RunAndCompareStep{
|
||||||
.step = build.Step.init(.custom, "StackTraceCompareOutputStep", allocator, make),
|
.step = Step.init(.custom, "StackTraceCompareOutputStep", allocator, make),
|
||||||
.context = context,
|
.context = context,
|
||||||
.exe = exe,
|
.exe = exe,
|
||||||
.name = name,
|
.name = name,
|
||||||
@ -871,7 +871,7 @@ pub const StackTracesContext = struct {
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *build.Step) !void {
|
fn make(step: *Step) !void {
|
||||||
const self = @fieldParentPtr(RunAndCompareStep, "step", step);
|
const self = @fieldParentPtr(RunAndCompareStep, "step", step);
|
||||||
const b = self.context.b;
|
const b = self.context.b;
|
||||||
|
|
||||||
@ -1014,8 +1014,8 @@ pub const StackTracesContext = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const StandaloneContext = struct {
|
pub const StandaloneContext = struct {
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
step: *build.Step,
|
step: *Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
optimize_modes: []const OptimizeMode,
|
optimize_modes: []const OptimizeMode,
|
||||||
@ -1150,8 +1150,8 @@ pub const StandaloneContext = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub const GenHContext = struct {
|
pub const GenHContext = struct {
|
||||||
b: *build.Builder,
|
b: *std.Build,
|
||||||
step: *build.Step,
|
step: *Step,
|
||||||
test_index: usize,
|
test_index: usize,
|
||||||
test_filter: ?[]const u8,
|
test_filter: ?[]const u8,
|
||||||
|
|
||||||
@ -1178,7 +1178,7 @@ pub const GenHContext = struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const GenHCmpOutputStep = struct {
|
const GenHCmpOutputStep = struct {
|
||||||
step: build.Step,
|
step: Step,
|
||||||
context: *GenHContext,
|
context: *GenHContext,
|
||||||
obj: *LibExeObjStep,
|
obj: *LibExeObjStep,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
@ -1194,7 +1194,7 @@ pub const GenHContext = struct {
|
|||||||
const allocator = context.b.allocator;
|
const allocator = context.b.allocator;
|
||||||
const ptr = allocator.create(GenHCmpOutputStep) catch unreachable;
|
const ptr = allocator.create(GenHCmpOutputStep) catch unreachable;
|
||||||
ptr.* = GenHCmpOutputStep{
|
ptr.* = GenHCmpOutputStep{
|
||||||
.step = build.Step.init(.Custom, "ParseCCmpOutput", allocator, make),
|
.step = Step.init(.Custom, "ParseCCmpOutput", allocator, make),
|
||||||
.context = context,
|
.context = context,
|
||||||
.obj = obj,
|
.obj = obj,
|
||||||
.name = name,
|
.name = name,
|
||||||
@ -1206,7 +1206,7 @@ pub const GenHContext = struct {
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make(step: *build.Step) !void {
|
fn make(step: *Step) !void {
|
||||||
const self = @fieldParentPtr(GenHCmpOutputStep, "step", step);
|
const self = @fieldParentPtr(GenHCmpOutputStep, "step", step);
|
||||||
const b = self.context.b;
|
const b = self.context.b;
|
||||||
|
|
||||||
@ -1348,7 +1348,7 @@ const c_abi_targets = [_]CrossTarget{
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn addCAbiTests(b: *build.Builder, skip_non_native: bool, skip_release: bool) *build.Step {
|
pub fn addCAbiTests(b: *std.Build, skip_non_native: bool, skip_release: bool) *Step {
|
||||||
const step = b.step("test-c-abi", "Run the C ABI tests");
|
const step = b.step("test-c-abi", "Run the C ABI tests");
|
||||||
|
|
||||||
const optimize_modes: [2]OptimizeMode = .{ .Debug, .ReleaseFast };
|
const optimize_modes: [2]OptimizeMode = .{ .Debug, .ReleaseFast };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user