aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2022-11-13 03:42:51 -0500
committerkcbanner <kcbanner@gmail.com>2023-01-04 21:45:06 -0500
commitb42442f5b4913938b04f580b1d13a1fd7318514d (patch)
treedb86066c6ea6dc6f34904c162a49bf450c6419bb /src/Compilation.zig
parenta03c8ef4bf526888518d13de1794c28375900cc2 (diff)
downloadzig-b42442f5b4913938b04f580b1d13a1fd7318514d.tar.gz
zig-b42442f5b4913938b04f580b1d13a1fd7318514d.zip
windows: fixes to support using zig cc/c++ with CMake on Windows
Using zig cc with CMake on Windows was failing during compiler detection. -nostdinc was causing the crt not to be linked, and Coff/lld.zig assumed that wWinMainCRTStartup would be present in this case. -nostdlib did not prevent the default behaviour of linking libc++ when zig c++ was used. This caused libc++ to be built when CMake ran ABI detection using zig c++, which fails as libcxxabi cannot compile under MSVC. - Change the behaviour of COFF -nostdinc to set /entry to the function that the default CRT method for the specified subsystem would have called. - Fix -ENTRY being passed twice if it was specified explicitly and -nostdlib was present. - Add support for /pdb, /version, /implib, and /subsystem as linker args (passed by CMake) - Remove -Ddisable-zstd, no longer needed - Add -Ddisable-libcpp for use when bootstrapping on msvc
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index aa352fb9ab..5d0a9308af 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1042,6 +1042,11 @@ pub const InitOptions = struct {
/// (Darwin) remove dylibs that are unreachable by the entry point or exported symbols
dead_strip_dylibs: bool = false,
libcxx_abi_version: libcxx.AbiVersion = libcxx.AbiVersion.default,
+ /// (Windows) PDB source path prefix to instruct the linker how to resolve relative
+ /// paths when consolidating CodeView streams into a single PDB file.
+ pdb_source_path: ?[]const u8 = null,
+ /// (Windows) PDB output path
+ pdb_out_path: ?[]const u8 = null,
};
fn addPackageTableToCacheHash(
@@ -1892,6 +1897,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
.headerpad_max_install_names = options.headerpad_max_install_names,
.dead_strip_dylibs = options.dead_strip_dylibs,
.force_undefined_symbols = .{},
+ .pdb_source_path = pdb_source_path,
+ .pdb_out_path = options.pdb_out_path,
});
errdefer bin_file.destroy();
comp.* = .{