aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Step/Compile.zig
diff options
context:
space:
mode:
authorCarl Ã…stholm <carl@astholm.se>2024-04-22 22:13:49 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-04-22 17:12:18 -0700
commite8f28cda9edb06a5f2189ca5e8928df52ddea20d (patch)
tree2b243731106c292b737319edaa0d719682a47eaf /lib/std/Build/Step/Compile.zig
parentc947e79d73d3ec7a7a7c4640f001b34f63d36d89 (diff)
downloadzig-e8f28cda9edb06a5f2189ca5e8928df52ddea20d.tar.gz
zig-e8f28cda9edb06a5f2189ca5e8928df52ddea20d.zip
std.Build: Install Windows DLLs to `<prefix>/bin/` by default
Windows does not support RPATH and only searches for DLLs in a small number of predetermined paths by default, with one of them being the directory from which the application loaded. Installing both executables and DLLs to `bin/` by default helps ensure that the executable can find any DLL artifacts it has linked to. DLL import libraries are still installed to `lib/`. These defaults match CMake's behavior.
Diffstat (limited to 'lib/std/Build/Step/Compile.zig')
-rw-r--r--lib/std/Build/Step/Compile.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig
index 9e94b78d6c..79bade4963 100644
--- a/lib/std/Build/Step/Compile.zig
+++ b/lib/std/Build/Step/Compile.zig
@@ -614,6 +614,10 @@ pub fn isStaticLibrary(self: *const Compile) bool {
return self.kind == .lib and self.linkage != .dynamic;
}
+pub fn isDll(self: *Compile) bool {
+ return self.isDynamicLibrary() and self.rootModuleTarget().os.tag == .windows;
+}
+
pub fn producesPdbFile(self: *Compile) bool {
const target = self.rootModuleTarget();
// TODO: Is this right? Isn't PDB for *any* PE/COFF file?
@@ -632,7 +636,7 @@ pub fn producesPdbFile(self: *Compile) bool {
}
pub fn producesImplib(self: *Compile) bool {
- return self.isDynamicLibrary() and self.rootModuleTarget().os.tag == .windows;
+ return self.isDll();
}
pub fn linkLibC(self: *Compile) void {