mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-16 18:50:07 +08:00
Summary: `SharedFunction` implements a pattern of a shared callable object that contains the same executable inside. It's similar to `std::function` with one important difference: when the object is copied, the stored function (and captured values) are shared between instances (not copied). `SharedFunction` can be stored inside `std::function` because it's callable. It useful in some scenarios, such as: * When captured by `std::function` arguments are not copyable; * When we need to replace the content of the callable later on the go. We will use it in the coming diffs. Reviewed By: mdvacca Differential Revision: D14072078 fbshipit-source-id: 9df4ad2d1b92394e2dfef5c283f35c7c0bd4b500
32 lines
799 B
Python
32 lines
799 B
Python
load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob")
|
|
load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "get_apple_compiler_flags", "react_native_xplat_target", "rn_xplat_cxx_library")
|
|
|
|
CXX_LIBRARY_COMPILER_FLAGS = [
|
|
"-std=c++14",
|
|
"-Wall",
|
|
]
|
|
|
|
rn_xplat_cxx_library(
|
|
name = "utils",
|
|
header_namespace = "",
|
|
exported_headers = subdir_glob(
|
|
[
|
|
("", "*.h"),
|
|
],
|
|
prefix = "react/utils",
|
|
),
|
|
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
|
|
"-fexceptions",
|
|
"-frtti",
|
|
],
|
|
fbobjc_compiler_flags = get_apple_compiler_flags(),
|
|
force_static = True,
|
|
platforms = (ANDROID, APPLE),
|
|
visibility = [
|
|
"PUBLIC",
|
|
],
|
|
deps = [
|
|
react_native_xplat_target("better:better"),
|
|
],
|
|
)
|