[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
This commit is contained in:
Sébastien Marchand
2020-05-19 15:58:52 -04:00
committed by Nico Weber
parent 2e6e27583c
commit f8e833a501
2 changed files with 15 additions and 2 deletions

View File

@@ -2,7 +2,13 @@ import("//llvm/utils/gn/build/libs/zlib/enable.gni")
config("zlib_config") {
visibility = [ ":zlib" ]
libs = [ "z" ]
if (host_os == "win") {
assert(zlib_path != "", "Please provide the path to zlib")
include_dirs = [ zlib_path ]
libs = [ "$zlib_path/zlib.lib" ]
} else {
libs = [ "z" ]
}
}
group("zlib") {

View File

@@ -1,4 +1,11 @@
declare_args() {
if (host_os == "win") {
# On Windows, path to a directory containing zlib headers and zlib.lib.
zlib_path = ""
}
}
declare_args() {
# Whether to include code that links against zlib.
llvm_enable_zlib = host_os != "win"
llvm_enable_zlib = host_os != "win" || zlib_path != ""
}