blob: db889742dc0f563ef13561ee21db0f6e7bb8d32a [file] [log] [blame]
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("../../gn/perfetto.gni")
import("../../gn/wasm.gni")
source_set("base") {
deps = [
"../../gn:default_deps",
]
public_deps = [
"../../include/perfetto/base",
]
sources = [
"file_utils.cc",
"metatrace.cc",
"page_allocator.cc",
"string_splitter.cc",
"string_utils.cc",
"thread_checker.cc",
"time.cc",
"virtual_destructors.cc",
]
# TODO(brucedawson): Enable these for Windows when possible.
if (!is_win) {
sources += [
"temp_file.cc",
"unix_task_runner.cc",
]
}
if (!build_with_chromium && (is_linux || is_android)) {
sources += [ "watchdog_posix.cc" ]
} else {
sources += [ "watchdog_noop.cc" ]
}
if (is_debug && build_standalone && !is_wasm) {
deps += [ ":debug_crash_stack_trace" ]
}
}
# The "android_task_runner" should be depended on only by targets that
# explicitly need it, as it pulls in a dependency on libandroid.so that in turn
# pulls dozen of other .so(s).
if (is_android && !build_with_chromium) {
source_set("android_task_runner") {
deps = [
":base",
"../../gn:default_deps",
]
sources = [
"android_task_runner.cc",
]
all_dependent_configs = [ ":android_config" ]
}
config("android_config") {
libs = [ "android" ]
}
}
if (is_debug && build_standalone && !is_wasm) {
source_set("debug_crash_stack_trace") {
sources = [
"debug_crash_stack_trace.cc",
]
deps = [
"../../gn:default_deps",
"../../include/perfetto/base",
]
if (is_linux || is_android) {
deps += [ "../../buildtools:libbacktrace" ]
}
cflags = [ "-Wno-deprecated" ]
}
}
if (!build_with_chromium) {
# This cannot be in :base as it does not build on WASM.
source_set("sock_utils") {
deps = [
"../../gn:default_deps",
"../../include/perfetto/base",
]
sources = [
"sock_utils.cc",
]
}
}
source_set("test_support") {
testonly = true
deps = [
":base",
"../../gn:default_deps",
"../../gn:gtest_deps",
]
sources = [
"test/utils.cc",
"test/utils.h",
"test/vm_test_utils.cc",
"test/vm_test_utils.h",
]
# The Perfetto task runner is not used on Windows.
if (!is_win) {
sources += [
"test/test_task_runner.cc",
"test/test_task_runner.h",
]
}
}
source_set("unittests") {
testonly = true
deps = [
":base",
":test_support",
"../../gn:default_deps",
"../../gn:gtest_deps",
]
if (is_android && !build_with_chromium) {
deps += [ ":android_task_runner" ]
}
sources = [
"page_allocator_unittest.cc",
"scoped_file_unittest.cc",
"string_splitter_unittest.cc",
"string_utils_unittest.cc",
"string_view_unittest.cc",
"time_unittest.cc",
"weak_ptr_unittest.cc",
]
# TODO(brucedawson): Enable these for Windows when possible.
if (!is_win) {
sources += [
"task_runner_unittest.cc",
"temp_file_unittest.cc",
"thread_checker_unittest.cc",
"utils_unittest.cc",
]
}
if (!build_with_chromium && (is_linux || is_android)) {
sources += [ "watchdog_unittest.cc" ]
}
}