mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
move simdutf to a pkg
This commit is contained in:
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1,6 +1,5 @@
|
|||||||
vendor/** linguist-vendored
|
vendor/** linguist-vendored
|
||||||
website/** linguist-documentation
|
website/** linguist-documentation
|
||||||
pkg/cimgui/vendor/** linguist-vendored
|
pkg/cimgui/vendor/** linguist-vendored
|
||||||
src/simd/simdutf.h linguist-vendored
|
pkg/simdutf/vendor/** linguist-vendored
|
||||||
src/simd/simdutf.cpp linguist-vendored
|
|
||||||
src/terminal/res/** linguist-vendored
|
src/terminal/res/** linguist-vendored
|
||||||
|
10
build.zig
10
build.zig
@ -951,6 +951,10 @@ fn addDeps(
|
|||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
const simdutf_dep = b.dependency("simdutf", .{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
const libpng_dep = b.dependency("libpng", .{
|
const libpng_dep = b.dependency("libpng", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
@ -1006,10 +1010,8 @@ fn addDeps(
|
|||||||
// C++ files
|
// C++ files
|
||||||
step.linkLibCpp();
|
step.linkLibCpp();
|
||||||
step.addIncludePath(.{ .path = "src" });
|
step.addIncludePath(.{ .path = "src" });
|
||||||
step.addIncludePath(.{ .path = "src/simd" });
|
|
||||||
step.addCSourceFiles(.{ .files = &.{
|
step.addCSourceFiles(.{ .files = &.{
|
||||||
"src/simd/index_of.cpp",
|
"src/simd/index_of.cpp",
|
||||||
"src/simd/simdutf.cpp",
|
|
||||||
"src/simd/vt.cpp",
|
"src/simd/vt.cpp",
|
||||||
} });
|
} });
|
||||||
|
|
||||||
@ -1067,6 +1069,10 @@ fn addDeps(
|
|||||||
step.linkLibrary(highway_dep.artifact("highway"));
|
step.linkLibrary(highway_dep.artifact("highway"));
|
||||||
try static_libs.append(highway_dep.artifact("highway").getEmittedBin());
|
try static_libs.append(highway_dep.artifact("highway").getEmittedBin());
|
||||||
|
|
||||||
|
// simdutf
|
||||||
|
step.linkLibrary(simdutf_dep.artifact("simdutf"));
|
||||||
|
try static_libs.append(simdutf_dep.artifact("simdutf").getEmittedBin());
|
||||||
|
|
||||||
// Spirv-Cross
|
// Spirv-Cross
|
||||||
step.linkLibrary(spirv_cross_dep.artifact("spirv_cross"));
|
step.linkLibrary(spirv_cross_dep.artifact("spirv_cross"));
|
||||||
try static_libs.append(spirv_cross_dep.artifact("spirv_cross").getEmittedBin());
|
try static_libs.append(spirv_cross_dep.artifact("spirv_cross").getEmittedBin());
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
.oniguruma = .{ .path = "./pkg/oniguruma" },
|
.oniguruma = .{ .path = "./pkg/oniguruma" },
|
||||||
.opengl = .{ .path = "./pkg/opengl" },
|
.opengl = .{ .path = "./pkg/opengl" },
|
||||||
.pixman = .{ .path = "./pkg/pixman" },
|
.pixman = .{ .path = "./pkg/pixman" },
|
||||||
|
.simdutf = .{ .path = "./pkg/simdutf" },
|
||||||
.zlib = .{ .path = "./pkg/zlib" },
|
.zlib = .{ .path = "./pkg/zlib" },
|
||||||
|
|
||||||
// Shader translation
|
// Shader translation
|
||||||
|
62
pkg/simdutf/build.zig
Normal file
62
pkg/simdutf/build.zig
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) !void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
const module = b.addModule("simdutf", .{
|
||||||
|
.root_source_file = .{ .path = "main.zig" },
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
|
||||||
|
const lib = b.addStaticLibrary(.{
|
||||||
|
.name = "simdutf",
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
lib.linkLibCpp();
|
||||||
|
lib.addIncludePath(.{ .path = "vendor" });
|
||||||
|
module.addIncludePath(.{ .path = "vendor" });
|
||||||
|
|
||||||
|
if (target.result.isDarwin()) {
|
||||||
|
const apple_sdk = @import("apple_sdk");
|
||||||
|
try apple_sdk.addPaths(b, &lib.root_module);
|
||||||
|
try apple_sdk.addPaths(b, module);
|
||||||
|
}
|
||||||
|
|
||||||
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
|
defer flags.deinit();
|
||||||
|
try flags.appendSlice(&.{});
|
||||||
|
|
||||||
|
lib.addCSourceFiles(.{
|
||||||
|
.flags = flags.items,
|
||||||
|
.files = &.{
|
||||||
|
"vendor/simdutf.cpp",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
lib.installHeadersDirectoryOptions(.{
|
||||||
|
.source_dir = .{ .path = "vendor" },
|
||||||
|
.install_dir = .header,
|
||||||
|
.install_subdir = "",
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
}
|
8
pkg/simdutf/build.zig.zon
Normal file
8
pkg/simdutf/build.zig.zon
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
.{
|
||||||
|
.name = "simdutf",
|
||||||
|
.version = "4.0.9",
|
||||||
|
.paths = .{""},
|
||||||
|
.dependencies = .{
|
||||||
|
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||||
|
},
|
||||||
|
}
|
0
pkg/simdutf/main.zig
Normal file
0
pkg/simdutf/main.zig
Normal file
Reference in New Issue
Block a user