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:
parent
f03dde725e
commit
820db3ca9e
@ -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
|
||||
)
|
||||
|
@ -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".
|
||||
|
Loading…
Reference in New Issue
Block a user