Files
ghostty/src/main.zig
Mitchell Hashimoto f2a7652aba mitchell's touchups
- benchmark: avoid buffers to avoid a memcpy
- build: keep frame pointers on macOS. There was some debug changes from
  Zig 0.15 and this helps. Also, Apple actually requires/expects x29 to
  always be a frame pointer.
- build/macos: force libSystem symbols instead of compiler-rt
- global: add InitOpts.tool so that ghostty-gen/bench can parse their
  own actions in `+action`
- quirks: provide our own vectorized memset. see the comment for more
  details why.
- synthetic: fix UB by accessing global.io before it was initialized
- terminal/hash_map: force inline for unique repr types. Zig 0.15
  inlined and 0.16 doesn't, measured a huge slowdown in hyperlink
  benchmarks.
- terminal: add explicit `@Vector` usage for storing a run of identical cells
  as well as for scanning printable cells. This auto-vectorized in Zig
  0.15 but not in Zig 0.16. This produces the same assembly.
- unicode: properties and LUT need power-of-two backing integer to avoid
  bad LLVM codegen
2026-07-21 17:19:16 -07:00

39 lines
1.4 KiB
Zig

const std = @import("std");
const build_config = @import("build_config.zig");
/// See build_config.ExeEntrypoint for why we do this.
const entrypoint = switch (build_config.exe_entrypoint) {
.ghostty => @import("main_ghostty.zig"),
.helpgen => @import("helpgen.zig"),
.mdgen_ghostty_1 => @import("build/mdgen/main_ghostty_1.zig"),
.mdgen_ghostty_5 => @import("build/mdgen/main_ghostty_5.zig"),
.webgen_config => @import("build/webgen/main_config.zig"),
.webgen_actions => @import("build/webgen/main_actions.zig"),
.webgen_commands => @import("build/webgen/main_commands.zig"),
};
/// The main entrypoint for the program.
pub const main = entrypoint.main;
/// Standard options such as logger overrides.
pub const std_options: std.Options = if (@hasDecl(entrypoint, "std_options"))
entrypoint.std_options
else
.{};
comptime {
// Force-reference our memset override so its export is emitted.
// See quirks_memset.zig for details on why this exists.
_ = @import("quirks_memset.zig");
}
test {
// Zig 0.16.0 has made test logging more strict. Now, *anything* that gets
// printed to stderr results in a "failed command" message, even if the
// tests ultimately passed. To reduce confusion here (and honestly, test
// log spam in general), we bump the default testing log level to error.
std.testing.log_level = std.log.Level.err;
_ = entrypoint;
_ = @import("quirks_memset.zig");
}