Skip to content

Commit 1908e2e

Browse files
sebmarchandmemfrob
authored andcommitted
[gn build] Add a flag zlib_path to provide the path to zlib on Windows.
Also, automatically set llvm_enable_zlib to true when zlib_path is set. Differential Revision: https://reviews.llvm.org/D80042
1 parent d7f56a0 commit 1908e2e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

llvm/utils/gn/build/libs/zlib/BUILD.gn

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import("//llvm/utils/gn/build/libs/zlib/enable.gni")
22

33
config("zlib_config") {
44
visibility = [ ":zlib" ]
5-
libs = [ "z" ]
5+
if (host_os == "win") {
6+
assert(zlib_path != "", "Please provide the path to zlib")
7+
include_dirs = [ zlib_path ]
8+
libs = [ "$zlib_path/zlib.lib" ]
9+
} else {
10+
libs = [ "z" ]
11+
}
612
}
713

814
group("zlib") {
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
declare_args() {
2+
if (host_os == "win") {
3+
# On Windows, path to a directory containing zlib headers and zlib.lib.
4+
zlib_path = ""
5+
}
6+
}
7+
18
declare_args() {
29
# Whether to include code that links against zlib.
3-
llvm_enable_zlib = host_os != "win"
10+
llvm_enable_zlib = host_os != "win" || zlib_path != ""
411
}

0 commit comments

Comments
 (0)