| ... | @@ -1040,6 +1040,7 @@ pub const LibExeObjStep = struct { | ... | @@ -1040,6 +1040,7 @@ pub const LibExeObjStep = struct { |
| 1040 | root_src: ?[]const u8, | 1040 | root_src: ?[]const u8, |
| 1041 | out_h_filename: []const u8, | 1041 | out_h_filename: []const u8, |
| 1042 | out_lib_filename: []const u8, | 1042 | out_lib_filename: []const u8, |
| | 1043 | out_pdb_filename: []const u8, |
| 1043 | packages: ArrayList(Pkg), | 1044 | packages: ArrayList(Pkg), |
| 1044 | build_options_contents: std.Buffer, | 1045 | build_options_contents: std.Buffer, |
| 1045 | system_linker_hack: bool, | 1046 | system_linker_hack: bool, |
| ... | @@ -1125,6 +1126,7 @@ pub const LibExeObjStep = struct { | ... | @@ -1125,6 +1126,7 @@ pub const LibExeObjStep = struct { |
| 1125 | .out_filename = undefined, | 1126 | .out_filename = undefined, |
| 1126 | .out_h_filename = builder.fmt("{}.h", name), | 1127 | .out_h_filename = builder.fmt("{}.h", name), |
| 1127 | .out_lib_filename = undefined, | 1128 | .out_lib_filename = undefined, |
| | 1129 | .out_pdb_filename = builder.fmt("{}.pdb", name), |
| 1128 | .major_only_filename = undefined, | 1130 | .major_only_filename = undefined, |
| 1129 | .name_only_filename = undefined, | 1131 | .name_only_filename = undefined, |
| 1130 | .packages = ArrayList(Pkg).init(builder.allocator), | 1132 | .packages = ArrayList(Pkg).init(builder.allocator), |
| ... | @@ -1367,6 +1369,16 @@ pub const LibExeObjStep = struct { | ... | @@ -1367,6 +1369,16 @@ pub const LibExeObjStep = struct { |
| 1367 | ) catch unreachable; | 1369 | ) catch unreachable; |
| 1368 | } | 1370 | } |
| 1369 | | 1371 | |
| | 1372 | /// Unless setOutputDir was called, this function must be called only in |
| | 1373 | /// the make step, from a step that has declared a dependency on this one. |
| | 1374 | pub fn getOutputPdbPath(self: *LibExeObjStep) []const u8 { |
| | 1375 | assert(self.target.isWindows()); |
| | 1376 | return fs.path.join( |
| | 1377 | self.builder.allocator, |
| | 1378 | [_][]const u8{ self.output_dir.?, self.out_pdb_filename }, |
| | 1379 | ) catch unreachable; |
| | 1380 | } |
| | 1381 | |
| 1370 | pub fn addAssemblyFile(self: *LibExeObjStep, path: []const u8) void { | 1382 | pub fn addAssemblyFile(self: *LibExeObjStep, path: []const u8) void { |
| 1371 | self.link_objects.append(LinkObject{ .AssemblyFile = self.builder.dupe(path) }) catch unreachable; | 1383 | self.link_objects.append(LinkObject{ .AssemblyFile = self.builder.dupe(path) }) catch unreachable; |
| 1372 | } | 1384 | } |
| ... | @@ -1831,6 +1843,7 @@ const InstallArtifactStep = struct { | ... | @@ -1831,6 +1843,7 @@ const InstallArtifactStep = struct { |
| 1831 | builder: *Builder, | 1843 | builder: *Builder, |
| 1832 | artifact: *LibExeObjStep, | 1844 | artifact: *LibExeObjStep, |
| 1833 | dest_dir: InstallDir, | 1845 | dest_dir: InstallDir, |
| | 1846 | pdb_dir: ?InstallDir, |
| 1834 | | 1847 | |
| 1835 | const Self = @This(); | 1848 | const Self = @This(); |
| 1836 | | 1849 | |
| ... | @@ -1848,6 +1861,13 @@ const InstallArtifactStep = struct { | ... | @@ -1848,6 +1861,13 @@ const InstallArtifactStep = struct { |
| 1848 | .Exe => InstallDir.Bin, | 1861 | .Exe => InstallDir.Bin, |
| 1849 | .Lib => InstallDir.Lib, | 1862 | .Lib => InstallDir.Lib, |
| 1850 | }, | 1863 | }, |
| | 1864 | .pdb_dir = if (artifact.target.isWindows() and !artifact.strip) blk: { |
| | 1865 | if (artifact.kind == .Exe) { |
| | 1866 | break :blk InstallDir.Bin; |
| | 1867 | } else { |
| | 1868 | break :blk InstallDir.Lib; |
| | 1869 | } |
| | 1870 | } else null, |
| 1851 | }; | 1871 | }; |
| 1852 | self.step.dependOn(&artifact.step); | 1872 | self.step.dependOn(&artifact.step); |
| 1853 | artifact.install_step = self; | 1873 | artifact.install_step = self; |
| ... | @@ -1857,6 +1877,9 @@ const InstallArtifactStep = struct { | ... | @@ -1857,6 +1877,9 @@ const InstallArtifactStep = struct { |
| 1857 | builder.pushInstalledFile(.Lib, artifact.major_only_filename); | 1877 | builder.pushInstalledFile(.Lib, artifact.major_only_filename); |
| 1858 | builder.pushInstalledFile(.Lib, artifact.name_only_filename); | 1878 | builder.pushInstalledFile(.Lib, artifact.name_only_filename); |
| 1859 | } | 1879 | } |
| | 1880 | if (self.pdb_dir) |pdb_dir| { |
| | 1881 | builder.pushInstalledFile(pdb_dir, artifact.out_pdb_filename); |
| | 1882 | } |
| 1860 | return self; | 1883 | return self; |
| 1861 | } | 1884 | } |
| 1862 | | 1885 | |
| ... | @@ -1878,6 +1901,10 @@ const InstallArtifactStep = struct { | ... | @@ -1878,6 +1901,10 @@ const InstallArtifactStep = struct { |
| 1878 | if (self.artifact.isDynamicLibrary()) { | 1901 | if (self.artifact.isDynamicLibrary()) { |
| 1879 | try doAtomicSymLinks(builder.allocator, full_dest_path, self.artifact.major_only_filename, self.artifact.name_only_filename); | 1902 | try doAtomicSymLinks(builder.allocator, full_dest_path, self.artifact.major_only_filename, self.artifact.name_only_filename); |
| 1880 | } | 1903 | } |
| | 1904 | if (self.pdb_dir) |pdb_dir| { |
| | 1905 | const full_pdb_path = builder.getInstallPath(pdb_dir, self.artifact.out_pdb_filename); |
| | 1906 | try builder.copyFile(self.artifact.getOutputPdbPath(), full_pdb_path); |
| | 1907 | } |
| 1881 | self.artifact.installed_path = full_dest_path; | 1908 | self.artifact.installed_path = full_dest_path; |
| 1882 | } | 1909 | } |
| 1883 | }; | 1910 | }; |