mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Document added/updated functions
Also renames `addHeaders` to `addHeadersDirectory` for clarity.
This commit is contained in:
parent
5af4e91e00
commit
d99e44a157
4 changed files with 21 additions and 5 deletions
|
|
@ -1568,21 +1568,22 @@ pub fn addObjCopy(b: *Build, source: LazyPath, options: Step.ObjCopy.Options) *S
|
||||||
return Step.ObjCopy.create(b, source, options);
|
return Step.ObjCopy.create(b, source, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
///`dest_rel_path` is relative to install prefix path
|
/// `dest_rel_path` is relative to install prefix path
|
||||||
pub fn addInstallFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
pub fn addInstallFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
||||||
return b.addInstallFileWithDir(source, .prefix, dest_rel_path);
|
return b.addInstallFileWithDir(source, .prefix, dest_rel_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
///`dest_rel_path` is relative to bin path
|
/// `dest_rel_path` is relative to bin path
|
||||||
pub fn addInstallBinFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
pub fn addInstallBinFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
||||||
return b.addInstallFileWithDir(source, .bin, dest_rel_path);
|
return b.addInstallFileWithDir(source, .bin, dest_rel_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
///`dest_rel_path` is relative to lib path
|
/// `dest_rel_path` is relative to lib path
|
||||||
pub fn addInstallLibFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
pub fn addInstallLibFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
||||||
return b.addInstallFileWithDir(source, .lib, dest_rel_path);
|
return b.addInstallFileWithDir(source, .lib, dest_rel_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `dest_rel_path` is relative to header path
|
||||||
pub fn addInstallHeaderFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
pub fn addInstallHeaderFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile {
|
||||||
return b.addInstallFileWithDir(source, .header, dest_rel_path);
|
return b.addInstallFileWithDir(source, .header, dest_rel_path);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -446,6 +446,9 @@ pub fn create(owner: *std.Build, options: Options) *Compile {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Marks the specified header for installation alongside this artifact.
|
||||||
|
/// When a module links with this artifact, all headers marked for installation are added to that
|
||||||
|
/// module's include search path.
|
||||||
pub fn installHeader(cs: *Compile, source: LazyPath, dest_rel_path: []const u8) void {
|
pub fn installHeader(cs: *Compile, source: LazyPath, dest_rel_path: []const u8) void {
|
||||||
const b = cs.step.owner;
|
const b = cs.step.owner;
|
||||||
const installation: HeaderInstallation = .{ .file = .{
|
const installation: HeaderInstallation = .{ .file = .{
|
||||||
|
|
@ -457,7 +460,10 @@ pub fn installHeader(cs: *Compile, source: LazyPath, dest_rel_path: []const u8)
|
||||||
installation.getSource().addStepDependencies(&cs.step);
|
installation.getSource().addStepDependencies(&cs.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn installHeaders(
|
/// Marks headers from the specified directory for installation alongside this artifact.
|
||||||
|
/// When a module links with this artifact, all headers marked for installation are added to that
|
||||||
|
/// module's include search path.
|
||||||
|
pub fn installHeadersDirectory(
|
||||||
cs: *Compile,
|
cs: *Compile,
|
||||||
source: LazyPath,
|
source: LazyPath,
|
||||||
dest_rel_path: []const u8,
|
dest_rel_path: []const u8,
|
||||||
|
|
@ -474,10 +480,16 @@ pub fn installHeaders(
|
||||||
installation.getSource().addStepDependencies(&cs.step);
|
installation.getSource().addStepDependencies(&cs.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Marks the specified config header for installation alongside this artifact.
|
||||||
|
/// When a module links with this artifact, all headers marked for installation are added to that
|
||||||
|
/// module's include search path.
|
||||||
pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void {
|
pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void {
|
||||||
cs.installHeader(config_header.getOutput(), config_header.include_path);
|
cs.installHeader(config_header.getOutput(), config_header.include_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Forwards all headers marked for installation from `lib` to this artifact.
|
||||||
|
/// When a module links with this artifact, all headers marked for installation are added to that
|
||||||
|
/// module's include search path.
|
||||||
pub fn installLibraryHeaders(cs: *Compile, lib: *Compile) void {
|
pub fn installLibraryHeaders(cs: *Compile, lib: *Compile) void {
|
||||||
assert(lib.kind == .lib);
|
assert(lib.kind == .lib);
|
||||||
const b = cs.step.owner;
|
const b = cs.step.owner;
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,9 @@ pub fn addCopyFile(wf: *WriteFile, source: std.Build.LazyPath, sub_path: []const
|
||||||
return file.getPath();
|
return file.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Copy files matching the specified exclude/include patterns to the specified subdirectory
|
||||||
|
/// relative to this step's generated directory.
|
||||||
|
/// The returned value is a lazy path to the generated subdirectory.
|
||||||
pub fn addCopyDirectory(
|
pub fn addCopyDirectory(
|
||||||
wf: *WriteFile,
|
wf: *WriteFile,
|
||||||
source: std.Build.LazyPath,
|
source: std.Build.LazyPath,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void {
|
||||||
\\}
|
\\}
|
||||||
) });
|
) });
|
||||||
|
|
||||||
libfoo.installHeaders(.{ .path = "include" }, "foo", .{ .exclude_extensions = &.{".ignore_me.h"} });
|
libfoo.installHeadersDirectory(.{ .path = "include" }, "foo", .{ .exclude_extensions = &.{".ignore_me.h"} });
|
||||||
libfoo.installHeader(b.addWriteFiles().add("d.h",
|
libfoo.installHeader(b.addWriteFiles().add("d.h",
|
||||||
\\#define FOO_D "D"
|
\\#define FOO_D "D"
|
||||||
\\
|
\\
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue