feature. See also
. The project being documented here (as the example) is the Zig library itself.
PkgConfig.find
pub fn find(pc: *const PkgConfig, lib_name: []const u8) ?usize
File
Code
pub fn find(pc: *const PkgConfig, lib_name: []const u8) ?usize {
const all = pc.all;
for (all, 0..) |pkg, i| {
if (mem.eql(u8, pkg.name, lib_name))
return i;
}
for (all, 0..) |pkg, i| {
if (std.ascii.eqlIgnoreCase(pkg.name, lib_name))
return i;
}
for (all, 0..) |pkg, i| {
if (std.ascii.findIgnoreCase(pkg.name, lib_name)) |pos| {
const prefix = pkg.name[0..pos];
const suffix = pkg.name[pos + lib_name.len ..];
if (prefix.len > 0 and !mem.eql(u8, prefix, "lib")) continue;
if (suffix.len > 0 and !mem.eql(u8, suffix, ".0")) continue;
return i;
}
}
if (mem.cutSuffix(u8, lib_name, "-1.0")) |trimmed| {
for (all, 0..) |pkg, i| {
if (std.ascii.eqlIgnoreCase(pkg.name, trimmed)) {
return i;
}
}
}
return null;
}