android: add build support with RNSkia

This still depends on this PR to be merged: https://github.com/Shopify/react-native-skia/pull/1550
This commit is contained in:
Hanno J. Gödecke 2023-05-04 12:30:24 +02:00
parent f03dde725e
commit 820db3ca9e
No known key found for this signature in database
GPG Key ID: 2F82ED4387020662
2 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,16 @@ find_package(fbjni REQUIRED CONFIG)
find_package(react-native-worklets REQUIRED CONFIG)
find_library(LOG_LIB log)
set(RNSKIA_PATH ${NODE_MODULES_DIR}/@shopify/react-native-skia)
if(EXISTS ${RNSKIA_PATH})
find_package(shopify_react-native-skia REQUIRED CONFIG)
set(SKIA_PACKAGE shopify_react-native-skia::rnskia)
message("VisionCamera: Skia integration enabled!")
else()
message("VisionCamera: Skia integration disabled!")
ENDIF()
# Add react-native-vision-camera sources
add_library(
${PACKAGE_NAME}
@ -42,6 +52,14 @@ target_include_directories(
"${NODE_MODULES_DIR}/react-native/ReactCommon"
"${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker"
"${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/react/turbomodule" # <-- CallInvokerHolder JNI wrapper
# We need to include the headers from skia
# (Note: rnskia includes all their files without any relative path
# so for example "include/core/SkImage.h" becomes #include "SkImage.h".
# That's why for the prefab of rnskia, we flatten all cpp files into
# just one directory. HOWEVER, skia itself uses relative paths in
# their include statements, and so we have to include the path to skia)
"${RNSKIA_PATH}/cpp/skia"
)
# Link everything together
@ -54,4 +72,5 @@ target_link_libraries(
ReactAndroid::folly_runtime # <-- RN: For casting JSI <> Java objects
fbjni::fbjni # <-- fbjni
react-native-worklets::rnworklets # <-- RN Worklets
${SKIA_PACKAGE} # <-- Optional: RN Skia
)

View File

@ -157,6 +157,7 @@ dependencies {
implementation "androidx.exifinterface:exifinterface:1.3.3"
implementation project(":react-native-worklets")
implementation project(":shopify_react-native-skia")
}
// Resolves "LOCAL_SRC_FILES points to a missing file, Check that libfb.so exists or that its path is correct".