blob: 26980025886f017166e7f7aa08cb01ce020e6998 [file] [log] [blame]
Primiano Tucci4f9b6d72017-12-05 20:59:16 +00001# Copyright (C) 2017 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("//build_overrides/build.gni")
16
17source_set("base") {
18 deps = [
19 "../../gn:default_deps",
20 ]
21 public_deps = [
22 "../../include/perfetto/base",
23 ]
24 sources = [
Florian Mayer74b73a92018-03-09 17:37:13 +000025 "file_utils.cc",
Primiano Tuccibbaa58c2017-12-20 13:48:20 +010026 "page_allocator.cc",
Primiano Tucci825e6de2018-03-13 05:43:15 +000027 "string_splitter.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000028 "thread_checker.cc",
29 "unix_task_runner.cc",
30 ]
Lalit Magantie419ccb2018-03-06 11:48:03 +000031 if (!build_with_chromium && (is_linux || is_android)) {
Primiano Tuccic96f71b2018-02-06 19:21:09 +000032 sources += [ "watchdog.cc" ]
33 }
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000034 if (is_debug) {
35 deps += [ ":debug_crash_stack_trace" ]
36 }
37}
38
Primiano Tucci6ea459c2018-01-10 10:42:27 +000039# The "android_task_runner" should be depended on only by targets that
40# explicitly need it, as it pulls in a dependency on libandroid.so that in turn
41# pulls dozen of other .so(s).
Oystein Eftevaagf7a0d7e2018-01-12 13:02:43 -080042if (is_android && !build_with_chromium) {
Primiano Tucci6ea459c2018-01-10 10:42:27 +000043 source_set("android_task_runner") {
44 deps = [
45 ":base",
46 "../../gn:default_deps",
47 ]
48 sources = [
49 "android_task_runner.cc",
50 ]
51 all_dependent_configs = [ ":android_config" ]
52 }
53
54 config("android_config") {
55 libs = [ "android" ]
56 }
57}
58
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000059if (is_debug) {
60 source_set("debug_crash_stack_trace") {
61 sources = [
62 "debug_crash_stack_trace.cc",
63 ]
64 cflags = [
65 "-Wno-deprecated-dynamic-exception-spec",
66 "-Wno-disabled-macro-expansion",
67 ]
Primiano Tuccia5ff2a82017-12-20 11:37:00 +010068 deps = [
69 "../../gn:default_deps",
70 ]
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000071 }
72}
73
74source_set("test_support") {
75 testonly = true
76 deps = [
77 ":base",
78 "../../gn:default_deps",
Primiano Tuccibbaa58c2017-12-20 13:48:20 +010079 "../../gn:gtest_deps",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000080 ]
81 sources = [
Florian Mayerc7255fd2018-01-25 10:29:24 +000082 "test/test_task_runner.cc",
83 "test/test_task_runner.h",
Florian Mayerd8bd81b2018-01-25 12:49:15 +000084 "test/vm_test_utils.cc",
85 "test/vm_test_utils.h",
Florian Mayerc7255fd2018-01-25 10:29:24 +000086 ]
87}
88
Primiano Tuccib03ba362017-12-06 09:47:41 +000089source_set("base_unittests") {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000090 testonly = true
91 deps = [
92 ":base",
93 ":test_support",
94 "../../gn:default_deps",
95 "../../gn:gtest_deps",
96 ]
Oystein Eftevaagf7a0d7e2018-01-12 13:02:43 -080097 if (is_android && !build_with_chromium) {
Primiano Tucci6ea459c2018-01-10 10:42:27 +000098 deps += [ ":android_task_runner" ]
99 }
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000100 sources = [
Primiano Tuccibbaa58c2017-12-20 13:48:20 +0100101 "page_allocator_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000102 "scoped_file_unittest.cc",
Primiano Tucci825e6de2018-03-13 05:43:15 +0000103 "string_splitter_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000104 "task_runner_unittest.cc",
105 "thread_checker_unittest.cc",
106 "utils_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000107 "weak_ptr_unittest.cc",
108 ]
Lalit Magantie419ccb2018-03-06 11:48:03 +0000109 if (!build_with_chromium && (is_linux || is_android)) {
Primiano Tuccic96f71b2018-02-06 19:21:09 +0000110 sources += [ "watchdog_unittest.cc" ]
111 }
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000112}