From 3072b4059fbef261975bd5fc7363226b109b21fd Mon Sep 17 00:00:00 2001 From: Charly Delay Date: Fri, 6 Jul 2018 13:10:46 -0400 Subject: [PATCH] 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 Commit-Queue: Joshua Peraza --- third_party/zlib/zlib.gyp | 45 +++++++++++++++++++++++--------- third_party/zlib/zlib_crashpad.h | 5 ++-- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/third_party/zlib/zlib.gyp b/third_party/zlib/zlib.gyp index b6a6bc91..df26cc23 100644 --- a/third_party/zlib/zlib.gyp +++ b/third_party/zlib/zlib.gyp @@ -13,18 +13,28 @@ # limitations under the License. { - 'variables': { - 'conditions': [ - # 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"', { - 'zlib_source%': 'system', - }, { - 'zlib_source%': 'embedded', - }], - ], - }, + '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. + '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', + ], + }], ], }, ], diff --git a/third_party/zlib/zlib_crashpad.h b/third_party/zlib/zlib_crashpad.h index d3a23861..fd497a85 100644 --- a/third_party/zlib/zlib_crashpad.h +++ b/third_party/zlib/zlib_crashpad.h @@ -19,9 +19,8 @@ // available at any other location in the source tree. It will #include the // proper 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 #elif defined(CRASHPAD_ZLIB_SOURCE_EMBEDDED) #include "third_party/zlib/zlib/zlib.h"