cc.gni 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Copyright 2016 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//testing/test.gni")
  5. cc_remove_configs = []
  6. cc_add_configs = [
  7. "//build/config:precompiled_headers",
  8. "//build/config/compiler:wexit_time_destructors",
  9. ]
  10. if (!is_debug) {
  11. cc_remove_configs += [ "//build/config/compiler:default_optimization" ]
  12. cc_add_configs += [ "//build/config/compiler:optimize_max" ]
  13. }
  14. template("cc_component") {
  15. component(target_name) {
  16. forward_variables_from(invoker, "*", [ "configs" ])
  17. if (defined(invoker.configs)) {
  18. configs += invoker.configs
  19. }
  20. configs -= cc_remove_configs
  21. configs += cc_add_configs
  22. }
  23. }
  24. template("cc_test_static_library") {
  25. static_library(target_name) {
  26. forward_variables_from(invoker, "*", [ "configs" ])
  27. if (defined(invoker.configs)) {
  28. configs += invoker.configs
  29. }
  30. configs -= cc_remove_configs
  31. configs += cc_add_configs
  32. # Not needed in test code.
  33. configs -= [ "//build/config/compiler:wexit_time_destructors" ]
  34. }
  35. }
  36. template("cc_test") {
  37. test(target_name) {
  38. forward_variables_from(invoker, "*", [ "configs" ])
  39. if (defined(invoker.configs)) {
  40. configs += invoker.configs
  41. }
  42. configs -= cc_remove_configs
  43. configs += cc_add_configs
  44. # Not needed in test code.
  45. configs -= [ "//build/config/compiler:wexit_time_destructors" ]
  46. }
  47. }