union HeaderInstallation [src]

Fields

file: File
directory: Directory

Members

Source

pub const HeaderInstallation = union(enum) { file: File, directory: Directory, pub const File = struct { source: LazyPath, dest_rel_path: []const u8, pub fn dupe(file: File, b: *std.Build) File { return .{ .source = file.source.dupe(b), .dest_rel_path = b.dupePath(file.dest_rel_path), }; } }; pub const Directory = struct { source: LazyPath, dest_rel_path: []const u8, options: Directory.Options, pub const Options = struct { /// File paths that end in any of these suffixes will be excluded from installation. exclude_extensions: []const []const u8 = &.{}, /// Only file paths that end in any of these suffixes will be included in installation. /// `null` means that all suffixes will be included. /// `exclude_extensions` takes precedence over `include_extensions`. include_extensions: ?[]const []const u8 = &.{".h"}, pub fn dupe(opts: Directory.Options, b: *std.Build) Directory.Options { return .{ .exclude_extensions = b.dupeStrings(opts.exclude_extensions), .include_extensions = if (opts.include_extensions) |incs| b.dupeStrings(incs) else null, }; } }; pub fn dupe(dir: Directory, b: *std.Build) Directory { return .{ .source = dir.source.dupe(b), .dest_rel_path = b.dupePath(dir.dest_rel_path), .options = dir.options.dupe(b), }; } }; pub fn getSource(installation: HeaderInstallation) LazyPath { return switch (installation) { inline .file, .directory => |x| x.source, }; } pub fn dupe(installation: HeaderInstallation, b: *std.Build) HeaderInstallation { return switch (installation) { .file => |f| .{ .file = f.dupe(b) }, .directory => |d| .{ .directory = d.dupe(b) }, }; } }