Skip to content

Commit

Permalink
1.Split third_party CMakeLists.txt to three part to solve ExternalPro…
Browse files Browse the repository at this point in the history
…ject_Add build sequence problem. 2.Fix curdir issue.
  • Loading branch information
ausmuschang-google committed Apr 16, 2020
1 parent f95e19b commit d06ae83
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 56 deletions.
55 changes: 0 additions & 55 deletions app/third_party/CMakeLists.txt

This file was deleted.

18 changes: 18 additions & 0 deletions app/third_party/CMakeLists_libogg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.4.1)
include(ExternalProject)

set(libogg_src ${CMAKE_CURRENT_SOURCE_DIR}/libogg/src)
ExternalProject_Add(external_libogg
GIT_REPOSITORY "https://github.com/xiph/ogg.git"
GIT_TAG "934385378f45f11586b03b6214bf5f363649f3b6"
SOURCE_DIR "${libogg_src}"
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${libogg_src}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_ABI=${ANDROID_ABI}
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/build/libogg/${ANDROID_ABI}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
&&
${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/build/libogg/${ANDROID_ABI}/lib/libogg.a
${CMAKE_CURRENT_SOURCE_DIR}/libogg/lib/${ANDROID_ABI}/
)
18 changes: 18 additions & 0 deletions app/third_party/CMakeLists_libopus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.4.1)
include(ExternalProject)

set(libopus_src ${CMAKE_CURRENT_SOURCE_DIR}/libopus/src)
ExternalProject_Add(external_libopus
GIT_REPOSITORY "https://github.com/xiph/opus"
GIT_TAG "ad8fe90db79b7d2a135e3dfd2ed6631b0c5662ab"
SOURCE_DIR "${libopus_src}"
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${libopus_src}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_ABI=${ANDROID_ABI}
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/build/libopus/${ANDROID_ABI}
INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
&&
${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/build/libopus/${ANDROID_ABI}/lib/libopus.a
${CMAKE_CURRENT_SOURCE_DIR}/libopus/lib/${ANDROID_ABI}/
)
23 changes: 23 additions & 0 deletions app/third_party/CMakeLists_opus-tools.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.4.1)
include(ExternalProject)

set(opus_tools_src ${CMAKE_CURRENT_SOURCE_DIR}/opus_tools/src)
ExternalProject_Add(external_opus_tools
GIT_REPOSITORY "https://github.com/xiph/opus-tools/"
GIT_TAG "14f650f64260115098d55fb91e1f83110cb628d3"
SOURCE_DIR "${opus_tools_src}"
CONFIGURE_COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/build/include_files_helper.sh ${CMAKE_CURRENT_SOURCE_DIR}/build/
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/build/libogg/${ANDROID_ABI}/include/ogg/config_types.h
${CMAKE_CURRENT_SOURCE_DIR}/../src/main/cpp/libogg/
COMMAND ${CMAKE_COMMAND} ${opus_tools_src}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_ABI=${ANDROID_ABI}
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/build/opus_tools/${ANDROID_ABI}
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/build/opus_tools/${ANDROID_ABI}/lib/
INSTALL_COMMAND ""
COMMAND
${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/build/opus_tools/${ANDROID_ABI}/lib/libopus_header.a
${CMAKE_CURRENT_SOURCE_DIR}/opus_tools/lib/${ANDROID_ABI}/
)
12 changes: 12 additions & 0 deletions app/third_party/build/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,21 @@ do
if [ ! -d ../out ]; then
mkdir ../out
fi
cp ../CMakeLists_libogg.txt ../CMakeLists.txt
cd ../out
cmake -DCMAKE_TOOLCHAIN_FILE="${NDK_PATH}"/build/cmake/android.toolchain.cmake -DANDROID_ABI=${android_abi[$i]} ..
make
echo "Ogg for ${android_abi[$i]} build done."
cp ../CMakeLists_libopus.txt ../CMakeLists.txt
cd ../out
cmake -DCMAKE_TOOLCHAIN_FILE="${NDK_PATH}"/build/cmake/android.toolchain.cmake -DANDROID_ABI=${android_abi[$i]} ..
make
echo "Opus for ${android_abi[$i]} build done."
cp ../CMakeLists_opus-tools.txt ../CMakeLists.txt
cd ../out
cmake -DCMAKE_TOOLCHAIN_FILE="${NDK_PATH}"/build/cmake/android.toolchain.cmake -DANDROID_ABI=${android_abi[$i]} ..
make
echo "Opus-tools for ${android_abi[$i]} build done."
cd ../build
rm -rf ../out
done
3 changes: 2 additions & 1 deletion app/third_party/build/include_files_helper.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
# To get the third party deps to build, we do some string replacement in the
# headers. In principle, this should be done with include paths, but since
# users of our tool probably have their own means of managing dependencies,
# this is good enough for our purposes.
curdir=$1
curdir=$(dirname "$0")/
echo "current dir is $curdir"
if [ ! -d ${curdir}../../src/main/cpp/libogg ]; then
mkdir ${curdir}../../src/main/cpp/libogg
Expand Down

0 comments on commit d06ae83

Please sign in to comment.