| author | |
| committer | |
| log | d99e44a157dee9204c38e66bf7eba00c051690ba |
| tree | 661fd3be7a71a67f47e0a99874ba827a107dd6c0 |
| parent | 5af4e91e0036a5d83889d20ee1477a366c6c12ac |
Also renames `addHeaders` to `addHeadersDirectory` for clarity.4 files changed, 21 insertions(+), 5 deletions(-)
lib/std/Build.zig+4-3| ... | ... | @@ -1568,21 +1568,22 @@ pub fn addObjCopy(b: *Build, source: LazyPath, options: Step.ObjCopy.Options) *S |
| 1568 | 1568 | return Step.ObjCopy.create(b, source, options); |
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | ///`dest_rel_path` is relative to install prefix path | |
| 1571 | /// `dest_rel_path` is relative to install prefix path | |
| 1572 | 1572 | pub fn addInstallFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile { |
| 1573 | 1573 | return b.addInstallFileWithDir(source, .prefix, dest_rel_path); |
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | ///`dest_rel_path` is relative to bin path | |
| 1576 | /// `dest_rel_path` is relative to bin path | |
| 1577 | 1577 | pub fn addInstallBinFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile { |
| 1578 | 1578 | return b.addInstallFileWithDir(source, .bin, dest_rel_path); |
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | ///`dest_rel_path` is relative to lib path | |
| 1581 | /// `dest_rel_path` is relative to lib path | |
| 1582 | 1582 | pub fn addInstallLibFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile { |
| 1583 | 1583 | return b.addInstallFileWithDir(source, .lib, dest_rel_path); |
| 1584 | 1584 | } |
| 1585 | 1585 | |
| 1586 | /// `dest_rel_path` is relative to header path | |
| 1586 | 1587 | pub fn addInstallHeaderFile(b: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile { |
| 1587 | 1588 | return b.addInstallFileWithDir(source, .header, dest_rel_path); |
| 1588 | 1589 | } |
lib/std/Build/Step/Compile.zig+13-1| ... | ... | @@ -446,6 +446,9 @@ pub fn create(owner: *std.Build, options: Options) *Compile { |
| 446 | 446 | return self; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | /// Marks the specified header for installation alongside this artifact. | |
| 450 | /// When a module links with this artifact, all headers marked for installation are added to that | |
| 451 | /// module's include search path. | |
| 449 | 452 | pub fn installHeader(cs: *Compile, source: LazyPath, dest_rel_path: []const u8) void { |
| 450 | 453 | const b = cs.step.owner; |
| 451 | 454 | const installation: HeaderInstallation = .{ .file = .{ |
| ... | ... | @@ -457,7 +460,10 @@ pub fn installHeader(cs: *Compile, source: LazyPath, dest_rel_path: []const u8) |
| 457 | 460 | installation.getSource().addStepDependencies(&cs.step); |
| 458 | 461 | } |
| 459 | 462 | |
| 460 | pub fn installHeaders( | |
| 463 | /// Marks headers from the specified directory for installation alongside this artifact. | |
| 464 | /// When a module links with this artifact, all headers marked for installation are added to that | |
| 465 | /// module's include search path. | |
| 466 | pub fn installHeadersDirectory( | |
| 461 | 467 | cs: *Compile, |
| 462 | 468 | source: LazyPath, |
| 463 | 469 | dest_rel_path: []const u8, |
| ... | ... | @@ -474,10 +480,16 @@ pub fn installHeaders( |
| 474 | 480 | installation.getSource().addStepDependencies(&cs.step); |
| 475 | 481 | } |
| 476 | 482 | |
| 483 | /// Marks the specified config header for installation alongside this artifact. | |
| 484 | /// When a module links with this artifact, all headers marked for installation are added to that | |
| 485 | /// module's include search path. | |
| 477 | 486 | pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void { |
| 478 | 487 | cs.installHeader(config_header.getOutput(), config_header.include_path); |
| 479 | 488 | } |
| 480 | 489 | |
| 490 | /// Forwards all headers marked for installation from `lib` to this artifact. | |
| 491 | /// When a module links with this artifact, all headers marked for installation are added to that | |
| 492 | /// module's include search path. | |
| 481 | 493 | pub fn installLibraryHeaders(cs: *Compile, lib: *Compile) void { |
| 482 | 494 | assert(lib.kind == .lib); |
| 483 | 495 | const b = cs.step.owner; |
lib/std/Build/Step/WriteFile.zig+3| ... | ... | @@ -126,6 +126,9 @@ pub fn addCopyFile(wf: *WriteFile, source: std.Build.LazyPath, sub_path: []const |
| 126 | 126 | return file.getPath(); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | /// Copy files matching the specified exclude/include patterns to the specified subdirectory | |
| 130 | /// relative to this step's generated directory. | |
| 131 | /// The returned value is a lazy path to the generated subdirectory. | |
| 129 | 132 | pub fn addCopyDirectory( |
| 130 | 133 | wf: *WriteFile, |
| 131 | 134 | source: std.Build.LazyPath, |
test/standalone/install_headers/build.zig+1-1| ... | ... | @@ -32,7 +32,7 @@ pub fn build(b: *std.Build) void { |
| 32 | 32 | \\} |
| 33 | 33 | ) }); |
| 34 | 34 | |
| 35 | libfoo.installHeaders(.{ .path = "include" }, "foo", .{ .exclude_extensions = &.{".ignore_me.h"} }); | |
| 35 | libfoo.installHeadersDirectory(.{ .path = "include" }, "foo", .{ .exclude_extensions = &.{".ignore_me.h"} }); | |
| 36 | 36 | libfoo.installHeader(b.addWriteFiles().add("d.h", |
| 37 | 37 | \\#define FOO_D "D" |
| 38 | 38 | \\ |