bd44b5aa08
Test / build-libghostty-vt (x86_64-windows-gnu) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-ios) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt-macos (x86_64-macos) (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-dist (push) Has been cancelled
Test / GTK x11=true wayland=true (push) Has been cancelled
Test / Build -Dsimd=false (push) Has been cancelled
Test / Build -Dsimd=true (push) Has been cancelled
Test / Build -Dsentry=false (push) Has been cancelled
Test / Build -Dsentry=true (push) Has been cancelled
Test / zig-fmt (push) Has been cancelled
Test / GitHub Actions Pins (push) Has been cancelled
Test / prettier (push) Has been cancelled
Test / swiftlint (push) Has been cancelled
Test / alejandra (push) Has been cancelled
Test / typos (push) Has been cancelled
Nix / Required Checks: Nix (push) Has been cancelled
Nix / check-zig-cache-hash (push) Has been cancelled
Test / skip (push) Has been cancelled
Test / Required Checks: Test (push) Has been cancelled
Test / build-bench (push) Has been cancelled
Test / list-examples (push) Has been cancelled
Test / Example ${{ matrix.dir }} (Windows) (push) Has been cancelled
Test / build-cmake (push) Has been cancelled
Test / test-lib-vt-pkgconfig (push) Has been cancelled
Test / build-flatpak (push) Has been cancelled
Test / build-snap (push) Has been cancelled
Test / build-libghostty-vt (aarch64-linux) (push) Has been cancelled
Test / build-libghostty-vt (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt (wasm32-freestanding) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux-musl) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-macos) (push) Has been cancelled
Test / build-libghostty-vt-android (aarch64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-android (arm-linux-androideabi) (push) Has been cancelled
Test / build-libghostty-vt-android (x86_64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-windows (push) Has been cancelled
Test / build-libghostty-windows-gnu (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-linux-libghostty (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-dist-lib-vt (push) Has been cancelled
Test / trigger-snap (push) Has been cancelled
Test / trigger-flatpak (push) Has been cancelled
Test / build-macos (push) Has been cancelled
Test / build-macos-freetype (push) Has been cancelled
Test / test (push) Has been cancelled
Test / test-lib-vt (push) Has been cancelled
Test / GTK x11=false wayland=false (push) Has been cancelled
Test / GTK x11=true wayland=false (push) Has been cancelled
Test / GTK x11=false wayland=true (push) Has been cancelled
Test / test-macos (push) Has been cancelled
Test / test-windows (push) Has been cancelled
Test / Build -Di18n=false (push) Has been cancelled
Test / Build -Di18n=true (push) Has been cancelled
Test / Build test/fuzz-libghostty (push) Has been cancelled
Test / shellcheck (push) Has been cancelled
Test / translations (push) Has been cancelled
Test / blueprint-compiler (push) Has been cancelled
Test / Test pkg/wuffs (push) Has been cancelled
Test / Test build on Debian 13 (push) Has been cancelled
Test / valgrind (push) Has been cancelled
Test / Example ${{ matrix.dir }} (push) Has been cancelled
139 lines
4.0 KiB
Zig
139 lines
4.0 KiB
Zig
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("src/main.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
const lib = b.addLibrary(.{
|
|
.name = "highway",
|
|
.root_module = b.createModule(.{
|
|
.root_source_file = b.path("src/detect.zig"),
|
|
.target = target,
|
|
.optimize = optimize,
|
|
}),
|
|
.linkage = .static,
|
|
});
|
|
|
|
// Our highway package is free of libc at runtime (uses no symbols)
|
|
// but does require libc headers at compile time.
|
|
lib.linkLibC();
|
|
|
|
lib.addIncludePath(b.path("src/cpp"));
|
|
if (upstream_) |upstream| {
|
|
lib.addIncludePath(upstream.path(""));
|
|
module.addIncludePath(upstream.path(""));
|
|
}
|
|
|
|
if (target.result.abi.isAndroid()) {
|
|
const android_ndk = @import("android_ndk");
|
|
try android_ndk.addPaths(b, lib);
|
|
}
|
|
|
|
// Mainly for iOS simulators, but we add for all Darwin target for
|
|
// consistency.
|
|
if (target.result.os.tag.isDarwin()) {
|
|
const apple_sdk = @import("apple_sdk");
|
|
try apple_sdk.addPaths(b, lib);
|
|
}
|
|
|
|
var flags: std.ArrayList([]const u8) = .empty;
|
|
defer flags.deinit(b.allocator);
|
|
try flags.appendSlice(b.allocator, &.{
|
|
// Highway can avoid libc++ entirely as long as all users compile
|
|
// against the headers with the same define.
|
|
"-DHWY_NO_LIBCXX",
|
|
|
|
// 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.os.tag == .linux) {
|
|
try flags.append(b.allocator, "-fPIC");
|
|
lib.root_module.pic = true;
|
|
}
|
|
|
|
if (target.result.os.tag != .windows) {
|
|
try flags.appendSlice(b.allocator, &.{
|
|
"-fmath-errno",
|
|
"-fno-exceptions",
|
|
});
|
|
}
|
|
|
|
lib.addCSourceFiles(.{ .flags = flags.items, .files = &.{
|
|
"src/cpp/abort.cc",
|
|
"src/cpp/per_target.cc",
|
|
"src/cpp/targets.cpp",
|
|
} });
|
|
|
|
if (upstream_) |upstream| {
|
|
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("src/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);
|
|
}
|
|
}
|