2016-06-12 03:47:59 +00:00
|
|
|
CXX_LIBRARY_COMPILER_FLAGS = []
|
2017-02-25 05:40:45 +00:00
|
|
|
|
2016-06-12 03:47:59 +00:00
|
|
|
REACT_LIBRARY_EXTRA_COMPILER_FLAGS = []
|
2017-02-25 05:40:45 +00:00
|
|
|
|
2016-06-12 03:47:59 +00:00
|
|
|
if THIS_IS_FBOBJC:
|
2016-08-29 20:20:14 +00:00
|
|
|
inherited_buck_flags = STATIC_LIBRARY_IOS_FLAGS
|
2016-08-29 17:09:11 +00:00
|
|
|
CXX_LIBRARY_COMPILER_FLAGS = inherited_buck_flags.get_flag_value('compiler_flags')
|
2016-06-22 20:42:55 +00:00
|
|
|
REACT_LIBRARY_EXTRA_COMPILER_FLAGS = ['-Wno-shadow', '-Wno-missing-prototypes', '-Wno-global-constructors']
|
2016-06-12 03:47:59 +00:00
|
|
|
|
2016-05-04 02:29:58 +00:00
|
|
|
def kwargs_add(base_kwargs, **new_kwargs):
|
|
|
|
ret_kwargs = dict(base_kwargs)
|
|
|
|
for name, add_value in new_kwargs.iteritems():
|
|
|
|
if name in ret_kwargs:
|
|
|
|
# Don't use +=, it will modify base_kwargs
|
|
|
|
ret_kwargs[name] = ret_kwargs[name] + add_value
|
|
|
|
else:
|
|
|
|
ret_kwargs[name] = add_value
|
|
|
|
return ret_kwargs
|
|
|
|
|
|
|
|
if THIS_IS_FBANDROID:
|
|
|
|
include_defs('//ReactAndroid/DEFS')
|
|
|
|
|
|
|
|
def react_library(**kwargs):
|
|
|
|
kwargs = kwargs_add(
|
|
|
|
kwargs,
|
|
|
|
compiler_flags = [
|
|
|
|
'-Wno-pessimizing-move',
|
|
|
|
],
|
|
|
|
deps = [
|
2017-03-14 18:40:20 +00:00
|
|
|
'//xplat/folly:molly'
|
2016-05-04 02:29:58 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
cxx_library(
|
|
|
|
name = 'bridge',
|
|
|
|
**kwargs_add(
|
|
|
|
kwargs,
|
|
|
|
preprocessor_flags = [
|
|
|
|
'-DWITH_JSC_EXTRA_TRACING=1',
|
|
|
|
'-DWITH_JSC_MEMORY_PRESSURE=1',
|
|
|
|
'-DWITH_REACT_INTERNAL_SETTINGS=1',
|
|
|
|
'-DWITH_FB_MEMORY_PROFILING=1',
|
2017-04-06 12:50:28 +00:00
|
|
|
'-DWITH_INSPECTOR=1',
|
2016-05-04 02:29:58 +00:00
|
|
|
],
|
2017-01-10 15:04:49 +00:00
|
|
|
deps = JSC_DEPS,
|
|
|
|
visibility = [
|
|
|
|
# TL;DR: If you depend on this target directly, you're gonna have a
|
|
|
|
# Bad Time(TM).
|
|
|
|
#
|
|
|
|
# `facebook::react::JSCExecutor::initOnJSVMThread` (in `:bridge`) does
|
|
|
|
# some platform-dependant setup. Exactly what setup to do is
|
|
|
|
# determined by some static functors, defined in `Platform.h`, which
|
|
|
|
# are initially `nullptr`. On Android, these functors are properly
|
|
|
|
# assigned as part of `xreact`'s `JNI_OnLoad`. By depending directly
|
|
|
|
# on the bridge, we can mess up the SO initialisation order, causing
|
|
|
|
# `initOnJSVMThread` to be called before the platform-specific hooks
|
|
|
|
# have been properly initialised. Bad Times(TM).
|
|
|
|
# -- @ashokmenon (2017/01/03)
|
|
|
|
react_native_target('jni/xreact/jni:jni'),
|
|
|
|
react_native_xplat_target('cxxreact/...'),
|
|
|
|
],
|
2016-05-04 02:29:58 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2017-02-14 06:15:40 +00:00
|
|
|
if THIS_IS_FBOBJC:
|
2016-05-04 02:29:58 +00:00
|
|
|
def react_library(**kwargs):
|
2017-03-15 14:23:23 +00:00
|
|
|
fb_apple_library(
|
2016-05-04 02:29:58 +00:00
|
|
|
name = 'bridge',
|
|
|
|
header_path_prefix = "cxxreact",
|
2016-08-29 20:20:14 +00:00
|
|
|
inherited_buck_flags = STATIC_LIBRARY_IOS_FLAGS,
|
2016-05-04 02:29:58 +00:00
|
|
|
frameworks = [
|
|
|
|
'$SDKROOT/System/Library/Frameworks/JavaScriptCore.framework',
|
|
|
|
],
|
2016-09-19 11:43:09 +00:00
|
|
|
tests = [
|
|
|
|
react_native_xplat_target('cxxreact/tests:tests')
|
|
|
|
],
|
2016-05-04 02:29:58 +00:00
|
|
|
**kwargs_add(
|
|
|
|
kwargs,
|
2016-05-14 00:15:03 +00:00
|
|
|
preprocessor_flags = DEBUG_PREPROCESSOR_FLAGS,
|
2016-05-04 02:29:58 +00:00
|
|
|
deps = [
|
|
|
|
'//xplat/folly:molly',
|
2017-01-10 15:04:49 +00:00
|
|
|
],
|
|
|
|
visibility = [ 'PUBLIC' ],
|
2016-05-04 02:29:58 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2016-05-25 02:24:57 +00:00
|
|
|
cxx_library(
|
2017-02-25 05:40:45 +00:00
|
|
|
name = "module",
|
|
|
|
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS,
|
|
|
|
exported_headers = [
|
|
|
|
"CxxModule.h",
|
|
|
|
"JsArgumentHelpers.h",
|
|
|
|
"JsArgumentHelpers-inl.h",
|
|
|
|
],
|
|
|
|
force_static = True,
|
|
|
|
header_namespace = "cxxreact",
|
2017-03-19 20:59:41 +00:00
|
|
|
labels = ["accounts_for_platform_and_build_mode_flags"],
|
2017-02-25 05:40:45 +00:00
|
|
|
visibility = [
|
|
|
|
"PUBLIC",
|
|
|
|
],
|
|
|
|
xcode_public_headers_symlinks = True,
|
|
|
|
deps = [
|
|
|
|
"//xplat/folly:molly",
|
|
|
|
],
|
2016-05-25 02:24:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cxx_library(
|
2017-02-25 05:40:45 +00:00
|
|
|
name = "samplemodule",
|
|
|
|
srcs = ["SampleCxxModule.cpp"],
|
|
|
|
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
|
|
|
|
"-fno-omit-frame-pointer",
|
|
|
|
"-Wall",
|
|
|
|
"-Werror",
|
|
|
|
"-std=c++1y",
|
|
|
|
"-fexceptions",
|
|
|
|
],
|
|
|
|
exported_headers = ["SampleCxxModule.h"],
|
|
|
|
header_namespace = "",
|
|
|
|
soname = "libxplat_react_module_samplemodule.so",
|
|
|
|
visibility = [
|
|
|
|
"PUBLIC",
|
|
|
|
],
|
|
|
|
xcode_public_headers_symlinks = True,
|
|
|
|
deps = [
|
|
|
|
":module",
|
|
|
|
"//xplat/folly:molly",
|
|
|
|
],
|
2016-05-25 02:24:57 +00:00
|
|
|
)
|
2016-05-04 02:29:58 +00:00
|
|
|
|
2016-09-30 16:27:50 +00:00
|
|
|
CXXREACT_PUBLIC_HEADERS = [
|
2017-02-25 05:40:45 +00:00
|
|
|
"CxxNativeModule.h",
|
|
|
|
"Executor.h",
|
|
|
|
"Instance.h",
|
2017-04-04 17:29:05 +00:00
|
|
|
"JSBigString.h",
|
|
|
|
"JSBundleType.h",
|
2017-02-25 05:40:45 +00:00
|
|
|
"JSCExecutor.h",
|
|
|
|
"JSCNativeModules.h",
|
|
|
|
"JSIndexedRAMBundle.h",
|
|
|
|
"JSModulesUnbundle.h",
|
|
|
|
"MessageQueueThread.h",
|
|
|
|
"MethodCall.h",
|
|
|
|
"ModuleRegistry.h",
|
|
|
|
"NativeModule.h",
|
|
|
|
"NativeToJsBridge.h",
|
|
|
|
"Platform.h",
|
|
|
|
"RecoverableError.h",
|
2017-04-04 17:29:05 +00:00
|
|
|
"SharedProxyCxxModule.h",
|
2017-02-25 05:40:45 +00:00
|
|
|
"SystraceSection.h",
|
2016-09-30 16:27:50 +00:00
|
|
|
]
|
|
|
|
|
2016-05-04 02:29:58 +00:00
|
|
|
react_library(
|
2017-02-25 05:40:45 +00:00
|
|
|
srcs = glob(
|
|
|
|
["*.cpp"],
|
|
|
|
excludes = ["SampleCxxModule.cpp"],
|
|
|
|
),
|
|
|
|
compiler_flags = [
|
|
|
|
"-Wall",
|
|
|
|
"-fexceptions",
|
|
|
|
"-frtti",
|
|
|
|
"-std=c++1y",
|
|
|
|
] + REACT_LIBRARY_EXTRA_COMPILER_FLAGS,
|
|
|
|
exported_headers = CXXREACT_PUBLIC_HEADERS,
|
|
|
|
force_static = True,
|
|
|
|
header_namespace = "cxxreact",
|
|
|
|
headers = glob(
|
|
|
|
["*.h"],
|
|
|
|
excludes = CXXREACT_PUBLIC_HEADERS,
|
|
|
|
),
|
|
|
|
preprocessor_flags = [
|
|
|
|
"-DLOG_TAG=\"ReactNative\"",
|
|
|
|
"-DWITH_FBSYSTRACE=1",
|
|
|
|
],
|
|
|
|
xcode_public_headers_symlinks = True,
|
|
|
|
deps = [
|
|
|
|
":module",
|
|
|
|
"//xplat/fbsystrace:fbsystrace",
|
|
|
|
react_native_xplat_target("jschelpers:jschelpers"),
|
|
|
|
react_native_xplat_target("microprofiler:microprofiler"),
|
|
|
|
],
|
2016-05-04 02:29:58 +00:00
|
|
|
)
|