| # Copyright 2020 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # This file contains the definition of the template absl_source_set which |
| # should be the only type of target needed in abseil's BUILD.gn files. |
| # This template will correctly set "configs" and "public_configs" in order |
| # to correctly compile abseil in Chromium. |
| # |
| # Targets that set visibility should set it to something more restrictive than |
| # `absl_visibility` (defined below). |
| # |
| # Usage: |
| # Most of the times its usage will be similar to the example below but all |
| # the arguments avilable in source_set are also available for absl_source_set. |
| # |
| # absl_source_set("foo") { |
| # sources = [ "foo.cc" ] |
| # public = [ "foo.h" ] |
| # deps = [ ":bar" ] |
| # } |
| |
| import("//build_overrides/build.gni") |
| |
| # Usage of Abseil in Chromium is guarded by an explicit opt-in list, before |
| # adding projects to this list please reach out to cxx@chromium.org and CC: |
| # - https://cs.chromium.org/chromium/src/third_party/abseil-cpp/OWNERS |
| # |
| # More information can be found at: |
| # https://docs.google.com/document/d/1DgS1-A3rzboTLjpf4m1sqkJgWjnY_Ru2dokk1X1vBDU |
| declare_args() { |
| # Additional targets that can depend on absl. |
| additional_absl_clients = [] |
| } |
| |
| _chromium_absl_clients = [ |
| "//libassistant/*", |
| "//third_party/blink/renderer/modules/peerconnection", |
| "//third_party/blink/renderer/platform", |
| "//third_party/googletest:gtest", |
| "//third_party/openscreen/src/third_party/abseil/*", |
| "//third_party/private_membership/*", |
| "//third_party/shell-encryption/*", |
| "//third_party/webrtc/*", |
| ] |
| |
| # When adding a new package to `absl_visibility`, please check that all the |
| # Abseil dependencies that are required are listed in the dependencies of |
| # //third_party/abseil-cpp:absl. If not, please add them and run: |
| # //third_party/abseil-cpp/generate_def_file.py. |
| absl_visibility = _chromium_absl_clients + additional_absl_clients |
| |
| template("absl_source_set") { |
| source_set(target_name) { |
| forward_variables_from(invoker, "*") |
| configs -= [ "//build/config/compiler:chromium_code" ] |
| configs += [ |
| "//build/config/compiler:no_chromium_code", |
| "//third_party/abseil-cpp:absl_default_cflags_cc", |
| ] |
| |
| if (is_component_build) { |
| defines = [ "ABSL_BUILD_DLL" ] |
| if (!is_win) { |
| configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] |
| configs += [ "//build/config/gcc:symbol_visibility_default" ] |
| } |
| } |
| |
| if (!defined(public_configs)) { |
| public_configs = [] |
| } |
| public_configs += [ "//third_party/abseil-cpp:absl_include_config" ] |
| |
| if (!defined(visibility)) { |
| if (build_with_chromium) { |
| visibility = [ |
| "//third_party/abseil-cpp/*", |
| |
| # WebRTC binary to run PSNR and SSIM video quality analysis. It |
| # statically links absl and it is used by "browser_tests" when |
| # is_component_build=false but it cannot depend on the absl |
| # component because it uses absl/flags. |
| "//third_party/webrtc/rtc_tools:frame_analyzer", |
| # WebRTC binaries used by //:chromium_builder_asan, they both |
| # statically link absl (because they depend on absl/flags) and are |
| # used by Chromium only when is_component_build=false. |
| "//third_party/webrtc/rtc_tools:rtp_generator", |
| "//third_party/webrtc/rtc_tools:video_replay", |
| ] |
| } else { |
| visibility = [ "*" ] |
| } |
| } |
| } |
| } |