[PATCH] D80042: [gn build] Add a flag to provide the path to zlib on Windows.

Sébastien Marchand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 15:47:11 PDT 2020


sebmarchand created this revision.
Herald added subscribers: llvm-commits, dmgreen, qcolombet.
Herald added a project: LLVM.
sebmarchand updated this revision to Diff 264371.
sebmarchand updated this revision to Diff 264372.
sebmarchand edited the summary of this revision.
sebmarchand set the repository for this revision to rG LLVM Github Monorepo.
sebmarchand added a reviewer: thakis.
sebmarchand added a comment.

Hey Nico,

PTAL. This is my first CL on Phabricator so I might have made some mistakes in the config.


This allows Windows developer to provide the path to zlib.lib when
setting llvm_enable_zlib=true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80042

Files:
  llvm/utils/gn/build/libs/zlib/BUILD.gn
  llvm/utils/gn/build/libs/zlib/enable.gni


Index: llvm/utils/gn/build/libs/zlib/enable.gni
===================================================================
--- llvm/utils/gn/build/libs/zlib/enable.gni
+++ llvm/utils/gn/build/libs/zlib/enable.gni
@@ -1,4 +1,11 @@
 declare_args() {
   # Whether to include code that links against zlib.
   llvm_enable_zlib = host_os != "win"
+
+  # Enabling zlib on Windows requires to provide the path to the .lib and
+  # its header files.
+  if (host_os == "win") {
+    # The path to zlib.lib and its corresponding header files.
+    zlib_path = ""
+  }
 }
Index: llvm/utils/gn/build/libs/zlib/BUILD.gn
===================================================================
--- llvm/utils/gn/build/libs/zlib/BUILD.gn
+++ llvm/utils/gn/build/libs/zlib/BUILD.gn
@@ -2,7 +2,13 @@
 
 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") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80042.264372.patch
Type: text/x-patch
Size: 1065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200515/b1e96dea/attachment.bin>


More information about the llvm-commits mailing list