-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreact-native-doc-scanner.podspec
More file actions
95 lines (86 loc) · 4.73 KB
/
Copy pathreact-native-doc-scanner.podspec
File metadata and controls
95 lines (86 loc) · 4.73 KB
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
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
react_native_pods_script = File.join(
File.dirname(`node --print "require.resolve('react-native/package.json')"`),
"scripts/react_native_pods.rb",
)
require react_native_pods_script
Pod::Spec.new do |s|
s.name = "react-native-doc-scanner"
# CocoaPods derives a Swift module name from `s.name` by underscoring
# hyphens ("react_native_doc_scanner"), but nitro.json's `iosModuleName`
# is "DocScanner" and nitrogen's generated C++ (DocScanner-Swift-Cxx-
# Umbrella.hpp, HybridDocScannerSpecSwift.hpp) hardcodes that exact name
# when looking for the auto-generated Swift-Cxx interop header. Other
# Nitro modules in this workspace (NitroImage, VisionCamera) avoid this by
# naming their *podspec* to already match their Nitro module name; this
# package keeps the conventional hyphenated npm package name instead and
# overrides just the compiled Swift module name to match nitro.json.
s.module_name = "DocScanner"
s.version = package["version"]
s.summary = package["description"]
s.homepage = "https://github.com/your-org/react-native-doc-scanner"
s.license = package["license"]
s.authors = { "Your Org" => "engineering@your-org.com" }
s.platforms = { :ios => "15.0" }
s.source = { :git => "https://github.com/your-org/react-native-doc-scanner.git", :tag => "#{s.version}" }
s.source_files = [
# Implementation (Swift) — HybridDocScanner.swift, ONNXInference.swift,
# ModelPathResolver.swift.
"ios/**/*.{swift}",
# OpenCVBridge's Objective-C header (OpenCVBridge.h) + its Objective-C++
# implementation (OpenCVBridge.mm), plus any autolinking/registration
# glue generated by nitrogen.
"ios/**/*.{h,m,mm}",
# Shared C++ (ONNX/OpenCV glue shared with Android via JNI where applicable).
"cpp/**/*.{hpp,cpp}",
]
s.resources = ["assets/models/*"]
# Without this, CocoaPods classifies OpenCVBridge.h as a PRIVATE header —
# excluded from the auto-generated umbrella header that HybridDocScanner.swift
# / ONNXInference.swift rely on (via -import-underlying-module) to see
# OpenCVBridge/DSQuad/DSTextBox at all. Confirmed by inspecting
# Pods/Headers/Private/react-native-doc-scanner/OpenCVBridge.h after a plain
# `pod install` — it silently lands there unless declared public explicitly.
s.public_header_files = "ios/**/*.h"
s.pod_target_xcconfig = {
"DEFINES_MODULE" => "YES",
"SWIFT_VERSION" => "5.0",
# ONNX Runtime and OpenCV ship non-modular C/C++ headers; both react-native
# and RN's own Podfile post_install already need this flag for similar
# third-party pods, so it's consistent with the rest of the app's build.
"CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES" => "YES",
}
# Generated by `pnpm --filter react-native-doc-scanner run specs` (tsc && nitrogen) —
# must be run at least once before this resolves. Wires up NitroModules,
# React-jsi/callinvoker, and the generated C++ registration files.
load "nitrogen/generated/ios/DocScanner+autolinking.rb"
add_nitrogen_files(s)
# Official Microsoft ONNX Runtime iOS build (Objective-C API) — NOT the
# `onnxruntime-react-native` npm package, which we deliberately bypass (see
# docs/TROUBLESHOOTING.md — its New Architecture support is unverified and
# per-frame inference must run natively anyway, not over the JS bridge).
s.dependency "onnxruntime-objc", "~> 1.19"
# Community OpenCV pod — note the pod is literally named "OpenCV2" (not
# "OpenCV": that name only ever published OpenCV 2.4.x, last in 2018, and
# doesn't provide the OpenCV 4.x C++ API this package's OpenCVBridge.mm
# uses). "OpenCV2" tops out at 4.3.0 (April 2020) on the CocoaPods trunk —
# if it fails to build against your Xcode version, see
# docs/TROUBLESHOOTING.md for the "vendor OpenCV.xcframework directly"
# fallback.
s.dependency "OpenCV2", "~> 4.3.0"
# `analyzeFrame(frame: Frame)` in src/specs/DocScanner.nitro.ts references a
# HybridObject type owned by react-native-vision-camera. The generated
# nitrogen/generated/shared/c++/HybridDocScannerSpec.hpp #includes
# <VisionCamera/HybridFrameSpec.hpp>, and HybridDocScanner.swift does
# `import VisionCamera` — both require this pod's headers/module on the
# search path, which only happens if it's declared as an explicit
# dependency (see docs/TROUBLESHOOTING.md's "Nitro cross-module reference
# to Frame fails to compile" entry). Pod name per
# node_modules/react-native-vision-camera/VisionCamera.podspec — note this
# is NOT the npm package name ("react-native-vision-camera").
s.dependency "VisionCamera"
s.dependency "React-jsi"
s.dependency "React-callinvoker"
install_modules_dependencies(s)
end