Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ bld/
# Visual Studio 2015/2017 cache/options directory
.vs/

# VS Code
.vscode/

# Autogenerated VS solution and project files
*.csproj
*.sln
Expand Down Expand Up @@ -384,6 +387,5 @@ Runtime/Plugins/x86_64/*.lib.meta
Runtime/Plugins/x86_64/*.ilk.meta
Runtime/Plugins/x86_64/*.pdb.meta




# ignore mac system file
**/.DS_Store
70 changes: 34 additions & 36 deletions BuildScripts~/build_libwebrtc_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ then
fi

export COMMAND_DIR=$(cd $(dirname $0); pwd)
export PATH="$(pwd)/depot_tools:$PATH"
export WEBRTC_VERSION=5845
export PATH="$(pwd)/depot_tools:$(pwd)/depot_tools/python-bin:$PATH"
export WEBRTC_VERSION=6367
export OUTPUT_DIR="$(pwd)/out"
export ARTIFACTS_DIR="$(pwd)/artifacts"
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
Expand All @@ -23,25 +23,20 @@ then
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
cd ..
gclient sync -D --force --reset
else
# fetch and init config on only first time
cd src
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
cd ..
gclient sync -D --force --reset
fi

# Add jsoncpp
patch -N "src/BUILD.gn" < "$COMMAND_DIR/patches/add_jsoncpp.patch"

# Add visibility libunwind
patch -N "src/buildtools/third_party/libunwind/BUILD.gn" < "$COMMAND_DIR/patches/add_visibility_libunwind.patch"

# Add deps libunwind
patch -N "src/build/config/BUILD.gn" < "$COMMAND_DIR/patches/add_deps_libunwind.patch"

# Add -mno-outline-atomics flag
patch -N "src/build/config/compiler/BUILD.gn" < "$COMMAND_DIR/patches/add_nooutlineatomics_flag.patch"

# downgrade to JDK8 because Unity supports OpenJDK version 1.8.
# https://docs.unity3d.com/Manual/android-sdksetup.html
patch -N "src/build/android/gyp/compile_java.py" < "$COMMAND_DIR/patches/downgradeJDKto8_compile_java.patch"
patch -N "src/build/android/gyp/turbine.py" < "$COMMAND_DIR/patches/downgradeJDKto8_turbine.patch"

# Fix SetRawImagePlanes() in LibvpxVp8Encoder
patch -N "src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc" < "$COMMAND_DIR/patches/libvpx_vp8_encoder.patch"

Expand All @@ -54,81 +49,84 @@ popd

mkdir -p "$ARTIFACTS_DIR/lib"

outputDir=""

for target_cpu in "arm64" "x64"
do
mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}"

for is_debug in "true" "false"
do
outputDir="${OUTPUT_DIR}_${is_debug}_${target_cpu}"
# generate ninja files
# use `treat_warnings_as_errors` option to avoid deprecation warnings
gn gen "$OUTPUT_DIR" --root="src" \
--args="is_debug=${is_debug} \
gn gen "$outputDir" --root="src" \
--args=" \
exclude_unwind_tables=true \
is_component_build=false \
is_debug=${is_debug} \
is_java_debug=${is_debug} \
target_os=\"android\" \
target_cpu=\"${target_cpu}\" \
rtc_use_h264=false \
rtc_include_tests=false \
rtc_build_examples=false \
is_component_build=false \
use_rtti=true \
use_custom_libcxx=false \
rtc_build_tools=false \
target_os=\"android\" \
target_cpu=\"${target_cpu}\" \
treat_warnings_as_errors=false \
use_errorprone_java_compiler=false \
use_cxx17=true"
use_rtti=true \
use_errorprone_java_compiler=false"

# build static library
ninja -C "$OUTPUT_DIR" webrtc
ninja -C "$outputDir" webrtc

filename="libwebrtc.a"
if [ $is_debug = "true" ]; then
filename="libwebrtcd.a"
fi

# copy static library
cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}"
cp "$outputDir/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}"
done
done

pushd src

