project(VisionCamera) cmake_minimum_required(VERSION 3.9.0) set(CMAKE_VERBOSE_MAKEFILE ON) set(PACKAGE_NAME "VisionCamera") set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_CXX_STANDARD 17) # Folly include("${NODE_MODULES_DIR}/react-native/ReactAndroid/cmake-utils/folly-flags.cmake") add_compile_options(${folly_FLAGS}) # Third party libraries (Prefabs) find_package(ReactAndroid REQUIRED CONFIG) find_package(fbjni REQUIRED CONFIG) find_package(react-native-worklets REQUIRED CONFIG) find_library(LOG_LIB log) # Skia is optional, if it's enabled we link it. if (ENABLE_SKIA_INTEGRATION) find_package(shopify_react-native-skia REQUIRED CONFIG) endif() # Add react-native-vision-camera sources add_library( ${PACKAGE_NAME} SHARED ../cpp/JSITypedArray.cpp src/main/cpp/VisionCamera.cpp src/main/cpp/JSIJNIConversion.cpp src/main/cpp/FrameHostObject.cpp src/main/cpp/FrameProcessorRuntimeManager.cpp src/main/cpp/CameraView.cpp src/main/cpp/VisionCameraScheduler.cpp src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp src/main/cpp/java-bindings/JImageProxy.cpp src/main/cpp/java-bindings/JHashMap.cpp ) # Header Search Paths (includes) target_include_directories( ${PACKAGE_NAME} PRIVATE "../cpp" "src/main/cpp" "${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 ) # Link everything together target_link_libraries( ${PACKAGE_NAME} ${LOG_LIB} # <-- Logcat logger android # <-- Android JNI core ReactAndroid::jsi # <-- RN: JSI ReactAndroid::reactnativejni # <-- RN: React Native JNI bindings ReactAndroid::folly_runtime # <-- RN: For casting JSI <> Java objects fbjni::fbjni # <-- fbjni react-native-worklets::rnworklets # <-- RN Worklets ) # Skia is optional. If it's enabled, we link it if (ENABLE_SKIA_INTEGRATION) target_link_libraries( ${PACKAGE_NAME} shopify_react-native-skia::rnskia # <-- RN Skia ) endif()