mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 16:26:10 +03:00
155 lines
3.5 KiB
Plaintext
155 lines
3.5 KiB
Plaintext
# Copyright 2015 The Chromium Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import("//build/buildflag_header.gni")
|
|
|
|
declare_args() {
|
|
# If set to true, this will stub out and disable the entire crash key system.
|
|
use_crash_key_stubs = is_fuchsia
|
|
}
|
|
|
|
group("common") {
|
|
public_deps = [
|
|
":crash_key",
|
|
":crash_key_utils",
|
|
]
|
|
|
|
if (is_mac || is_ios) {
|
|
public_deps += [ ":zombies" ]
|
|
}
|
|
}
|
|
|
|
use_crashpad_annotation = (is_mac || is_win) && !use_crash_key_stubs
|
|
|
|
buildflag_header("crash_buildflags") {
|
|
header = "crash_buildflags.h"
|
|
flags = [
|
|
"USE_CRASHPAD_ANNOTATION=$use_crashpad_annotation",
|
|
"USE_CRASH_KEY_STUBS=$use_crash_key_stubs",
|
|
]
|
|
}
|
|
|
|
# Crashpad's annotation system can store data on a per-module basis (i.e.,
|
|
# in different shared libraries in the component build) without issue. The
|
|
# Breakpad implementation uses a static global variable, so ensure there is
|
|
# only one instance of the symbol in the component build by making this
|
|
# target a component.
|
|
if (use_crash_key_stubs || use_crashpad_annotation) {
|
|
crash_key_target_type = "static_library"
|
|
} else {
|
|
crash_key_target_type = "component"
|
|
}
|
|
target(crash_key_target_type, "crash_key") {
|
|
sources = [
|
|
"crash_export.h",
|
|
"crash_key.cc",
|
|
"crash_key.h",
|
|
"crash_key_base_support.cc",
|
|
"crash_key_base_support.h",
|
|
]
|
|
|
|
defines = []
|
|
|
|
# This target is not always a component, depending on the implementation.
|
|
# When it is not a component, annotating functions with the standard
|
|
# CRASH_EXPORT macro causes linking errors on Windows (clients of this target
|
|
# expect it to be dllimport but it is linked statically). Instead, provide a
|
|
# wrapper macro CRASH_KEY_EXPORT that only evaluates to CRASH_EXPORT if this
|
|
# target is really a component.
|
|
if (crash_key_target_type == "component") {
|
|
defines += [
|
|
"CRASH_KEY_EXPORT=CRASH_EXPORT",
|
|
"CRASH_CORE_COMMON_IMPLEMENTATION",
|
|
]
|
|
}
|
|
|
|
deps = [
|
|
":crash_buildflags",
|
|
"//base",
|
|
]
|
|
|
|
if (use_crash_key_stubs) {
|
|
sources += [ "crash_key_stubs.cc" ]
|
|
} else if (use_crashpad_annotation) {
|
|
sources += [ "crash_key_crashpad.cc" ]
|
|
deps += [ "//third_party/crashpad/crashpad/client" ]
|
|
} else {
|
|
include_dirs = [ "//third_party/breakpad/breakpad/src" ]
|
|
|
|
if (is_ios) {
|
|
sources += [ "crash_key_breakpad_ios.mm" ]
|
|
|
|
configs += [ "//build/config/compiler:enable_arc" ]
|
|
} else {
|
|
sources += [
|
|
"crash_key_breakpad.cc",
|
|
"crash_key_internal.h",
|
|
]
|
|
}
|
|
|
|
deps += [ "//third_party/breakpad:client" ]
|
|
}
|
|
}
|
|
|
|
static_library("crash_key_utils") {
|
|
visibility = [ ":*" ]
|
|
|
|
sources = [
|
|
"crash_keys.cc",
|
|
"crash_keys.h",
|
|
]
|
|
|
|
deps = [
|
|
":crash_key",
|
|
"//base",
|
|
]
|
|
}
|
|
|
|
if (is_mac || is_ios) {
|
|
component("zombies") {
|
|
visibility = [ ":common" ]
|
|
|
|
sources = [
|
|
"objc_zombie.h",
|
|
"objc_zombie.mm",
|
|
]
|
|
|
|
defines = [ "CRASH_CORE_COMMON_IMPLEMENTATION" ]
|
|
|
|
deps = [
|
|
":crash_key",
|
|
"//base",
|
|
]
|
|
|
|
libs = [ "Foundation.framework" ]
|
|
}
|
|
}
|
|
|
|
source_set("unit_tests") {
|
|
testonly = true
|
|
sources = [
|
|
"crash_key_unittest.cc",
|
|
"crash_keys_unittest.cc",
|
|
]
|
|
|
|
deps = [
|
|
":common",
|
|
"//base",
|
|
"//testing/gtest",
|
|
]
|
|
|
|
if (is_mac || is_ios) {
|
|
sources += [ "objc_zombie_unittest.mm" ]
|
|
}
|
|
|
|
if (!is_mac && !is_win && !is_fuchsia) {
|
|
include_dirs = [ "//third_party/breakpad/breakpad/src/" ]
|
|
sources += [ "crash_key_breakpad_unittest.cc" ]
|
|
}
|
|
|
|
if (is_fuchsia) {
|
|
sources -= [ "crash_key_unittest.cc" ]
|
|
}
|
|
}
|