2023-01-30 11:38:52 -07:00
|
|
|
project(VisionCamera)
|
2023-02-13 07:22:45 -07:00
|
|
|
cmake_minimum_required(VERSION 3.9.0)
|
2021-06-27 04:37:54 -06:00
|
|
|
|
2023-02-13 07:22:45 -07:00
|
|
|
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)
|
2023-01-30 11:38:52 -07:00
|
|
|
|
2023-02-13 07:22:45 -07:00
|
|
|
# Folly
|
2023-02-08 09:48:22 -07:00
|
|
|
include("${NODE_MODULES_DIR}/react-native/ReactAndroid/cmake-utils/folly-flags.cmake")
|
|
|
|
add_compile_options(${folly_FLAGS})
|
2023-01-30 11:38:52 -07:00
|
|
|
|
2023-02-13 07:22:45 -07:00
|
|
|
# Third party libraries (Prefabs)
|
2023-02-08 09:48:22 -07:00
|
|
|
find_package(ReactAndroid REQUIRED CONFIG)
|
2023-02-13 07:22:45 -07:00
|
|
|
find_package(fbjni REQUIRED CONFIG)
|
|
|
|
find_package(react-native-worklets REQUIRED CONFIG)
|
|
|
|
find_library(LOG_LIB log)
|
2021-06-27 04:37:54 -06:00
|
|
|
|
2023-05-04 04:30:24 -06:00
|
|
|
|
|
|
|
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()
|
|
|
|
|
2023-02-13 07:22:45 -07:00
|
|
|
# Add react-native-vision-camera sources
|
2021-06-27 04:37:54 -06:00
|
|
|
add_library(
|
|
|
|
${PACKAGE_NAME}
|
|
|
|
SHARED
|
2023-02-21 07:00:48 -07:00
|
|
|
../cpp/JSITypedArray.cpp
|
2021-06-27 04:37:54 -06:00
|
|
|
src/main/cpp/VisionCamera.cpp
|
|
|
|
src/main/cpp/JSIJNIConversion.cpp
|
2021-09-29 04:30:50 -06:00
|
|
|
src/main/cpp/FrameHostObject.cpp
|
2021-06-27 04:37:54 -06:00
|
|
|
src/main/cpp/FrameProcessorRuntimeManager.cpp
|
|
|
|
src/main/cpp/CameraView.cpp
|
2021-07-30 02:27:45 -06:00
|
|
|
src/main/cpp/VisionCameraScheduler.cpp
|
2021-09-29 04:30:50 -06:00
|
|
|
src/main/cpp/java-bindings/JFrameProcessorPlugin.cpp
|
2021-07-30 02:27:45 -06:00
|
|
|
src/main/cpp/java-bindings/JImageProxy.cpp
|
|
|
|
src/main/cpp/java-bindings/JHashMap.cpp
|
2021-06-27 04:37:54 -06:00
|
|
|
)
|
|
|
|
|
2023-02-13 07:22:45 -07:00
|
|
|
# Header Search Paths (includes)
|
2023-02-08 09:48:22 -07:00
|
|
|
target_include_directories(
|
|
|
|
${PACKAGE_NAME}
|
|
|
|
PRIVATE
|
2023-02-21 07:00:48 -07:00
|
|
|
"../cpp"
|
2023-02-13 07:22:45 -07:00
|
|
|
"src/main/cpp"
|
2023-02-08 09:48:22 -07:00
|
|
|
"${NODE_MODULES_DIR}/react-native/ReactCommon"
|
|
|
|
"${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker"
|
2023-02-13 07:22:45 -07:00
|
|
|
"${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/react/turbomodule" # <-- CallInvokerHolder JNI wrapper
|
2023-05-04 04:30:24 -06:00
|
|
|
|
|
|
|
# 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"
|
2021-10-07 03:16:19 -06:00
|
|
|
)
|
|
|
|
|
2023-02-13 07:22:45 -07:00
|
|
|
# Link everything together
|
2021-07-23 06:28:38 -06:00
|
|
|
target_link_libraries(
|
|
|
|
${PACKAGE_NAME}
|
2023-02-13 07:22:45 -07:00
|
|
|
${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
|
2023-05-04 04:30:24 -06:00
|
|
|
${SKIA_PACKAGE} # <-- Optional: RN Skia
|
2021-07-30 01:50:09 -06:00
|
|
|
)
|