Add system integration for highway

pull/9642/head
LN Liberda 2025-10-08 05:24:30 +02:00
parent 1f1a5e9c3f
commit 3e5c4590da
1 changed files with 15 additions and 10 deletions

View File

@ -719,15 +719,19 @@ pub fn addSimd(
} }
// Highway // Highway
if (b.lazyDependency("highway", .{ if (b.systemIntegrationOption("highway", .{})) {
.target = target, m.linkSystemLibrary("libhwy", dynamic_link_opts);
.optimize = optimize, } else {
})) |highway_dep| { if (b.lazyDependency("highway", .{
m.linkLibrary(highway_dep.artifact("highway")); .target = target,
if (static_libs) |v| try v.append( .optimize = optimize,
b.allocator, })) |highway_dep| {
highway_dep.artifact("highway").getEmittedBin(), m.linkLibrary(highway_dep.artifact("highway"));
); if (static_libs) |v| try v.append(
b.allocator,
highway_dep.artifact("highway").getEmittedBin(),
);
}
} }
// utfcpp - This is used as a dependency on our hand-written C++ code // utfcpp - This is used as a dependency on our hand-written C++ code
@ -746,6 +750,7 @@ pub fn addSimd(
m.addIncludePath(b.path("src")); m.addIncludePath(b.path("src"));
{ {
// From hwy/detect_targets.h // From hwy/detect_targets.h
const HWY_AVX10_2: c_int = 1 << 3;
const HWY_AVX3_SPR: c_int = 1 << 4; const HWY_AVX3_SPR: c_int = 1 << 4;
const HWY_AVX3_ZEN4: c_int = 1 << 6; const HWY_AVX3_ZEN4: c_int = 1 << 6;
const HWY_AVX3_DL: c_int = 1 << 7; const HWY_AVX3_DL: c_int = 1 << 7;
@ -756,7 +761,7 @@ pub fn addSimd(
// The performance difference between AVX2 and AVX512 is not // The performance difference between AVX2 and AVX512 is not
// significant for our use case and AVX512 is very rare on consumer // significant for our use case and AVX512 is very rare on consumer
// hardware anyways. // hardware anyways.
const HWY_DISABLED_TARGETS: c_int = HWY_AVX3_SPR | HWY_AVX3_ZEN4 | HWY_AVX3_DL | HWY_AVX3; const HWY_DISABLED_TARGETS: c_int = HWY_AVX10_2 | HWY_AVX3_SPR | HWY_AVX3_ZEN4 | HWY_AVX3_DL | HWY_AVX3;
m.addCSourceFiles(.{ m.addCSourceFiles(.{
.files = &.{ .files = &.{