Home | History | Annotate | Download | only in gn
      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("perfetto.gni")
     16 
     17 # Used in production targets (i.e. testonly == false) for the FRIEND_TEST_*
     18 # macros.
     19 group("gtest_prod_config") {
     20   if (!build_with_chromium) {
     21     public_configs = [ "//buildtools:googletest_prod_config" ]
     22   } else {
     23     public_configs = [ ":gtest_config" ]
     24   }
     25 }
     26 
     27 config("gtest_config") {
     28   if (build_with_chromium) {
     29     include_dirs = [ "//testing/gtest/include" ]
     30   }
     31 }
     32 
     33 group("gtest_deps") {
     34   testonly = true
     35 
     36   public_configs = [ ":gtest_config" ]
     37 
     38   if (!build_with_chromium) {
     39     public_deps = [
     40       "//buildtools:gmock",
     41       "//buildtools:gtest",
     42     ]
     43   } else {
     44     public_deps = [
     45       "//testing/gmock",
     46       "//testing/gtest",
     47     ]
     48   }
     49 }
     50 
     51 group("gtest_main") {
     52   testonly = true
     53 
     54   if (!build_with_chromium) {
     55     public_deps = [
     56       "//buildtools:gtest_main",
     57     ]
     58   } else {
     59     public_deps = [
     60       "//testing/gtest:gtest_main",
     61     ]
     62   }
     63 }
     64 
     65 # protoc compiler library, for building protoc plugins on the host.
     66 if (current_toolchain == host_toolchain) {
     67   group("protoc_lib_deps") {
     68     if (!build_with_chromium) {
     69       public_deps = [
     70         "//buildtools:protoc_lib",
     71       ]
     72     } else {
     73       public_deps = [
     74         "//third_party/protobuf:protoc_lib",
     75       ]
     76     }
     77   }
     78 }
     79 
     80 group("protobuf_full_deps") {
     81   testonly = true
     82 
     83   if (!build_with_chromium) {
     84     public_deps = [
     85       "//buildtools:protobuf_full",
     86     ]
     87   } else {
     88     public_deps = [
     89       "//third_party/protobuf:protobuf_full",
     90     ]
     91   }
     92 }
     93 
     94 # All targets should depend on this target to inherit the right flags and
     95 # include directories.
     96 group("default_deps") {
     97   public_configs = [ ":default_config" ]
     98   if (!build_with_chromium) {
     99     public_deps = [
    100       "//gn/standalone/libc++:deps",
    101       "//gn/standalone/sanitizers:deps",
    102     ]
    103   } else {
    104     public_deps = [
    105       "//build/config:exe_and_shlib_deps",
    106     ]
    107   }
    108 }
    109 
    110 config("default_config") {
    111   defines = [ "PERFETTO_IMPLEMENTATION" ]
    112 
    113   if (build_with_chromium) {
    114     if (is_component_build) {
    115       defines += [ "PERFETTO_SHARED_LIBRARY" ]
    116     }
    117 
    118     defines += [ "PERFETTO_BUILD_WITH_CHROMIUM" ]
    119 
    120     if (is_android) {
    121       # Included for __android_log_print
    122       libs = [ "log" ]
    123     }
    124   }
    125 
    126   include_dirs = [
    127     "..",
    128     "../include",
    129   ]
    130 }
    131 
    132 config("public_config") {
    133   include_dirs = [
    134     "../include",
    135 
    136     # The below are needed due to generated protobuf headers including other
    137     # headers with a path relative to the perfetto root.
    138     "${root_gen_dir}/${perfetto_root_path}/protos",
    139   ]
    140 }
    141 
    142 config("fuzzer_config") {
    143   ldflags = [ "-fsanitize=fuzzer" ]
    144 }
    145