initial commit

This commit is contained in:
Caleb
2026-03-01 15:59:27 +08:00
commit a9e97d56cb
1426 changed files with 172367 additions and 0 deletions

90
build_webrtc.sh Executable file
View File

@@ -0,0 +1,90 @@
#!/bin/bash
# WebRTC 编译并复制脚本
# 使用 gn + ninja 直接编译 webrtc target 生成 libwebrtc.a
set -e # 遇到错误立即退出
# 路径配置
WEBRTC_SRC="/Users/huiran/project/webrtc_depneds/src"
BUILD_DIR="${WEBRTC_SRC}/out/ios_arm64"
TARGET_DIR="/Users/huiran/project/SellySdk/SellyCloudSDK/sdk/libwebrtc"
echo "=========================================="
echo "WebRTC iOS 编译脚本"
echo "=========================================="
# 添加 depot_tools 到 PATH
export PATH="${WEBRTC_SRC}/third_party/depot_tools:$PATH"
# 检查源码目录是否存在
if [ ! -d "$WEBRTC_SRC" ]; then
echo "❌ 错误: WebRTC 源码目录不存在: $WEBRTC_SRC"
exit 1
fi
# 进入 WebRTC 源码目录
cd "$WEBRTC_SRC"
echo "📂 进入目录: $WEBRTC_SRC"
# 检查 args.gn 是否存在,如果不存在则创建
if [ ! -f "${BUILD_DIR}/args.gn" ]; then
echo "📝 创建 args.gn 配置文件..."
mkdir -p "$BUILD_DIR"
cat > "${BUILD_DIR}/args.gn" << 'EOF'
target_os = "ios"
target_cpu = "arm64"
target_environment = "device"
ios_enable_code_signing = false
is_component_build = false
is_debug = false
enable_dsyms = true
rtc_include_tests = false
rtc_build_examples = false
use_rtti = true
treat_warnings_as_errors = false
rtc_enable_objc_symbol_export = true
use_custom_libcxx = false
rtc_use_h264 = true
rtc_use_h265 = true
rtc_include_internal_audio_device = true
rtc_enable_protobuf = false
use_thin_archives = false
EOF
fi
# 生成 ninja 文件
echo "🔧 生成 ninja 文件..."
./buildtools/mac/gn gen "$BUILD_DIR"
# 编译 webrtc target
echo "🔨 开始编译 webrtc target..."
ninja -C "$BUILD_DIR" webrtc
# 检查编译结果
OUTPUT_LIB="${BUILD_DIR}/obj/libwebrtc.a"
if [ ! -f "$OUTPUT_LIB" ]; then
echo "❌ 错误: 编译失败libwebrtc.a 不存在"
exit 1
fi
LIB_SIZE=$(ls -lh "$OUTPUT_LIB" | awk '{print $5}')
echo "✅ 编译成功! 文件大小: $LIB_SIZE"
# 复制新文件(覆盖旧文件)
echo "📋 复制到目标目录: $TARGET_DIR"
cp "$OUTPUT_LIB" "$TARGET_DIR/libwebrtc.a"
# 验证复制
if [ -f "${TARGET_DIR}/libwebrtc.a" ]; then
NEW_SIZE=$(ls -lh "${TARGET_DIR}/libwebrtc.a" | awk '{print $5}')
echo "✅ 复制成功! 新文件大小: $NEW_SIZE"
else
echo "❌ 错误: 复制失败"
exit 1
fi
echo ""
echo "=========================================="
echo "✅ 编译完成!"
echo "=========================================="