BUCK 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob")
  2. load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "get_android_inspector_flags", "get_apple_compiler_flags", "get_apple_inspector_flags", "get_preprocessor_flags_for_build_mode", "react_native_xplat_target", "rn_xplat_cxx_library")
  3. CXX_LIBRARY_COMPILER_FLAGS = [
  4. "-std=c++14",
  5. "-Wall",
  6. ]
  7. rn_xplat_cxx_library(
  8. name = "module",
  9. header_namespace = "",
  10. exported_headers = subdir_glob(
  11. [
  12. ("", "CxxModule.h"),
  13. ("", "JsArgumentHelpers.h"),
  14. ("", "JsArgumentHelpers-inl.h"),
  15. ],
  16. prefix = "cxxreact",
  17. ),
  18. compiler_flags = CXX_LIBRARY_COMPILER_FLAGS,
  19. fbobjc_compiler_flags = get_apple_compiler_flags(),
  20. fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
  21. force_static = True,
  22. visibility = [
  23. "PUBLIC",
  24. ],
  25. deps = [
  26. "//xplat/folly:molly",
  27. ],
  28. )
  29. rn_xplat_cxx_library(
  30. name = "jsbigstring",
  31. srcs = [
  32. "JSBigString.cpp",
  33. ],
  34. header_namespace = "",
  35. exported_headers = subdir_glob(
  36. [("", "JSBigString.h")],
  37. prefix = "cxxreact",
  38. ),
  39. compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
  40. "-fexceptions",
  41. "-frtti",
  42. ],
  43. fbobjc_compiler_flags = get_apple_compiler_flags(),
  44. fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
  45. force_static = True,
  46. preprocessor_flags = [
  47. "-DWITH_FBREMAP=1",
  48. ],
  49. visibility = [
  50. "PUBLIC",
  51. ],
  52. deps = [
  53. "//xplat/folly:memory",
  54. "//xplat/folly:molly",
  55. "//xplat/folly:scope_guard",
  56. ],
  57. )
  58. rn_xplat_cxx_library(
  59. name = "samplemodule",
  60. srcs = ["SampleCxxModule.cpp"],
  61. header_namespace = "",
  62. exported_headers = ["SampleCxxModule.h"],
  63. compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
  64. "-fno-omit-frame-pointer",
  65. "-fexceptions",
  66. ],
  67. fbobjc_compiler_flags = get_apple_compiler_flags(),
  68. soname = "libxplat_react_module_samplemodule.$(ext)",
  69. visibility = [
  70. "PUBLIC",
  71. ],
  72. deps = [
  73. ":module",
  74. "//xplat/folly:memory",
  75. "//xplat/folly:molly",
  76. "//xplat/third-party/glog:glog",
  77. ],
  78. )
  79. CXXREACT_PUBLIC_HEADERS = [
  80. "CxxNativeModule.h",
  81. "Instance.h",
  82. "JSBundleType.h",
  83. "JSDeltaBundleClient.h",
  84. "JSExecutor.h",
  85. "JSIndexedRAMBundle.h",
  86. "JSModulesUnbundle.h",
  87. "MessageQueueThread.h",
  88. "MethodCall.h",
  89. "ModuleRegistry.h",
  90. "NativeModule.h",
  91. "NativeToJsBridge.h",
  92. "RAMBundleRegistry.h",
  93. "ReactMarker.h",
  94. "RecoverableError.h",
  95. "SharedProxyCxxModule.h",
  96. "SystraceSection.h",
  97. ]
  98. rn_xplat_cxx_library(
  99. name = "bridge",
  100. srcs = glob(
  101. ["*.cpp"],
  102. exclude = [
  103. "JSBigString.cpp",
  104. "SampleCxxModule.cpp",
  105. ],
  106. ),
  107. headers = glob(
  108. ["*.h"],
  109. exclude = CXXREACT_PUBLIC_HEADERS,
  110. ),
  111. header_namespace = "",
  112. exported_headers = dict([
  113. (
  114. "cxxreact/%s" % header,
  115. header,
  116. )
  117. for header in CXXREACT_PUBLIC_HEADERS
  118. ]),
  119. compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
  120. "-fexceptions",
  121. "-frtti",
  122. ],
  123. fbandroid_preprocessor_flags = get_android_inspector_flags(),
  124. fbobjc_compiler_flags = get_apple_compiler_flags(),
  125. fbobjc_force_static = True,
  126. fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
  127. fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(),
  128. macosx_tests_override = [],
  129. platforms = (ANDROID, APPLE),
  130. preprocessor_flags = [
  131. "-DLOG_TAG=\"ReactNative\"",
  132. "-DWITH_FBSYSTRACE=1",
  133. ],
  134. tests = [
  135. react_native_xplat_target("cxxreact/tests:tests"),
  136. ],
  137. visibility = ["PUBLIC"],
  138. deps = [
  139. ":jsbigstring",
  140. ":module",
  141. "//xplat/fbsystrace:fbsystrace",
  142. "//xplat/folly:headers_only",
  143. "//xplat/folly:memory",
  144. "//xplat/folly:molly",
  145. react_native_xplat_target("callinvoker:callinvoker"),
  146. react_native_xplat_target("jsinspector:jsinspector"),
  147. react_native_xplat_target("microprofiler:microprofiler"),
  148. "//xplat/folly:optional",
  149. "//xplat/third-party/glog:glog",
  150. ],
  151. )