Home | History | Annotate | Download | only in base
      1 # 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 
     15 import("//build_overrides/build.gni")
     16 import("../../gn/perfetto.gni")
     17 
     18 source_set("base") {
     19   deps = [
     20     "../../gn:default_deps",
     21   ]
     22   public_deps = [
     23     "../../include/perfetto/base",
     24   ]
     25   sources = [
     26     "file_utils.cc",
     27     "page_allocator.cc",
     28     "string_splitter.cc",
     29     "string_utils.cc",
     30     "temp_file.cc",
     31     "thread_checker.cc",
     32     "unix_task_runner.cc",
     33     "virtual_destructors.cc",
     34   ]
     35   if (!build_with_chromium && (is_linux || is_android)) {
     36     sources += [ "watchdog_posix.cc" ]
     37   } else {
     38     sources += [ "watchdog_noop.cc" ]
     39   }
     40   if (is_debug && !build_with_chromium && !build_with_android) {
     41     deps += [ ":debug_crash_stack_trace" ]
     42   }
     43 }
     44 
     45 # 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).
     48 if (is_android && !build_with_chromium) {
     49   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 
     65 if (is_debug && !build_with_chromium && !build_with_android) {
     66   source_set("debug_crash_stack_trace") {
     67     sources = [
     68       "debug_crash_stack_trace.cc",
     69     ]
     70     deps = [
     71       "../../gn:default_deps",
     72     ]
     73     if (is_linux || is_android) {
     74       deps += [ "../../buildtools:libbacktrace" ]
     75     }
     76     cflags = [ "-Wno-deprecated" ]
     77   }
     78 }
     79 
     80 source_set("test_support") {
     81   testonly = true
     82   deps = [
     83     ":base",
     84     "../../gn:default_deps",
     85     "../../gn:gtest_deps",
     86   ]
     87   sources = [
     88     "test/test_task_runner.cc",
     89     "test/test_task_runner.h",
     90     "test/vm_test_utils.cc",
     91     "test/vm_test_utils.h",
     92   ]
     93 }
     94 
     95 source_set("unittests") {
     96   testonly = true
     97   deps = [
     98     ":base",
     99     ":test_support",
    100     "../../gn:default_deps",
    101     "../../gn:gtest_deps",
    102   ]
    103   if (is_android && !build_with_chromium) {
    104     deps += [ ":android_task_runner" ]
    105   }
    106   sources = [
    107     "page_allocator_unittest.cc",
    108     "scoped_file_unittest.cc",
    109     "string_splitter_unittest.cc",
    110     "string_utils_unittest.cc",
    111     "task_runner_unittest.cc",
    112     "temp_file_unittest.cc",
    113     "thread_checker_unittest.cc",
    114     "time_unittest.cc",
    115     "utils_unittest.cc",
    116     "weak_ptr_unittest.cc",
    117   ]
    118   if (!build_with_chromium && (is_linux || is_android)) {
    119     sources += [ "watchdog_unittest.cc" ]
    120   }
    121 }
    122