-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebmPlayer.podspec
More file actions
107 lines (96 loc) · 4.61 KB
/
WebmPlayer.podspec
File metadata and controls
107 lines (96 loc) · 4.61 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
96
97
98
99
100
101
102
103
104
105
106
107
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = "WebmPlayer"
s.version = package["version"]
s.summary = package["description"]
s.homepage = package["homepage"]
s.license = package["license"]
s.authors = package["author"]
s.platforms = { :ios => "15.1" }
s.source = { :git => "https://github.com/heart-IT/react-native-webm-player.git", :tag => "#{s.version}" }
# Build vendored XCFrameworks from source during pod install (parity with Android CMake FetchContent).
# Requires: Xcode CLI tools, cmake (for whisper). Runs once per pod install/update.
s.prepare_command = <<-SCRIPT
set -e
if [ ! -f ios/opus/lib/opus.xcframework/Info.plist ]; then
echo "[WebmPlayer] Building Opus 1.6.1 XCFramework from source..."
bash ios/opus/build-opus.sh build
fi
if [ ! -f ios/whisper/lib/whisper.xcframework/Info.plist ]; then
echo "[WebmPlayer] Building whisper.cpp v1.8.4 XCFramework from source..."
bash ios/whisper/build-whisper.sh build
fi
SCRIPT
# iOS-specific sources (Objective-C++)
# libwebm mkvparser sources vendored under cpp/third_party/libwebm/
# SpeexDSP resampler sources vendored under cpp/third_party/speexdsp/
s.source_files = [
"ios/**/*.{h,m,mm,cpp}",
"cpp/**/*.{h,hpp,cpp}",
"cpp/third_party/libwebm/mkvparser/*.{cc,h}",
"cpp/third_party/libwebm/common/*.h",
"cpp/third_party/speexdsp/libspeexdsp/resample.c",
"cpp/third_party/speexdsp/libspeexdsp/*.h",
"cpp/third_party/speexdsp/include/speex/*.h"
]
# Exclude build artifacts and build scripts
s.exclude_files = [
"ios/opus/build/**/*",
"ios/opus/build-opus.sh",
"ios/whisper/build/**/*",
"ios/whisper/build-whisper.sh",
"ios/whisper/models/**/*"
]
s.private_header_files = [
"ios/**/*.h",
"cpp/**/*.h",
"cpp/**/*.hpp",
"cpp/third_party/libwebm/**/*.h",
"cpp/third_party/speexdsp/**/*.h"
]
# Required frameworks for audio, video, SIMD, and Metal (whisper.cpp GPU inference)
s.frameworks = ["AVFoundation", "AudioToolbox", "VideoToolbox", "CoreMedia", "Accelerate", "UIKit", "Metal"]
# Vendored Opus 1.6.1 XCFramework + whisper.cpp XCFramework
s.vendored_frameworks = ["ios/opus/lib/opus.xcframework", "ios/whisper/lib/whisper.xcframework"]
# Header search paths for cross-platform code and vendored Opus
s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => [
'$(PODS_TARGET_SRCROOT)/cpp',
'$(PODS_TARGET_SRCROOT)/cpp/common',
'$(PODS_TARGET_SRCROOT)/cpp/playback',
'$(PODS_TARGET_SRCROOT)/cpp/video',
'$(PODS_TARGET_SRCROOT)/cpp/demux',
'$(PODS_TARGET_SRCROOT)/cpp/third_party/libwebm',
'$(PODS_TARGET_SRCROOT)/cpp/third_party/speexdsp/include',
'$(PODS_TARGET_SRCROOT)/cpp/third_party/speexdsp/libspeexdsp',
'$(PODS_TARGET_SRCROOT)/ios',
'$(PODS_TARGET_SRCROOT)/ios/playback',
'$(PODS_TARGET_SRCROOT)/ios/video',
'$(PODS_TARGET_SRCROOT)/ios/opus/lib/include',
'$(PODS_TARGET_SRCROOT)/ios/opus/lib/include/opus',
'$(PODS_TARGET_SRCROOT)/ios/whisper/lib/include',
'$(PODS_TARGET_SRCROOT)/cpp/transcript'
].join(' '),
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) HAVE_OPUS=1 HAVE_WHISPER=1 FLOATING_POINT=1 EXPORT=',
# USE_NEON only on ARM — x86_64 simulator has no NEON registers
'OTHER_CFLAGS[arch=arm64]' => '-DUSE_NEON=1 -fstack-protector-strong',
# Hide internal symbols to prevent clashes with host app
'GCC_SYMBOLS_PRIVATE_EXTERN' => 'YES',
'GCC_INLINES_ARE_PRIVATE_EXTERN' => 'YES',
# Warning flags for parity with Android CMake -Wall -Wextra -Werror=...
'WARNING_CFLAGS' => '-Wall -Wextra -Wconversion -Wshadow -Wno-unused-parameter -Werror=return-type -Werror=non-virtual-dtor -Werror=uninitialized -Werror=format-security -Werror=implicit-fallthrough',
# Stack buffer overflow detection (parity with Android -fstack-protector-strong)
'OTHER_CFLAGS' => '-fstack-protector-strong',
# Compile-time + runtime buffer overflow detection for stdlib functions
'GCC_PREPROCESSOR_DEFINITIONS[config=Release]' => '$(inherited) _FORTIFY_SOURCE=2',
# ThinLTO for release builds (parity with Android CMake config)
'LLVM_LTO[config=Release]' => 'YES_THIN',
# -O3 + -funroll-loops to match Android CMake. Xcode default Release is -Os,
# which under-vectorizes the NEON inner loops in AudioMixer + AudioLevelMeter.
'GCC_OPTIMIZATION_LEVEL[config=Release]' => '3',
'OTHER_CFLAGS[config=Release]' => '$(inherited) -funroll-loops'
}
install_modules_dependencies(s)
end