for is_debug in "true" "false"
do
aarOutputDir="${OUTPUT_DIR}_${is_debug}_aar"
# use `treat_warnings_as_errors` option to avoid deprecation warnings
"$PYTHON3_BIN" tools_webrtc/android/build_aar.py \
--build-dir $OUTPUT_DIR \
--output $OUTPUT_DIR/libwebrtc.aar \
--build-dir $aarOutputDir \
--output $aarOutputDir/libwebrtc.aar \
--arch arm64-v8a x86_64 \
--extra-gn-args "is_debug=${is_debug} \
--extra-gn-args " \
is_debug=${is_debug} \
is_java_debug=${is_debug} \
is_component_build=false \
rtc_use_h264=false \
rtc_include_tests=false \
rtc_build_examples=false \
is_component_build=false \
use_rtti=true \
use_custom_libcxx=false \
rtc_build_tools=false \
treat_warnings_as_errors=false \
use_errorprone_java_compiler=false \
use_cxx17=true"
use_rtti=true \
use_errorprone_java_compiler=false"

filename="libwebrtc.aar"
if [ $is_debug = "true" ]; then
filename="libwebrtc-debug.aar"
fi
# copy aar
cp "$OUTPUT_DIR/libwebrtc.aar" "$ARTIFACTS_DIR/lib/${filename}"
cp "$aarOutputDir/libwebrtc.aar" "$ARTIFACTS_DIR/lib/${filename}"
done

popd

"$PYTHON3_BIN" "./src/tools_webrtc/libs/generate_licenses.py" \
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
--target :webrtc "$outputDir" "$outputDir"

cd src
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"

cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
cp "$outputDir/LICENSE.md" "$ARTIFACTS_DIR"

# create zip
cd "$ARTIFACTS_DIR"
Expand Down
42 changes: 25 additions & 17 deletions BuildScripts~/build_libwebrtc_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ then
fi

export COMMAND_DIR=$(cd $(dirname $0); pwd)
export PATH="$(pwd)/depot_tools:$PATH"
export WEBRTC_VERSION=5845
export PATH="$(pwd)/depot_tools:$(pwd)/depot_tools/python-bin:$PATH"
export WEBRTC_VERSION=6367
export OUTPUT_DIR="$(pwd)/out"
export ARTIFACTS_DIR="$(pwd)/artifacts"
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
Expand All @@ -21,55 +21,63 @@ then
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
cd ..
gclient sync -D --force --reset
else
# fetch and init config on only first time
cd src
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
cd ..
gclient sync -D --force --reset
fi

# add jsoncpp
patch -N "src/BUILD.gn" < "$COMMAND_DIR/patches/add_jsoncpp.patch"

# disable GCD taskqueue, use stdlib taskqueue instead
# This is because GCD cannot measure with UnityProfiler
patch -N "src/api/task_queue/BUILD.gn" < "$COMMAND_DIR/patches/disable_task_queue_gcd.patch"
# patch -N "src/api/task_queue/BUILD.gn" < "$COMMAND_DIR/patches/disable_task_queue_gcd.patch"

# add objc library to use videotoolbox
patch -N "src/sdk/BUILD.gn" < "$COMMAND_DIR/patches/add_objc_deps.patch"

# Fix SetRawImagePlanes() in LibvpxVp8Encoder
patch -N "src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc" < "$COMMAND_DIR/patches/libvpx_vp8_encoder.patch"

# use included python
export PATH="$(pwd)/depot_tools/bootstrap-3.8.0.chromium.8_bin/python/bin:$PATH"

mkdir -p "$ARTIFACTS_DIR/lib"

outputDir=""

for is_debug in "true" "false"
do
for target_cpu in "arm64" "x64"
do
outputDir="${OUTPUT_DIR}_${is_debug}_${target_cpu}"
# generate ninja files
#
# note: `treat_warnings_as_errors=false` is for avoiding LLVM warning.
# https://reviews.llvm.org/D72212
# See below for details.
# https://bugs.chromium.org/p/webrtc/issues/detail?id=11729
#
gn gen "$OUTPUT_DIR" --root="src" \
--args="is_debug=${is_debug} \
gn gen "$outputDir" --root="src" \
--args=" \
is_debug=${is_debug} \
is_component_build=false \
ios_enable_code_signing=false \
target_os=\"ios\" \
target_cpu=\"${target_cpu}\" \
rtc_use_h264=false \
use_custom_libcxx=false \
treat_warnings_as_errors=false \
ios_enable_code_signing=false \
rtc_use_h264=false \
rtc_include_tests=false \
rtc_build_examples=false \
use_cxx17=true"

