Skip to content

Commit 1fd102d

Browse files
committed
Add preliminary support for Windows .manifest files
1 parent 4df7f7c commit 1fd102d

File tree

3 files changed

+207
-32
lines changed

3 files changed

+207
-32
lines changed

lib/std/Build/Step/Compile.zig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ pub const LinkObject = union(enum) {
257257
c_source_file: *CSourceFile,
258258
c_source_files: *CSourceFiles,
259259
win32_resource_file: *RcSourceFile,
260+
win32_manifest_file: LazyPath,
260261
};
261262

262263
pub const SystemLib = struct {
@@ -952,6 +953,17 @@ pub fn addWin32ResourceFile(self: *Compile, source: RcSourceFile) void {
952953
source.file.addStepDependencies(&self.step);
953954
}
954955

956+
pub fn addWin32ManifestFile(self: *Compile, source: LazyPath) void {
957+
// Only the PE/COFF format has a Resource Table which is where the manifest
958+
// gets embedded, so for any other target the manifest file is just ignored.
959+
if (self.target.getObjectFormat() != .coff) return;
960+
961+
const b = self.step.owner;
962+
const source_duped = source.dupe(b);
963+
self.link_objects.append(.{ .win32_manifest_file = source_duped }) catch @panic("OOM");
964+
source.addStepDependencies(&self.step);
965+
}
966+
955967
pub fn setVerboseLink(self: *Compile, value: bool) void {
956968
self.verbose_link = value;
957969
}
@@ -1567,6 +1579,10 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
15671579
}
15681580
try zig_args.append(rc_source_file.file.getPath(b));
15691581
},
1582+
1583+
.win32_manifest_file => |manifest_file| {
1584+
try zig_args.append(manifest_file.getPath(b));
1585+
},
15701586
}
15711587
}
15721588

0 commit comments

Comments
 (0)