load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "ANDROID_JSC_DEPS", "APPLE", "APPLE_JSC_DEPS", "get_android_inspector_flags", "get_apple_compiler_flags", "get_apple_inspector_flags", "get_debug_preprocessor_flags", "react_native_xplat_target", "rn_xplat_cxx_library") CXX_LIBRARY_COMPILER_FLAGS = [ "-std=c++14", "-Wall", ] rn_xplat_cxx_library( name = "module", header_namespace = "", exported_headers = subdir_glob( [ ("", "CxxModule.h"), ("", "JsArgumentHelpers.h"), ("", "JsArgumentHelpers-inl.h"), ], prefix = "cxxreact", ), compiler_flags = CXX_LIBRARY_COMPILER_FLAGS, fbobjc_compiler_flags = get_apple_compiler_flags(), force_static = True, visibility = [ "PUBLIC", ], deps = [ "xplat//folly:molly", ], ) rn_xplat_cxx_library( name = "jsbigstring", srcs = [ "JSBigString.cpp", ], header_namespace = "", exported_headers = subdir_glob( [("", "JSBigString.h")], prefix = "cxxreact", ), compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ "-fexceptions", "-frtti", ], fbobjc_compiler_flags = get_apple_compiler_flags(), force_static = True, visibility = [ "PUBLIC", ], deps = [ "xplat//folly:memory", "xplat//folly:molly", "xplat//folly:scope_guard", ], ) rn_xplat_cxx_library( name = "samplemodule", srcs = ["SampleCxxModule.cpp"], header_namespace = "", exported_headers = ["SampleCxxModule.h"], compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ "-fno-omit-frame-pointer", "-fexceptions", ], fbobjc_compiler_flags = get_apple_compiler_flags(), soname = "libxplat_react_module_samplemodule.$(ext)", visibility = [ "PUBLIC", ], deps = [ "xplat//folly:memory", "xplat//folly:molly", "xplat//third-party/glog:glog", ":module", ], ) CXXREACT_PUBLIC_HEADERS = [ "CxxNativeModule.h", "Instance.h", "JSBundleType.h", "JSExecutor.h", "JSCExecutor.h", "JSCNativeModules.h", "JSCUtils.h", "JSDeltaBundleClient.h", "JSIndexedRAMBundle.h", "JSModulesUnbundle.h", "MessageQueueThread.h", "MethodCall.h", "ModuleRegistry.h", "NativeModule.h", "NativeToJsBridge.h", "Platform.h", "RAMBundleRegistry.h", "ReactMarker.h", "RecoverableError.h", "SharedProxyCxxModule.h", "SystraceSection.h", ] rn_xplat_cxx_library( name = "bridge", srcs = glob( ["*.cpp"], exclude = [ "JSBigString.cpp", "SampleCxxModule.cpp", ], ), headers = glob( ["*.h"], exclude = CXXREACT_PUBLIC_HEADERS, ), header_namespace = "", exported_headers = dict([ ( "cxxreact/%s" % header, header, ) for header in CXXREACT_PUBLIC_HEADERS ]), compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [ "-fexceptions", "-frtti", ], fbandroid_deps = ANDROID_JSC_DEPS, fbandroid_preprocessor_flags = get_android_inspector_flags() + [ "-DWITH_JSC_EXTRA_TRACING=1", "-DWITH_JSC_MEMORY_PRESSURE=1", "-DWITH_FB_MEMORY_PROFILING=1", ], fbobjc_compiler_flags = get_apple_compiler_flags(), fbobjc_deps = APPLE_JSC_DEPS, fbobjc_force_static = True, fbobjc_frameworks = [ "$SDKROOT/System/Library/Frameworks/JavaScriptCore.framework", ], fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), force_static = True, macosx_tests_override = [], platforms = (ANDROID, APPLE), preprocessor_flags = [ "-DLOG_TAG=\"ReactNative\"", "-DWITH_FBSYSTRACE=1", ], tests = [ react_native_xplat_target("cxxreact/tests:tests"), ], visibility = ["PUBLIC"], deps = [ "xplat//fbsystrace:fbsystrace", "xplat//folly:headers_only", "xplat//folly:memory", "xplat//folly:molly", ":jsbigstring", ":module", react_native_xplat_target("jschelpers:jschelpers"), react_native_xplat_target("jsinspector:jsinspector"), react_native_xplat_target("microprofiler:microprofiler"), "xplat//folly:optional", "xplat//third-party/glog:glog", react_native_xplat_target("jschelpers:jscinternalhelpers"), react_native_xplat_target("privatedata:privatedata"), ], )