This is an archive of the discontinued LLVM Phabricator instance.

[gn build] Add a flag to provide the path to zlib on Windows.
ClosedPublic

Authored by sebmarchand on May 15 2020, 3:17 PM.

Details

Summary

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

Diff Detail

Event Timeline

sebmarchand created this revision.May 15 2020, 3:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2020, 3:17 PM
sebmarchand edited the summary of this revision. (Show Details)
sebmarchand set the repository for this revision to rG LLVM Github Monorepo.

Hey Nico,

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

thakis added a comment.EditedMay 18 2020, 5:01 PM

Thanks for the patch! The way I thought this would look is to have the arg in http://llvm-cs.pcc.me.uk/utils/gn/build/libs/zlib/enable.gni#3 and then change the lower declare_args block to have llvm_enable_zlib = host_os != "win" || zlib_path != "". Does that make sense?

Address Nico's comments.

Thanks for the patch! The way I thought this would look is to have the arg in http://llvm-cs.pcc.me.uk/utils/gn/build/libs/zlib/enable.gni#3 and then change the lower declare_args block to have llvm_enable_zlib = host_os != "win" || zlib_path != "". Does that make sense?

Thanks, that makes sense. The new arg is already in utils/gn/build/libs/zlib/enable.gni , did you simply meant to put it in a new declare_args block before the existing one?

thakis accepted this revision.May 19 2020, 9:33 AM
This revision is now accepted and ready to land.May 19 2020, 9:33 AM

Thanks! I don't think that I can commit this though, the doc says "If you do not have commit access, someone has to commit the change for you (with attribution)" , could you please do that? Thanks!

Looks like this breaks the build on Windows: http://45.33.8.238/win/15588/step_4.txt

…because the assert is in zlib_config, and while we only add the dep on that if llvm_enable_zlib, the config is evaluated at the top level.

landed a fix attempt in f8cccd126b4780a4

Looks like we need something like this:

if (host_os == "win" && zlib_path != "") {

  include_dirs = [ zlib_path ]
  libs = [ "$zlib_path/zlib.lib" ]
}

?