|
| 1 | +load("//configurations/buck/apple:flag_defs.bzl", "OBJC_ARC_PREPROCESSOR_FLAGS", "get_application_ios_flags", "get_debug_preprocessor_flags") |
| 2 | +load("//ReactNative:DEFS.bzl", "ANDROID", "APPLE", "IS_OSS_BUILD", "get_apple_inspector_flags", "react_native_xplat_target", "rn_xplat_cxx_library") |
| 3 | + |
| 4 | +APPLE_COMPILER_FLAGS = [] |
| 5 | + |
| 6 | +if not IS_OSS_BUILD: |
| 7 | + load("@xplat//configurations/buck/apple:flag_defs.bzl", "flags", "get_static_library_ios_flags") |
| 8 | + |
| 9 | + APPLE_COMPILER_FLAGS = flags.get_flag_value(get_static_library_ios_flags(), "compiler_flags") |
| 10 | + |
| 11 | +rn_xplat_cxx_library( |
| 12 | + name = "imagemanager", |
| 13 | + srcs = glob( |
| 14 | + [ |
| 15 | + "*.cpp", |
| 16 | + ], |
| 17 | + exclude = glob(["tests/**/*.cpp"]), |
| 18 | + ), |
| 19 | + header_namespace = "", |
| 20 | + compiler_flags = [ |
| 21 | + "-fexceptions", |
| 22 | + "-frtti", |
| 23 | + "-std=c++14", |
| 24 | + "-Wall", |
| 25 | + ], |
| 26 | + fbandroid_exported_headers = subdir_glob( |
| 27 | + [ |
| 28 | + ("", "*.h"), |
| 29 | + ], |
| 30 | + prefix = "fabric/imagemanager", |
| 31 | + ), |
| 32 | + fbandroid_headers = subdir_glob( |
| 33 | + [ |
| 34 | + ("", "*.h"), |
| 35 | + ("platform/android", "**/*.h"), |
| 36 | + ], |
| 37 | + prefix = "", |
| 38 | + ), |
| 39 | + fbandroid_srcs = glob( |
| 40 | + [ |
| 41 | + "platform/android/**/*.cpp", |
| 42 | + ], |
| 43 | + ), |
| 44 | + fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, |
| 45 | + fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(), |
| 46 | + fbobjc_tests = [ |
| 47 | + ":tests", |
| 48 | + ], |
| 49 | + force_static = True, |
| 50 | + frameworks = [ |
| 51 | + "$SDKROOT/System/Library/Frameworks/CoreGraphics.framework", |
| 52 | + "$SDKROOT/System/Library/Frameworks/Foundation.framework", |
| 53 | + "$SDKROOT/System/Library/Frameworks/UIKit.framework", |
| 54 | + ], |
| 55 | + ios_deps = [ |
| 56 | + "xplat//js:RCTImage", |
| 57 | + "xplat//js/react-native-github:RCTCxxBridge", |
| 58 | + ], |
| 59 | + ios_exported_headers = subdir_glob( |
| 60 | + [ |
| 61 | + ("", "*.h"), |
| 62 | + ("platform/ios", "RCTImagePrimitivesConversions.h"), |
| 63 | + ], |
| 64 | + prefix = "fabric/imagemanager", |
| 65 | + ), |
| 66 | + ios_headers = subdir_glob( |
| 67 | + [ |
| 68 | + ("", "*.h"), |
| 69 | + ("platform/ios", "**/*.h"), |
| 70 | + ], |
| 71 | + prefix = "", |
| 72 | + ), |
| 73 | + ios_srcs = glob( |
| 74 | + [ |
| 75 | + "platform/ios/**/*.cpp", |
| 76 | + "platform/ios/**/*.mm", |
| 77 | + ], |
| 78 | + ), |
| 79 | + macosx_tests_override = [], |
| 80 | + platforms = (ANDROID, APPLE), |
| 81 | + preprocessor_flags = [ |
| 82 | + "-DLOG_TAG=\"ReactNative\"", |
| 83 | + "-DWITH_FBSYSTRACE=1", |
| 84 | + ], |
| 85 | + tests = [], |
| 86 | + visibility = ["PUBLIC"], |
| 87 | + deps = [ |
| 88 | + "xplat//fbsystrace:fbsystrace", |
| 89 | + "xplat//folly:futures", |
| 90 | + "xplat//folly:headers_only", |
| 91 | + "xplat//folly:memory", |
| 92 | + "xplat//folly:molly", |
| 93 | + "xplat//third-party/glog:glog", |
| 94 | + "xplat//yoga:yoga", |
| 95 | + react_native_xplat_target("fabric/core:core"), |
| 96 | + react_native_xplat_target("fabric/debug:debug"), |
| 97 | + react_native_xplat_target("fabric/graphics:graphics"), |
| 98 | + ], |
| 99 | +) |
| 100 | + |
| 101 | +if not IS_OSS_BUILD: |
| 102 | + load("@xplat//build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test") |
| 103 | + |
| 104 | + fb_xplat_cxx_test( |
| 105 | + name = "tests", |
| 106 | + srcs = glob(["tests/**/*.cpp"]), |
| 107 | + headers = glob(["tests/**/*.h"]), |
| 108 | + contacts = ["oncall+react_native@xmail.facebook.com"], |
| 109 | + compiler_flags = [ |
| 110 | + "-fexceptions", |
| 111 | + "-frtti", |
| 112 | + "-std=c++14", |
| 113 | + "-Wall", |
| 114 | + ], |
| 115 | + platforms = APPLE, |
| 116 | + deps = [ |
| 117 | + "xplat//folly:molly", |
| 118 | + "xplat//third-party/gmock:gtest", |
| 119 | + ":imagemanager", |
| 120 | + ], |
| 121 | + ) |
0 commit comments