diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-04-04 19:22:04 +0300 |
|---|---|---|
| committer | Can Celik <ogulcancelik@gmail.com> | 2026-04-05 01:23:06 +0300 |
| commit | 41dd733ca7123c9ac4bfc6c781697a660e95b052 (patch) | |
| tree | 3fc91815ca139ef2e0b281bba0abda4ef15175f4 /vendor/libghostty-vt/pkg/highway | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/pkg/highway')
| -rw-r--r-- | vendor/libghostty-vt/pkg/highway/bridge.cpp | 9 | ||||
| -rw-r--r-- | vendor/libghostty-vt/pkg/highway/build.zig | 141 | ||||
| -rw-r--r-- | vendor/libghostty-vt/pkg/highway/build.zig.zon | 17 | ||||
| -rw-r--r-- | vendor/libghostty-vt/pkg/highway/main.zig | 57 |
4 files changed, 224 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/pkg/highway/bridge.cpp b/vendor/libghostty-vt/pkg/highway/bridge.cpp new file mode 100644 index 00000000..1e86c493 --- /dev/null +++ b/vendor/libghostty-vt/pkg/highway/bridge.cpp @@ -0,0 +1,9 @@ +#include <hwy/targets.h> +#include <stdint.h> + +extern "C" { + +int64_t hwy_supported_targets() { + return HWY_SUPPORTED_TARGETS; +} +} diff --git a/vendor/libghostty-vt/pkg/highway/build.zig b/vendor/libghostty-vt/pkg/highway/build.zig new file mode 100644 index 00000000..49656b93 --- /dev/null +++ b/vendor/libghostty-vt/pkg/highway/build.zig @@ -0,0 +1,141 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const upstream_ = b.lazyDependency("highway", .{}); + + const module = b.addModule("highway", .{ + .root_source_file = b.path("main.zig"), + .target = target, + .optimize = optimize, + }); + + const lib = b.addLibrary(.{ + .name = "highway", + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + }), + .linkage = .static, + }); + lib.linkLibC(); + // On MSVC, we must not use linkLibCpp because Zig unconditionally + // passes -nostdinc++ and then adds its bundled libc++/libc++abi + // include paths, which conflict with MSVC's own C++ runtime headers. + // The MSVC SDK include directories (added via linkLibC) contain + // both C and C++ headers, so linkLibCpp is not needed. + if (target.result.abi != .msvc) { + lib.linkLibCpp(); + } + if (upstream_) |upstream| { + lib.addIncludePath(upstream.path("")); + module.addIncludePath(upstream.path("")); + } + + if (target.result.os.tag.isDarwin()) { + const apple_sdk = @import("apple_sdk"); + try apple_sdk.addPaths(b, lib); + } + + if (target.result.abi.isAndroid()) { + const android_ndk = @import("android_ndk"); + try android_ndk.addPaths(b, lib); + } + + var flags: std.ArrayList([]const u8) = .empty; + defer flags.deinit(b.allocator); + try flags.appendSlice(b.allocator, &.{ + // Avoid changing binaries based on the current time and date. + "-Wno-builtin-macro-redefined", + "-D__DATE__=\"redacted\"", + "-D__TIMESTAMP__=\"redacted\"", + "-D__TIME__=\"redacted\"", + + // Optimizations + "-fmerge-all-constants", + + // Warnings + "-Wall", + "-Wextra", + + // These are not included in Wall nor Wextra: + "-Wconversion", + "-Wsign-conversion", + "-Wvla", + "-Wnon-virtual-dtor", + + "-Wfloat-overflow-conversion", + "-Wfloat-zero-conversion", + "-Wfor-loop-analysis", + "-Wgnu-redeclared-enum", + "-Winfinite-recursion", + "-Wself-assign", + "-Wstring-conversion", + "-Wtautological-overlap-compare", + "-Wthread-safety-analysis", + "-Wundefined-func-template", + + "-fno-cxx-exceptions", + "-fno-slp-vectorize", + "-fno-vectorize", + + // Fixes linker issues for release builds missing ubsanitizer symbols + "-fno-sanitize=undefined", + "-fno-sanitize-trap=undefined", + }); + + if (target.result.os.tag == .freebsd or target.result.abi == .musl) { + try flags.append(b.allocator, "-fPIC"); + } + + if (target.result.os.tag != .windows) { + try flags.appendSlice(b.allocator, &.{ + "-fmath-errno", + "-fno-exceptions", + }); + } + + lib.addCSourceFiles(.{ .flags = flags.items, .files = &.{"bridge.cpp"} }); + if (upstream_) |upstream| { + lib.addCSourceFiles(.{ + .root = upstream.path(""), + .flags = flags.items, + .files = &.{ + "hwy/abort.cc", + "hwy/aligned_allocator.cc", + "hwy/nanobenchmark.cc", + "hwy/per_target.cc", + "hwy/print.cc", + "hwy/targets.cc", + "hwy/timer.cc", + }, + }); + lib.installHeadersDirectory( + upstream.path("hwy"), + "hwy", + .{ .include_extensions = &.{".h"} }, + ); + } + + b.installArtifact(lib); + + { + const test_exe = b.addTest(.{ + .name = "test", + .root_module = b.createModule(.{ + .root_source_file = b.path("main.zig"), + .target = target, + .optimize = optimize, + }), + }); + test_exe.linkLibrary(lib); + + var it = module.import_table.iterator(); + while (it.next()) |entry| test_exe.root_module.addImport(entry.key_ptr.*, entry.value_ptr.*); + const tests_run = b.addRunArtifact(test_exe); + const test_step = b.step("test", "Run tests"); + test_step.dependOn(&tests_run.step); + } +} diff --git a/vendor/libghostty-vt/pkg/highway/build.zig.zon b/vendor/libghostty-vt/pkg/highway/build.zig.zon new file mode 100644 index 00000000..4870d1db --- /dev/null +++ b/vendor/libghostty-vt/pkg/highway/build.zig.zon @@ -0,0 +1,17 @@ +.{ + .name = .highway, + .version = "1.2.0", + .fingerprint = 0xdbcf1a7425023274, + .paths = .{""}, + .dependencies = .{ + // google/highway + .highway = .{ + .url = "https://deps.files.ghostty.org/highway-66486a10623fa0d72fe91260f96c892e41aceb06.tar.gz", + .hash = "N-V-__8AAGmZhABbsPJLfbqrh6JTHsXhY6qCaLAQyx25e0XE", + .lazy = true, + }, + + .apple_sdk = .{ .path = "../apple-sdk" }, + .android_ndk = .{ .path = "../android-ndk" }, + }, +} diff --git a/vendor/libghostty-vt/pkg/highway/main.zig b/vendor/libghostty-vt/pkg/highway/main.zig new file mode 100644 index 00000000..95ba6cda --- /dev/null +++ b/vendor/libghostty-vt/pkg/highway/main.zig @@ -0,0 +1,57 @@ +extern "c" fn hwy_supported_targets() i64; + +pub const Targets = packed struct(i64) { + // x86_64 + _reserved: u4 = 0, + avx3_spr: bool = false, + _reserved_5: u1 = 0, + avx3_zen4: bool = false, + avx3_dl: bool = false, + avx3: bool = false, + avx2: bool = false, + _reserved_10: u1 = 0, + sse4: bool = false, + ssse3: bool = false, + _reserved_13: u1 = 0, // SSE3 reserved + sse2: bool = false, + _reserved_15_23: u9 = 0, + + // aarch64 + sve2_128: bool = false, + sve_256: bool = false, + sve2: bool = false, + sve: bool = false, + neon: bool = false, + neon_without_aes: bool = false, + _reserved_30_36: u6 = 0, + + // risc-v + rvv: bool = false, + _reserved_38_46: u9 = 0, + + // IBM Power + ppc10: bool = false, + ppc9: bool = false, + ppc8: bool = false, + z15: bool = false, + z14: bool = false, + _reserved_52_57: u6 = 0, + + // WebAssembly + wasm_emu256: bool = false, + wasm: bool = false, + _reserved_60_61: u2 = 0, + + // Emulation + emu128: bool = false, + scalar: bool = false, + _reserved_63: u1 = 0, +}; + +pub fn supported_targets() Targets { + return @bitCast(hwy_supported_targets()); +} + +test { + _ = supported_targets(); +} |
