1load( 2 "//tools/build_defs/oss:rn_defs.bzl", 3 "ANDROID", 4 "APPLE", 5 "CXX", 6 "FBJNI_TARGET", 7 "fb_xplat_cxx_test", 8 "get_apple_compiler_flags", 9 "get_apple_inspector_flags", 10 "get_preprocessor_flags_for_build_mode", 11 "react_native_target", 12 "react_native_xplat_target", 13 "rn_xplat_cxx_library", 14 "subdir_glob", 15) 16 17APPLE_COMPILER_FLAGS = get_apple_compiler_flags() 18 19rn_xplat_cxx_library( 20 name = "graphics", 21 srcs = glob( 22 [ 23 "*.cpp", 24 ], 25 ), 26 headers = subdir_glob( 27 [ 28 ("", "*.h"), 29 ], 30 prefix = "", 31 ), 32 header_namespace = "", 33 exported_headers = subdir_glob( 34 [ 35 ("", "*.h"), 36 ], 37 prefix = "react/renderer/graphics", 38 ), 39 cxx_exported_headers = subdir_glob( 40 [ 41 ("platform/cxx/react/renderer/graphics", "**/*.h"), 42 ], 43 prefix = "react/renderer/graphics", 44 ), 45 cxx_srcs = glob( 46 [ 47 "platform/cxx/react/renderer/graphics/**/*.cpp", 48 ], 49 ), 50 fbandroid_allow_jni_merging = True, 51 fbandroid_deps = [ 52 FBJNI_TARGET, 53 react_native_target("jni/react/jni:jni"), 54 ], 55 fbandroid_exported_headers = subdir_glob( 56 [ 57 ("platform/android/react/renderer/graphics", "**/*.h"), 58 ("platform/cxx/react/renderer/graphics", "**/*.h"), 59 ], 60 exclude = ["platform/cxx/react/renderer/graphics/PlatformColorParser.h"], 61 prefix = "react/renderer/graphics", 62 ), 63 fbandroid_srcs = glob( 64 [ 65 "platform/cxx/react/renderer/graphics/**/*.cpp", 66 "platform/android/react/renderer/graphics/**/*.cpp", 67 ], 68 exclude = ["platform/cxx/react/renderer/graphics/PlatformColorParser.h"], 69 ), 70 fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, 71 fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), 72 force_static = True, 73 ios_deps = [ 74 "//xplat/js/react-native-github:RCTCxxBridge", 75 "//xplat/js/react-native-github:RCTImage", 76 ], 77 ios_exported_headers = subdir_glob( 78 [ 79 ("platform/ios", "*.h"), 80 ], 81 prefix = "react/renderer/graphics", 82 ), 83 ios_frameworks = [ 84 "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", 85 "$SDKROOT/System/Library/Frameworks/Foundation.framework", 86 "$SDKROOT/System/Library/Frameworks/UIKit.framework", 87 ], 88 ios_srcs = glob( 89 [ 90 "platform/ios/**/*.cpp", 91 "platform/ios/**/*.mm", 92 ], 93 ), 94 labels = [ 95 "pfh:ReactNative_CommonInfrastructurePlaceholder", 96 "supermodule:xplat/default/public.react_native.infra", 97 ], 98 macosx_tests_override = [], 99 platforms = (ANDROID, APPLE, CXX), 100 preprocessor_flags = [ 101 "-DLOG_TAG=\"ReactNative\"", 102 "-DWITH_FBSYSTRACE=1", 103 ], 104 tests = [":tests"], 105 visibility = ["PUBLIC"], 106 deps = [ 107 react_native_xplat_target("react/debug:debug"), 108 react_native_xplat_target("butter:butter"), 109 "//third-party/glog:glog", 110 "//xplat/fbsystrace:fbsystrace", 111 "//xplat/folly:headers_only_do_not_use", 112 "//xplat/folly:memory", 113 "//xplat/folly:molly", 114 ], 115) 116 117fb_xplat_cxx_test( 118 name = "tests", 119 srcs = glob(["tests/**/*.cpp"]), 120 headers = glob(["tests/**/*.h"]), 121 compiler_flags = [ 122 "-fexceptions", 123 "-frtti", 124 "-std=c++17", 125 "-Wall", 126 ], 127 contacts = ["[email protected]"], 128 platforms = (ANDROID, APPLE, CXX), 129 deps = [ 130 ":graphics", 131 "//xplat/folly:molly", 132 "//xplat/third-party/gmock:gtest", 133 ], 134) 135