Skip to content

Commit

Permalink
CC: Unify GN templates for all targets.
Browse files Browse the repository at this point in the history
Simplify precompiled headers config.

BUG=575043

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2532203003
Cr-Commit-Position: refs/heads/master@{#435498}
  • Loading branch information
loyso authored and Commit bot committed Dec 1, 2016
1 parent 3c8d298 commit 1fe38ba
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
12 changes: 3 additions & 9 deletions cc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import("//build/config/ui.gni")
import("//cc/cc.gni")
import("//testing/test.gni")

cc_component("cc") {
sources = [
Expand Down Expand Up @@ -540,8 +539,6 @@ cc_component("cc") {
]
}

configs = [ "//build/config:precompiled_headers" ]

public_deps = [
"//cc/base",
"//skia",
Expand Down Expand Up @@ -576,7 +573,7 @@ cc_component("cc") {
}
}

static_library("test_support") {
cc_static_library("test_support") {
testonly = true
sources = [
"test/animation_test_common.cc",
Expand Down Expand Up @@ -747,8 +744,6 @@ static_library("test_support") {
"test/test_web_graphics_context_3d.h",
]

configs += [ "//build/config:precompiled_headers" ]

public_deps = [
":cc",
"//cc/animation",
Expand Down Expand Up @@ -783,7 +778,7 @@ static_library("test_support") {
}
}

test("cc_unittests") {
cc_test("cc_unittests") {
sources = [
"base/contiguous_container_unittest.cc",
"base/delayed_unique_notifier_unittest.cc",
Expand Down Expand Up @@ -953,7 +948,6 @@ test("cc_unittests") {
"test/run_all_unittests.cc",
]

configs += [ "//build/config:precompiled_headers" ]
if (!is_android) {
data = [
"test/data/",
Expand Down Expand Up @@ -991,7 +985,7 @@ test("cc_unittests") {
]
}

test("cc_perftests") {
cc_test("cc_perftests") {
sources = [
"animation/animation_host_perftest.cc",
"ipc/cc_serialization_perftest.cc",
Expand Down
6 changes: 3 additions & 3 deletions cc/blink/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/test.gni")
import("//cc/cc.gni")

component("blink") {
cc_component("blink") {
output_name = "cc_blink"

sources = [
Expand Down Expand Up @@ -46,7 +46,7 @@ component("blink") {
]
}

test("cc_blink_unittests") {
cc_test("cc_blink_unittests") {
sources = [
"web_layer_impl_fixed_bounds_unittest.cc",

Expand Down
26 changes: 25 additions & 1 deletion cc/cc.gni
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//testing/test.gni")

cc_remove_configs = []
cc_add_configs = []
cc_add_configs = [ "//build/config:precompiled_headers" ]

if (!is_debug && (is_win || is_android)) {
cc_remove_configs += [ "//build/config/compiler:default_optimization" ]
Expand Down Expand Up @@ -31,3 +33,25 @@ template("cc_component") {
configs += cc_add_configs
}
}

template("cc_static_library") {
static_library(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs -= cc_remove_configs
configs += cc_add_configs
}
}

template("cc_test") {
test(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
if (defined(invoker.configs)) {
configs += invoker.configs
}
configs -= cc_remove_configs
configs += cc_add_configs
}
}
5 changes: 3 additions & 2 deletions cc/ipc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# found in the LICENSE file.

import("//build/config/ui.gni")
import("//cc/cc.gni")
import("//mojo/public/tools/bindings/mojom.gni")

component("ipc") {
cc_component("ipc") {
output_name = "cc_ipc"

defines = [ "CC_IPC_IMPLEMENTATION" ]
Expand Down Expand Up @@ -91,7 +92,7 @@ mojom("test_interfaces") {
]
}

source_set("struct_traits") {
cc_source_set("struct_traits") {
sources = [
"begin_frame_args_struct_traits.h",
"compositor_frame_metadata_struct_traits.cc",
Expand Down
3 changes: 2 additions & 1 deletion cc/proto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//cc/cc.gni")
import("//third_party/protobuf/proto_library.gni")

# Use a group here to allow external targets to depend on "cc/proto" instead of
Expand All @@ -13,7 +14,7 @@ group("proto") {
]
}

component("cc_proto") {
cc_component("cc_proto") {
# Only expose the target to the "proto" group.
visibility = [ ":proto" ]

Expand Down

0 comments on commit 1fe38ba

Please sign in to comment.