| 
									
										
										
										
											2023-01-30 19:38:52 +01:00
										 |  |  | project(VisionCamera)
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | cmake_minimum_required(VERSION 3.9.0)
 | 
					
						
							| 
									
										
										
										
											2021-06-27 12:37:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | set(PACKAGE_NAME "VisionCamera")
 | 
					
						
							|  |  |  | set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
 | 
					
						
							|  |  |  | set(CMAKE_VERBOSE_MAKEFILE ON)
 | 
					
						
							|  |  |  | set(CMAKE_CXX_STANDARD 17)
 | 
					
						
							| 
									
										
										
										
											2023-01-30 19:38:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | # Third party libraries (Prefabs)
 | 
					
						
							| 
									
										
										
										
											2023-02-08 17:48:22 +01:00
										 |  |  | find_package(ReactAndroid REQUIRED CONFIG)
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | find_package(fbjni REQUIRED CONFIG)
 | 
					
						
							|  |  |  | find_library(LOG_LIB log)
 | 
					
						
							| 
									
										
										
										
											2021-06-27 12:37:54 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-15 18:04:35 +01:00
										 |  |  | if (ENABLE_FRAME_PROCESSORS)
 | 
					
						
							|  |  |  |         add_definitions(-DVISION_CAMERA_ENABLE_FRAME_PROCESSORS=true)
 | 
					
						
							|  |  |  | else()
 | 
					
						
							|  |  |  |         add_definitions(-DVISION_CAMERA_ENABLE_FRAME_PROCESSORS=false)
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2023-05-04 12:30:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-21 12:50:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | # Add react-native-vision-camera sources
 | 
					
						
							| 
									
										
										
										
											2021-06-27 12:37:54 +02:00
										 |  |  | add_library( | 
					
						
							|  |  |  |         ${PACKAGE_NAME}
 | 
					
						
							|  |  |  |         SHARED
 | 
					
						
							| 
									
										
										
										
											2024-01-17 20:18:46 +01:00
										 |  |  |         # Shared C++
 | 
					
						
							|  |  |  |         ../cpp/MutableRawBuffer.cpp
 | 
					
						
							|  |  |  |         # Java JNI
 | 
					
						
							| 
									
										
										
										
											2023-07-22 00:15:11 +02:00
										 |  |  |         src/main/cpp/VisionCamera.cpp
 | 
					
						
							| 
									
										
										
										
											2023-09-22 17:22:31 +02:00
										 |  |  |         src/main/cpp/VideoPipeline.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/PassThroughShader.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/OpenGLContext.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/OpenGLRenderer.cpp
 | 
					
						
							| 
									
										
										
										
											2024-01-17 20:18:46 +01:00
										 |  |  |         src/main/cpp/MutableJByteBuffer.cpp
 | 
					
						
							| 
									
										
										
										
											2023-08-25 12:22:44 +02:00
										 |  |  |         # Frame Processor
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/FrameHostObject.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/FrameProcessorPluginHostObject.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/JSIJNIConversion.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/VisionCameraProxy.cpp
 | 
					
						
							| 
									
										
										
										
											2024-01-12 16:00:36 +01:00
										 |  |  |         src/main/cpp/frameprocessor/java-bindings/JSharedArray.cpp
 | 
					
						
							| 
									
										
										
										
											2023-08-25 12:22:44 +02:00
										 |  |  |         src/main/cpp/frameprocessor/java-bindings/JFrame.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/java-bindings/JFrameProcessor.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/java-bindings/JFrameProcessorPlugin.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/java-bindings/JVisionCameraProxy.cpp
 | 
					
						
							|  |  |  |         src/main/cpp/frameprocessor/java-bindings/JVisionCameraScheduler.cpp
 | 
					
						
							| 
									
										
										
										
											2021-06-27 12:37:54 +02:00
										 |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | # Header Search Paths (includes)
 | 
					
						
							| 
									
										
										
										
											2023-02-08 17:48:22 +01:00
										 |  |  | target_include_directories( | 
					
						
							|  |  |  |         ${PACKAGE_NAME}
 | 
					
						
							|  |  |  |         PRIVATE
 | 
					
						
							| 
									
										
										
										
											2023-02-21 15:00:48 +01:00
										 |  |  |         "../cpp"
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  |         "src/main/cpp"
 | 
					
						
							| 
									
										
										
										
											2023-08-25 12:22:44 +02:00
										 |  |  |         "src/main/cpp/frameprocessor"
 | 
					
						
							|  |  |  |         "src/main/cpp/frameprocessor/java-bindings"
 | 
					
						
							| 
									
										
										
										
											2023-02-08 17:48:22 +01:00
										 |  |  |         "${NODE_MODULES_DIR}/react-native/ReactCommon"
 | 
					
						
							|  |  |  |         "${NODE_MODULES_DIR}/react-native/ReactCommon/callinvoker"
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  |         "${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/jni/react/turbomodule" # <-- CallInvokerHolder JNI wrapper
 | 
					
						
							| 
									
										
										
										
											2021-10-07 11:16:19 +02:00
										 |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  | # Link everything together
 | 
					
						
							| 
									
										
										
										
											2021-07-23 14:28:38 +02:00
										 |  |  | target_link_libraries( | 
					
						
							|  |  |  |         ${PACKAGE_NAME}
 | 
					
						
							| 
									
										
										
										
											2023-02-13 15:22:45 +01:00
										 |  |  |         ${LOG_LIB}                          # <-- Logcat logger
 | 
					
						
							|  |  |  |         android                             # <-- Android JNI core
 | 
					
						
							|  |  |  |         ReactAndroid::jsi                   # <-- RN: JSI
 | 
					
						
							|  |  |  |         ReactAndroid::reactnativejni        # <-- RN: React Native JNI bindings
 | 
					
						
							|  |  |  |         fbjni::fbjni                        # <-- fbjni
 | 
					
						
							| 
									
										
										
										
											2023-09-22 17:22:31 +02:00
										 |  |  |         GLESv2                              # <-- OpenGL (for VideoPipeline)
 | 
					
						
							|  |  |  |         EGL                                 # <-- OpenGL (EGL) (for VideoPipeline)
 | 
					
						
							| 
									
										
										
										
											2021-07-30 09:50:09 +02:00
										 |  |  | )
 | 
					
						
							| 
									
										
										
										
											2023-08-23 12:42:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Optionally also add Frame Processors here
 | 
					
						
							| 
									
										
										
										
											2023-11-15 18:04:35 +01:00
										 |  |  | message("VisionCamera: Frame Processors: ${ENABLE_FRAME_PROCESSORS}!")
 | 
					
						
							|  |  |  | if (ENABLE_FRAME_PROCESSORS)
 | 
					
						
							|  |  |  |     message("VisionCamera: Linking react-native-worklets...")
 | 
					
						
							| 
									
										
										
										
											2023-08-23 12:42:38 +02:00
										 |  |  |     find_package(react-native-worklets-core REQUIRED CONFIG)
 | 
					
						
							|  |  |  |     target_link_libraries( | 
					
						
							|  |  |  |             ${PACKAGE_NAME}
 | 
					
						
							|  |  |  |             react-native-worklets-core::rnworklets
 | 
					
						
							|  |  |  |     )
 | 
					
						
							|  |  |  | endif()
 |