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/simdutf/build.zig | |
| parent | 55c138263e190a1e79d4b997bfb9397306c0ec1f (diff) | |
feat: finish ghostty pane backend integration
Diffstat (limited to 'vendor/libghostty-vt/pkg/simdutf/build.zig')
| -rw-r--r-- | vendor/libghostty-vt/pkg/simdutf/build.zig | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/pkg/simdutf/build.zig b/vendor/libghostty-vt/pkg/simdutf/build.zig new file mode 100644 index 00000000..e132507a --- /dev/null +++ b/vendor/libghostty-vt/pkg/simdutf/build.zig @@ -0,0 +1,81 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) !void { + const optimize = b.standardOptimizeOption(.{}); + const target = b.standardTargetOptions(.{}); + + const lib = b.addLibrary(.{ + .name = "simdutf", + .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(); + } + lib.addIncludePath(b.path("vendor")); + + 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); + // Zig 0.13 bug: https://github.com/ziglang/zig/issues/20414 + // (See root Ghostty build.zig on why we do this) + try flags.appendSlice(b.allocator, &.{ + "-DSIMDUTF_IMPLEMENTATION_ICELAKE=0", + + // 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"); + } + + lib.addCSourceFiles(.{ + .flags = flags.items, + .files = &.{ + "vendor/simdutf.cpp", + }, + }); + lib.installHeadersDirectory( + b.path("vendor"), + "", + .{ .include_extensions = &.{".h"} }, + ); + + b.installArtifact(lib); + + // { + // const test_exe = b.addTest(.{ + // .name = "test", + // .root_source_file = .{ .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); + // } +} |
