Files
ghostty/src/build/GhosttyBench.zig
Chris Marchesi e8525c0fd9 Update to Zig 0.16.0
This commit represents the majority of the work necessary to upgrade
Ghostty to use Zig 0.16.0.

Key parts:

* In addition to its previous responsibilities, the global state now
  houses state for global I/O implementations and the process
  environment. It is now also utilized in the main application along
  with the C library. Where necessary, global state is isolated from key
  parts of the implementation (e.g., in libghostty subsystems), and it's
  expected that this list will grow.

* We currently manage our own C translation layer where necessary. In
  these cases, cImport has been removed in favor of the new external
  translate-c package. Due to fixes that have needed be made to properly
  translate the dependencies that were swapped out, as mentioned, we
  have had to backport fixes from the current translate-c package (and
  the upstream Arocc dependency). We will host this ourselves until Zig
  0.17.0 is released with these fixes.

* Where necessary (only a small number of cases), some stdlib code from
  0.15.2 (and even from 0.17.0) has been taken, adopted, and vendored in
  lib/compat.

Co-authored-by: Leah Amelia Chen <hi@pluie.me>
2026-07-21 12:35:05 -07:00

56 lines
1.6 KiB
Zig

//! GhosttyBench generates all the Ghostty benchmark helper binaries.
const GhosttyBench = @This();
const std = @import("std");
const SharedDeps = @import("SharedDeps.zig");
steps: []*std.Build.Step.Compile,
pub fn init(
b: *std.Build,
deps: *const SharedDeps,
) !GhosttyBench {
var steps: std.ArrayList(*std.Build.Step.Compile) = .empty;
errdefer steps.deinit(b.allocator);
// Our synthetic data generator
{
const exe = b.addExecutable(.{
.name = "ghostty-gen",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main_gen.zig"),
.target = deps.config.target,
// We always want our datagen to be fast because it
// takes awhile to run.
.optimize = .ReleaseFast,
.link_libc = true,
}),
});
_ = try deps.add(exe);
try steps.append(b.allocator, exe);
}
// Our benchmarking application.
{
const exe = b.addExecutable(.{
.name = "ghostty-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main_bench.zig"),
.target = deps.config.target,
// We always want our benchmarks to be in release mode.
.optimize = .ReleaseFast,
.link_libc = true,
}),
});
_ = try deps.add(exe);
try steps.append(b.allocator, exe);
}
return .{ .steps = steps.items };
}
pub fn install(self: *const GhosttyBench) void {
const b = self.steps[0].step.owner;
for (self.steps) |step| b.installArtifact(step);
}