blob: 18d11b63800e0212e50db95e9f00d73f6ab1d531 [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")
Primiano Tucci38faa6f2018-04-01 20:12:08 +020016import("../../gn/perfetto.gni")
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000017
18source_set("base") {
19 deps = [
20 "../../gn:default_deps",
21 ]
22 public_deps = [
23 "../../include/perfetto/base",
24 ]
25 sources = [
Florian Mayer74b73a92018-03-09 17:37:13 +000026 "file_utils.cc",
Primiano Tuccibbaa58c2017-12-20 13:48:20 +010027 "page_allocator.cc",
Primiano Tucci825e6de2018-03-13 05:43:15 +000028 "string_splitter.cc",
Hector Dearman13bd85c2018-04-27 16:46:52 +010029 "string_utils.cc",
Primiano Tucci941b2212018-03-14 22:46:31 +000030 "temp_file.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000031 "thread_checker.cc",
32 "unix_task_runner.cc",
Primiano Tucci3cbb10a2018-04-10 17:52:40 +010033 "virtual_destructors.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000034 ]
Lalit Magantie419ccb2018-03-06 11:48:03 +000035 if (!build_with_chromium && (is_linux || is_android)) {
Primiano Tucci808d6df2018-03-31 13:24:18 +010036 sources += [ "watchdog_posix.cc" ]
37 } else {
38 sources += [ "watchdog_noop.cc" ]
Primiano Tuccic96f71b2018-02-06 19:21:09 +000039 }
Primiano Tucci38faa6f2018-04-01 20:12:08 +020040 if (is_debug && !build_with_chromium && !build_with_android) {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000041 deps += [ ":debug_crash_stack_trace" ]
42 }
43}
44
Primiano Tucci6ea459c2018-01-10 10:42:27 +000045# The "android_task_runner" should be depended on only by targets that
46# explicitly need it, as it pulls in a dependency on libandroid.so that in turn
47# pulls dozen of other .so(s).
Oystein Eftevaagf7a0d7e2018-01-12 13:02:43 -080048if (is_android && !build_with_chromium) {
Primiano Tucci6ea459c2018-01-10 10:42:27 +000049 source_set("android_task_runner") {
50 deps = [
51 ":base",
52 "../../gn:default_deps",
53 ]
54 sources = [
55 "android_task_runner.cc",
56 ]
57 all_dependent_configs = [ ":android_config" ]
58 }
59
60 config("android_config") {
61 libs = [ "android" ]
62 }
63}
64
Primiano Tucci38faa6f2018-04-01 20:12:08 +020065if (is_debug && !build_with_chromium && !build_with_android) {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000066 source_set("debug_crash_stack_trace") {
67 sources = [
68 "debug_crash_stack_trace.cc",
69 ]
Primiano Tuccia5ff2a82017-12-20 11:37:00 +010070 deps = [
71 "../../gn:default_deps",
72 ]
Primiano Tucci38faa6f2018-04-01 20:12:08 +020073 if (is_linux || is_android) {
74 deps += [ "../../buildtools:libbacktrace" ]
75 }
Primiano Tucci3cbb10a2018-04-10 17:52:40 +010076 cflags = [ "-Wno-deprecated" ]
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000077 }
78}
79
80source_set("test_support") {
81 testonly = true
82 deps = [
83 ":base",
84 "../../gn:default_deps",
Primiano Tuccibbaa58c2017-12-20 13:48:20 +010085 "../../gn:gtest_deps",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000086 ]
87 sources = [
Florian Mayerc7255fd2018-01-25 10:29:24 +000088 "test/test_task_runner.cc",
89 "test/test_task_runner.h",
Florian Mayerd8bd81b2018-01-25 12:49:15 +000090 "test/vm_test_utils.cc",
91 "test/vm_test_utils.h",
Florian Mayerc7255fd2018-01-25 10:29:24 +000092 ]
93}
94
Hector Dearman6cfec8a2018-03-14 16:54:09 +000095source_set("unittests") {
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000096 testonly = true
97 deps = [
98 ":base",
99 ":test_support",
100 "../../gn:default_deps",
101 "../../gn:gtest_deps",
102 ]
Oystein Eftevaagf7a0d7e2018-01-12 13:02:43 -0800103 if (is_android && !build_with_chromium) {
Primiano Tucci6ea459c2018-01-10 10:42:27 +0000104 deps += [ ":android_task_runner" ]
105 }
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000106 sources = [
Primiano Tuccibbaa58c2017-12-20 13:48:20 +0100107 "page_allocator_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000108 "scoped_file_unittest.cc",
Primiano Tucci825e6de2018-03-13 05:43:15 +0000109 "string_splitter_unittest.cc",
Hector Dearman13bd85c2018-04-27 16:46:52 +0100110 "string_utils_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000111 "task_runner_unittest.cc",
Primiano Tucci941b2212018-03-14 22:46:31 +0000112 "temp_file_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000113 "thread_checker_unittest.cc",
Primiano Tucci8934c6c2018-03-15 11:39:27 +0000114 "time_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000115 "utils_unittest.cc",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000116 "weak_ptr_unittest.cc",
117 ]
Lalit Magantie419ccb2018-03-06 11:48:03 +0000118 if (!build_with_chromium && (is_linux || is_android)) {
Primiano Tuccic96f71b2018-02-06 19:21:09 +0000119 sources += [ "watchdog_unittest.cc" ]
120 }
Primiano Tucci4f9b6d72017-12-05 20:59:16 +0000121}