BUCK 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_preprocessor_flags_for_build_mode")
  2. load(
  3. "//tools/build_defs/oss:rn_defs.bzl",
  4. "ANDROID",
  5. "APPLE",
  6. "CXX",
  7. "fb_xplat_cxx_test",
  8. "get_apple_compiler_flags",
  9. "get_apple_inspector_flags",
  10. "rn_xplat_cxx_library",
  11. "subdir_glob",
  12. )
  13. APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
  14. rn_xplat_cxx_library(
  15. name = "graphics",
  16. srcs = glob(
  17. [
  18. "*.cpp",
  19. ],
  20. ),
  21. headers = subdir_glob(
  22. [
  23. ("", "*.h"),
  24. ],
  25. prefix = "",
  26. ),
  27. header_namespace = "",
  28. exported_headers = subdir_glob(
  29. [
  30. ("", "*.h"),
  31. ],
  32. prefix = "react/graphics",
  33. ),
  34. compiler_flags = [
  35. "-fexceptions",
  36. "-frtti",
  37. "-std=c++14",
  38. "-Wall",
  39. ],
  40. cxx_exported_headers = subdir_glob(
  41. [
  42. ("platform/cxx", "**/*.h"),
  43. ],
  44. prefix = "react/graphics",
  45. ),
  46. cxx_srcs = glob(
  47. [
  48. "platform/cxx/**/*.cpp",
  49. ],
  50. ),
  51. fbandroid_exported_headers = subdir_glob(
  52. [
  53. ("platform/cxx", "**/*.h"),
  54. ],
  55. prefix = "react/graphics",
  56. ),
  57. fbandroid_srcs = glob(
  58. [
  59. "platform/cxx/**/*.cpp",
  60. ],
  61. ),
  62. fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
  63. fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
  64. fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
  65. force_static = True,
  66. ios_deps = [
  67. "//xplat/js:RCTImage",
  68. "//xplat/js/react-native-github:RCTCxxBridge",
  69. ],
  70. ios_exported_headers = subdir_glob(
  71. [
  72. ("platform/ios", "*.h"),
  73. ],
  74. prefix = "react/graphics",
  75. ),
  76. ios_frameworks = [
  77. "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework",
  78. "$SDKROOT/System/Library/Frameworks/Foundation.framework",
  79. "$SDKROOT/System/Library/Frameworks/UIKit.framework",
  80. ],
  81. ios_srcs = glob(
  82. [
  83. "platform/ios/**/*.cpp",
  84. "platform/ios/**/*.mm",
  85. ],
  86. ),
  87. macosx_tests_override = [],
  88. platforms = (ANDROID, APPLE, CXX),
  89. preprocessor_flags = [
  90. "-DLOG_TAG=\"ReactNative\"",
  91. "-DWITH_FBSYSTRACE=1",
  92. ],
  93. tests = [":tests"],
  94. visibility = ["PUBLIC"],
  95. deps = [
  96. "//xplat/fbsystrace:fbsystrace",
  97. "//xplat/folly:headers_only",
  98. "//xplat/folly:memory",
  99. "//xplat/folly:molly",
  100. "//xplat/third-party/glog:glog",
  101. ],
  102. )
  103. fb_xplat_cxx_test(
  104. name = "tests",
  105. srcs = glob(["tests/**/*.cpp"]),
  106. headers = glob(["tests/**/*.h"]),
  107. compiler_flags = [
  108. "-fexceptions",
  109. "-frtti",
  110. "-std=c++14",
  111. "-Wall",
  112. ],
  113. contacts = ["oncall+react_native@xmail.facebook.com"],
  114. platforms = (ANDROID, APPLE, CXX),
  115. deps = [
  116. ":graphics",
  117. "//xplat/folly:molly",
  118. "//xplat/third-party/gmock:gtest",
  119. ],
  120. )