zlib.gyp: support the "external" dependency mode

This CL implements support for the external model for Crashpad's zlib
dependency, in which the dependencies and Crashpad are checked out as
sibling in the same directory.

Bug: crashpad:
Change-Id: I0ca640e0be9b6a4fd8379026dfc8eb061b40badf
Reviewed-on: https://chromium-review.googlesource.com/1124778
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
Charly Delay 2018-07-06 13:10:46 -04:00 committed by Commit Bot
parent 038ba6eea2
commit 3072b4059f
2 changed files with 35 additions and 15 deletions

View File

@ -13,18 +13,28 @@
# limitations under the License.
{
'includes': [
'../../build/crashpad_dependencies.gypi',
],
'conditions': [
['1==1', { # Defer processing until crashpad_dependencies is set
'variables': {
'conditions': [
['crashpad_dependencies=="external"', {
'zlib_source%': 'external',
}, 'OS!="win"', {
# Use the system zlib by default where available, as it is on most
# platforms. Windows does not have a system zlib, so use “embedded” which
# directs the build to use the source code in the zlib subdirectory.
['OS!="win"', {
# platforms. Windows does not have a system zlib, so use “embedded”
# which directs the build to use the source code in the zlib
# subdirectory.
'zlib_source%': 'system',
}, {
'zlib_source%': 'embedded',
}],
],
},
}],
],
'targets': [
{
'target_name': 'zlib',
@ -141,6 +151,17 @@
}],
],
}],
['zlib_source=="external"', {
'type': 'none',
'direct_dependent_settings': {
'defines': [
'CRASHPAD_ZLIB_SOURCE_EXTERNAL',
],
},
'dependencies': [
'../../../../zlib/zlib.gyp:zlib',
],
}],
],
},
],

View File

@ -19,9 +19,8 @@
// available at any other location in the source tree. It will #include the
// proper <zlib.h> depending on how the build has been configured.
#if defined(CRASHPAD_ZLIB_SOURCE_EXTERNAL)
#include "third_party/zlib/zlib.h"
#elif defined(CRASHPAD_ZLIB_SOURCE_SYSTEM)
#if defined(CRASHPAD_ZLIB_SOURCE_SYSTEM) || \
defined(CRASHPAD_ZLIB_SOURCE_EXTERNAL)
#include <zlib.h>
#elif defined(CRASHPAD_ZLIB_SOURCE_EMBEDDED)
#include "third_party/zlib/zlib/zlib.h"