gn: Add “system” as a zlib source, used for standalone non-Win/Fuchsia

Bug: crashpad:79
Change-Id: I07e346000ce6df07ac7021056a4cb00d28443e15
Reviewed-on: https://chromium-review.googlesource.com/827745
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Mark Mentovai 2017-12-14 15:50:09 -05:00 committed by Commit Bot
parent 3650d56570
commit 6e0f15b8f5
2 changed files with 22 additions and 7 deletions

View File

@ -14,23 +14,38 @@
import("../../build/crashpad_in_chromium.gni")
if (crashpad_in_chromium) {
zlib_source = "chromium"
} else if (!is_win && !is_fuchsia) {
zlib_source = "system"
} else {
zlib_source = "embedded"
}
config("zlib_config") {
if (crashpad_in_chromium) {
if (zlib_source == "chromium") {
defines = [ "CRASHPAD_ZLIB_SOURCE_CHROMIUM" ]
} else {
} else if (zlib_source == "system") {
defines = [ "CRASHPAD_ZLIB_SOURCE_SYSTEM" ]
} else if (zlib_source == "embedded") {
defines = [ "CRASHPAD_ZLIB_SOURCE_EMBEDDED" ]
include_dirs = [ "zlib" ]
}
}
if (crashpad_in_chromium) {
if (zlib_source == "chromium") {
group("zlib") {
public_configs = [ ":zlib_config" ]
public_deps = [
"//third_party/zlib",
]
}
} else {
} else if (zlib_source == "system") {
source_set("zlib") {
public_configs = [ ":zlib_config" ]
libs = [ "z" ]
}
} else if (zlib_source == "embedded") {
static_library("zlib") {
sources = [
"zlib/adler32.c",

View File

@ -19,12 +19,12 @@
// 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_SYSTEM)
#if defined(CRASHPAD_ZLIB_SOURCE_CHROMIUM)
#include "third_party/zlib/zlib.h"
#elif defined(CRASHPAD_ZLIB_SOURCE_SYSTEM)
#include <zlib.h>
#elif defined(CRASHPAD_ZLIB_SOURCE_EMBEDDED)
#include "third_party/zlib/zlib/zlib.h"
#elif defined(CRASHPAD_ZLIB_SOURCE_CHROMIUM)
#include "third_party/zlib/zlib.h"
#else
#error Unknown zlib source
#endif