mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
15302284cc
Summary: First of all, seems it's the right thing to do. Fabric C++ code is cross-platfrom and should run on *all* platforms including Windows, Linux, and Mac. While we don't have a real *production* use cases where we need compilation for desktops, having CXX target is really handy for two reasons: * It simplifies local test running process. Instead of going to `/fbandroid/` and executing something like `buck test fbsource//xplat/js/react-native-github/ReactCommon/fabric/core:coreAndroid` (note the suffix). We can just do `buck test fbsource//xplat/js/react-native-github/ReactCommon/fabric/core:core` everywhere and it works now out of the box. Running tests with "Apple" flavor never worked for me. * It allows creating synthetic benchmark tests (using Google Benchmark) that can be used as a rough approximation of code micro-optimizations. Reviewed By: JoshuaGross Differential Revision: D15608678 fbshipit-source-id: d2449035685dbca6ab983480f5334ec4ac11cd35
83 lines
2.2 KiB
Python
83 lines
2.2 KiB
Python
load("@fbsource//tools/build_defs/apple:flag_defs.bzl", "get_debug_preprocessor_flags")
|
|
load(
|
|
"//tools/build_defs/oss:rn_defs.bzl",
|
|
"ANDROID",
|
|
"APPLE",
|
|
"CXX",
|
|
"fb_xplat_cxx_test",
|
|
"get_apple_compiler_flags",
|
|
"get_apple_inspector_flags",
|
|
"react_native_xplat_target",
|
|
"rn_xplat_cxx_library",
|
|
"subdir_glob",
|
|
)
|
|
|
|
APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
|
|
|
|
rn_xplat_cxx_library(
|
|
name = "attributedstring",
|
|
srcs = glob(
|
|
["**/*.cpp"],
|
|
exclude = glob(["tests/**/*.cpp"]),
|
|
),
|
|
headers = glob(
|
|
["**/*.h"],
|
|
exclude = glob(["tests/**/*.h"]),
|
|
),
|
|
header_namespace = "",
|
|
exported_headers = subdir_glob(
|
|
[
|
|
("", "*.h"),
|
|
],
|
|
prefix = "react/attributedstring",
|
|
),
|
|
compiler_flags = [
|
|
"-fexceptions",
|
|
"-frtti",
|
|
"-std=c++14",
|
|
"-Wall",
|
|
],
|
|
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
|
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(),
|
|
force_static = True,
|
|
macosx_tests_override = [],
|
|
platforms = (ANDROID, APPLE, CXX),
|
|
preprocessor_flags = [
|
|
"-DLOG_TAG=\"ReactNative\"",
|
|
"-DWITH_FBSYSTRACE=1",
|
|
],
|
|
tests = [":tests"],
|
|
visibility = ["PUBLIC"],
|
|
deps = [
|
|
"fbsource//xplat/fbsystrace:fbsystrace",
|
|
"fbsource//xplat/folly:headers_only",
|
|
"fbsource//xplat/folly:memory",
|
|
"fbsource//xplat/folly:molly",
|
|
"fbsource//xplat/third-party/glog:glog",
|
|
react_native_xplat_target("utils:utils"),
|
|
react_native_xplat_target("fabric/debug:debug"),
|
|
react_native_xplat_target("fabric/core:core"),
|
|
react_native_xplat_target("fabric/graphics:graphics"),
|
|
react_native_xplat_target("fabric/mounting:mounting"),
|
|
],
|
|
)
|
|
|
|
fb_xplat_cxx_test(
|
|
name = "tests",
|
|
srcs = glob(["tests/**/*.cpp"]),
|
|
headers = glob(["tests/**/*.h"]),
|
|
compiler_flags = [
|
|
"-fexceptions",
|
|
"-frtti",
|
|
"-std=c++14",
|
|
"-Wall",
|
|
],
|
|
contacts = ["oncall+react_native@xmail.facebook.com"],
|
|
platforms = (ANDROID, APPLE, CXX),
|
|
deps = [
|
|
"fbsource//xplat/folly:molly",
|
|
"fbsource//xplat/third-party/gmock:gtest",
|
|
":attributedstring",
|
|
],
|
|
)
|