rtc_build_tools=false \
use_custom_libcxx=false"

# build static library
ninja -C "$OUTPUT_DIR" webrtc
ninja -C "$outputDir" webrtc

# copy static library
mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}"
cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/"
cp "$outputDir/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/"
done

filename="libwebrtc.a"
Expand All @@ -88,12 +96,12 @@ do
done

"$PYTHON3_BIN" "./src/tools_webrtc/libs/generate_licenses.py" \
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
--target :webrtc "$outputDir" "$outputDir"

cd src
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"

cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
cp "$outputDir/LICENSE.md" "$ARTIFACTS_DIR"

# create zip
cd "$ARTIFACTS_DIR"
Expand Down
45 changes: 28 additions & 17 deletions BuildScripts~/build_libwebrtc_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ then
fi

export COMMAND_DIR=$(cd $(dirname $0); pwd)
export PATH="$(pwd)/depot_tools:$PATH"
export WEBRTC_VERSION=5845
export PATH="$(pwd)/depot_tools:$(pwd)/depot_tools/python-bin:$PATH"
export WEBRTC_VERSION=6367
export OUTPUT_DIR="$(pwd)/out"
export ARTIFACTS_DIR="$(pwd)/artifacts"
export PYTHON3_BIN="$(pwd)/depot_tools/python-bin/python3"
Expand All @@ -21,6 +21,12 @@ then
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
cd ..
gclient sync -D --force --reset
else
# fetch and init config on only first time
cd src
git checkout "refs/remotes/branch-heads/$WEBRTC_VERSION"
cd ..
gclient sync -D --force --reset
fi

# add jsoncpp
Expand All @@ -31,52 +37,57 @@ patch -N "src/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc" < "$COMMAND

mkdir -p "$ARTIFACTS_DIR/lib"

outputDir=""

for target_cpu in "x64"
do
mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}"
for is_debug in "true" "false"
do
args="is_debug=${is_debug} \
target_os=\"linux\" \
target_cpu=\"${target_cpu}\" \
use_custom_libcxx=false \
outputDir="${OUTPUT_DIR}_${is_debug}_${target_cpu}"
# use_custom_libcxx=false is failed because install sysroot does not supoort c++11
args=" \
enable_iterator_debugging=false \
is_component_build=false \
is_debug=${is_debug} \
rtc_include_tests=false \
rtc_build_examples=false \
rtc_build_tools=false \
rtc_use_h264=false \
symbol_level=0 \
enable_iterator_debugging=false \
is_component_build=false \
use_rtti=true \
rtc_use_x11=false \
use_cxx17=true"
symbol_level=0 \
target_os=\"linux\" \
target_cpu=\"${target_cpu}\" \
use_custom_libcxx=true \
use_rtti=true"

if [ $is_debug = "true" ]; then
args="${args} is_asan=true is_lsan=true";
fi

# generate ninja files
gn gen "$OUTPUT_DIR" --root="src" --args="${args}"
gn gen "$outputDir" --root="src" --args="${args}"

# build static library
ninja -C "$OUTPUT_DIR" webrtc
ninja -C "$outputDir" webrtc

filename="libwebrtc.a"
if [ $is_debug = "true" ]; then
filename="libwebrtcd.a"
fi

# cppy static library
cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}"
cp "$outputDir/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}"
done
done

"$PYTHON3_BIN" "./src/tools_webrtc/libs/generate_licenses.py" \
--target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR"
$PYTHON3_BIN "./src/tools_webrtc/libs/generate_licenses.py" \
--target :webrtc "$outputDir" "$outputDir"

cd src
find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include"

cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR"
cp "$outputDir/LICENSE.md" "$ARTIFACTS_DIR"

# create zip
cd "$ARTIFACTS_DIR"
Expand Down
Loading