/
VisionCamera.podspec
109 lines (92 loc) 路 3.88 KB
/
VisionCamera.podspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
nodeModules = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..')
Pod::UI.puts "[VisionCamera] Thank you for using VisionCamera 鉂わ笍"
Pod::UI.puts "[VisionCamera] If you enjoy using VisionCamera, please consider sponsoring this project: http://github.com/sponsors/mrousavy"
enableLocation = true
if defined?($VCEnableLocation)
Pod::UI.puts "[VisionCamera] $VCEnableLocation is set to #{$VCEnableLocation}!"
enableLocation = $VCEnableLocation
else
Pod::UI.puts "[VisionCamera] $VCEnableLocation is not set, enabling CLLocation APIs by default..."
end
enableFrameProcessors = true
if defined?($VCEnableFrameProcessors)
Pod::UI.puts "[VisionCamera] $VCEnableFrameProcessors is set to #{$VCEnableFrameProcessors}!"
enableFrameProcessors = $VCEnableFrameProcessors
else
Pod::UI.puts "[VisionCamera] $VCEnableFrameProcessors is not set, enabling Frame Processors if Worklets is installed..."
end
Pod::UI.puts("[VisionCamera] node modules #{Dir.exist?(nodeModules) ? "found at #{nodeModules}" : "not found!"}")
workletsPath = File.join(nodeModules, "react-native-worklets-core")
hasWorklets = File.exist?(workletsPath)
if hasWorklets
Pod::UI.puts("[VisionCamera] react-native-worklets-core found, Frame Processors are #{enableFrameProcessors ? "enabled" : "disabled"}!")
else
Pod::UI.puts("[VisionCamera] react-native-worklets-core not found - Frame Processors are disabled!")
enableFrameProcessors = false
end
Pod::Spec.new do |s|
s.name = "VisionCamera"
s.version = package["version"]
s.summary = package["description"]
s.description = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]
s.platforms = { :ios => "12.4" }
s.source = { :git => "https://github.com/mrousavy/react-native-vision-camera.git", :tag => "#{s.version}" }
s.pod_target_xcconfig = {
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) VISION_CAMERA_ENABLE_FRAME_PROCESSORS=#{enableFrameProcessors}",
"SWIFT_ACTIVE_COMPILATION_CONDITIONS" => "$(inherited) #{enableFrameProcessors ? "VISION_CAMERA_ENABLE_FRAME_PROCESSORS" : ""}",
}
s.requires_arc = true
s.subspec 'Core' do |core|
# VisionCamera Core Swift codebase
core.source_files = [
"ios/Core/**/*.swift"
]
core.pod_target_xcconfig = {
"SWIFT_ACTIVE_COMPILATION_CONDITIONS" => "$(inherited) #{enableLocation ? "VISION_CAMERA_ENABLE_LOCATION" : ""}",
}
end
s.subspec 'React' do |core|
# VisionCamera React-specific Swift codebase
core.source_files = [
"ios/React/**/*.swift",
"ios/React/**/*.{h,m}",
]
core.public_header_files = [
"ios/React/CameraBridge.h"
]
core.dependency "React-Core"
if enableFrameProcessors
core.dependency "VisionCamera/FrameProcessors"
end
end
if enableFrameProcessors
s.subspec 'FrameProcessors' do |fp|
# VisionCamera Frame Processors C++ codebase (optional)
fp.source_files = [
"ios/FrameProcessors/**/*.{h,m,mm}"
]
fp.public_header_files = [
# Swift/Objective-C visible headers
"ios/FrameProcessors/Frame.h",
"ios/FrameProcessors/FrameProcessor.h",
"ios/FrameProcessors/FrameProcessorPlugin.h",
"ios/FrameProcessors/FrameProcessorPluginRegistry.h",
"ios/FrameProcessors/SharedArray.h",
"ios/FrameProcessors/VisionCameraProxyDelegate.h",
"ios/FrameProcessors/VisionCameraProxyHolder.h",
"ios/FrameProcessors/VisionCameraInstaller.h",
]
fp.pod_target_xcconfig = {
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
}
fp.dependency "React"
fp.dependency "React-callinvoker"
fp.dependency "react-native-worklets-core"
end
end
end