aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/terminal/build_options.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-04-04 19:22:04 +0300
committerCan Celik <ogulcancelik@gmail.com>2026-04-05 01:23:06 +0300
commit41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch)
tree3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/src/terminal/build_options.zig
parent55c138263e190a1e79d4b997bfb9397306c0ec1f (diff)
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/src/terminal/build_options.zig')
-rw-r--r--vendor/libghostty-vt/src/terminal/build_options.zig80
1 files changed, 80 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/terminal/build_options.zig b/vendor/libghostty-vt/src/terminal/build_options.zig
new file mode 100644
index 00000000..6c0a4df6
--- /dev/null
+++ b/vendor/libghostty-vt/src/terminal/build_options.zig
@@ -0,0 +1,80 @@
+const std = @import("std");
+
+/// Options set by Zig build.zig and exposed via `terminal_options`.
+pub const Options = struct {
+ /// The target artifact to build. This will gate some functionality.
+ artifact: Artifact,
+
+ /// Whether Oniguruma regex support is available. If this isn't
+ /// available, some features will be disabled. This may be outdated,
+ /// but the specific disabled features are:
+ ///
+ /// - Kitty graphics protocol
+ /// - Tmux control mode
+ ///
+ oniguruma: bool,
+
+ /// Whether to build SIMD-accelerated code paths. This pulls in more
+ /// build-time dependencies and adds libc as a runtime dependency,
+ /// but results in significant performance improvements.
+ simd: bool,
+
+ /// True if we should enable the "slow" runtime safety checks. These
+ /// are runtime safety checks that are slower than typical and should
+ /// generally be disabled in production builds.
+ slow_runtime_safety: bool,
+
+ /// Force C ABI mode on or off. If not set, then it will be set based on
+ /// Options.
+ c_abi: bool,
+
+ /// The version of the application.
+ version: std.SemanticVersion,
+
+ /// Add the required build options for the terminal module.
+ ///
+ /// The memory referenced by self is expected to stick around (it isn't
+ /// copied), since we expect we're in a build environment.
+ pub fn add(
+ self: Options,
+ b: *std.Build,
+ m: *std.Build.Module,
+ ) void {
+ const opts = b.addOptions();
+ opts.addOption(Artifact, "artifact", self.artifact);
+ opts.addOption(bool, "c_abi", self.c_abi);
+ opts.addOption(bool, "oniguruma", self.oniguruma);
+ opts.addOption(bool, "simd", self.simd);
+ opts.addOption(bool, "slow_runtime_safety", self.slow_runtime_safety);
+
+ // These are synthesized based on other options.
+ opts.addOption(bool, "kitty_graphics", self.oniguruma);
+ opts.addOption(bool, "tmux_control_mode", self.oniguruma);
+
+ // Version information.
+ var buf: [1024]u8 = undefined;
+ opts.addOption(
+ []const u8,
+ "version_string",
+ std.fmt.bufPrint(
+ &buf,
+ "{f}",
+ .{self.version},
+ ) catch @panic("version string too long"),
+ );
+ opts.addOption(usize, "version_major", self.version.major);
+ opts.addOption(usize, "version_minor", self.version.minor);
+ opts.addOption(usize, "version_patch", self.version.patch);
+ opts.addOption(?[]const u8, "version_build", self.version.build);
+
+ m.addOptions("terminal_options", opts);
+ }
+};
+
+pub const Artifact = enum {
+ /// Ghostty application
+ ghostty,
+
+ /// libghostty-vt, Zig module
+ lib,
+};