BUILD.gn 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Copyright 2022 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("//build/rust/mixed_static_library.gni")
  5. import("//build/rust/rust_macro.gni")
  6. import("//testing/test.gni")
  7. if (enable_rust) {
  8. mixed_static_library("rust_gtest_interop") {
  9. testonly = true
  10. sources = [
  11. "rust_gtest_interop.cc",
  12. "rust_gtest_interop.h",
  13. ]
  14. if (enable_rust) {
  15. rs_crate_root = "rust_gtest_interop.rs"
  16. rs_sources = [
  17. "expect_macros.rs",
  18. "rust_gtest_interop.rs",
  19. ]
  20. rs_cxx_bindings = [ "rust_gtest_interop.rs" ]
  21. rs_deps = [
  22. # Macros re-exported from the rust_gtest_interop crate. Can only be
  23. # accessed through the crate, so not public_deps.
  24. ":gtest_attribute",
  25. # This is re-exported for the gtest_attribute macros.
  26. "//third_party/rust/small_ctor/v0_1:test_support",
  27. ]
  28. deps = [
  29. "//build/rust:cxx_cppdeps",
  30. "//testing/gtest",
  31. ]
  32. }
  33. }
  34. rust_macro("gtest_attribute") {
  35. testonly = true
  36. crate_root = "gtest_attribute.rs"
  37. sources = [ "gtest_attribute.rs" ]
  38. deps = [
  39. "//third_party/rust/proc_macro2/v1:lib",
  40. "//third_party/rust/quote/v1:lib",
  41. "//third_party/rust/syn/v1:lib",
  42. ]
  43. # This target's contents are exposed as part of :rust_gtest_interop.
  44. visibility = [ ":*" ]
  45. }
  46. mixed_static_library("test_support") {
  47. rs_crate_name = "rust_gtest_interop_test_support"
  48. testonly = true
  49. sources = [
  50. "test/test_subclass.cc",
  51. "test/test_subclass.h",
  52. ]
  53. rs_crate_root = "test/test_subclass.rs"
  54. rs_sources = [ "test/test_subclass.rs" ]
  55. rs_cxx_bindings = [ "test/test_subclass.rs" ]
  56. rs_deps = [ ":rust_gtest_interop" ]
  57. public_deps = [
  58. ":rust_gtest_interop",
  59. "//testing/gtest",
  60. ]
  61. }
  62. test("rust_gtest_interop_unittests") {
  63. sources = [ "rust_gtest_interop_unittest_main.cc" ]
  64. deps = [
  65. ":test_support",
  66. "//base",
  67. "//base/test:test_support",
  68. "//testing/gtest",
  69. ]
  70. rs_deps = [ ":test_support" ]
  71. rs_sources = [ "rust_gtest_interop_unittest.rs" ]
  72. }
  73. }