Skip to content

Commit 6fa2ab3

Browse files
committed
support compile soundtouch and uavs3d for android, extract common cmake build shell
1 parent 94b99f5 commit 6fa2ab3

File tree

11 files changed

+180
-250
lines changed

11 files changed

+180
-250
lines changed

configs/libs/soundtouch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
export LIB_NAME='soundtouch'
2626
export LIPO_LIBS="libsoundtouch"
27-
export LIB_DEPENDS_BIN="automake autoconf libtool"
27+
export LIB_DEPENDS_BIN="cmake"
28+
export CMAKE_TARGET_NAME=SoundTouch
2829
export GIT_LOCAL_REPO=extra/soundtouch
2930
export REPO_DIR=soundtouch
3031
export GIT_COMMIT=2.3.3

configs/libs/uavs3d.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
export LIB_NAME='uavs3d'
2424
export LIPO_LIBS="libuavs3d"
2525
export LIB_DEPENDS_BIN="cmake"
26+
export CMAKE_TARGET_NAME=uavs3d
2627
export GIT_LOCAL_REPO=extra/uavs3d
2728
export GIT_COMMIT=1fd0491
2829
export REPO_DIR=uavs3d

configs/libs/yuv.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
export LIB_NAME='yuv'
2121
export LIPO_LIBS="libyuv"
2222
export LIB_DEPENDS_BIN="cmake"
23+
export CMAKE_TARGET_NAME=yuv
2324
export GIT_LOCAL_REPO=extra/yuv
2425
export GIT_COMMIT=eb6e7bb
2526
export REPO_DIR=yuv
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# https://stackoverflow.com/questions/6003374/what-is-cmake-equivalent-of-configure-prefix-dir-make-all-install
18+
# https://cmake.org/cmake/help/v3.28/variable/CMAKE_OSX_SYSROOT.html
19+
# https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#switching-between-device-and-simulator
20+
# https://stackoverflow.com/questions/27660048/cmake-check-if-mac-os-x-use-apple-or-apple
21+
22+
23+
set -e
24+
25+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
26+
cd "$THIS_DIR"
27+
CMAKE_OTHER_FLAGS="$1"
28+
29+
echo "----------------------"
30+
echo "[*] configurate $LIB_NAME"
31+
echo "[*] other cmake flags: $CMAKE_OTHER_FLAGS"
32+
echo "----------------------"
33+
34+
build="${MR_BUILD_SOURCE}/camke_wksp"
35+
36+
rm -rf "$build"
37+
mkdir -p "$build"
38+
cd "$build"
39+
40+
cmake -S ${MR_BUILD_SOURCE} \
41+
-DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \
42+
-DANDROID_NDK=${MR_ANDROID_NDK_HOME} \
43+
-DANDROID_ABI=${MR_ANDROID_ABI} \
44+
-DANDROID_PLATFORM=android-${MR_ANDROID_API} \
45+
-DANDROID_STL=c++_shared \
46+
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${MR_BUILD_PREFIX}/libs/${MR_ANDROID_ABI} \
47+
-DCMAKE_TOOLCHAIN_FILE=${MR_ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
48+
${CMAKE_OTHER_FLAGS}
49+
50+
echo "----------------------"
51+
echo "[*] compile $LIB_NAME"
52+
echo "----------------------"
53+
54+
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
55+
cmake --install .

do-compile/android/soundtouch.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DSOUNDSTRETCH=0"

do-compile/android/uavs3d.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DCOMPILE_10BIT=1 -DBUILD_SHARED_LIBS=0"

do-compile/android/yuv.sh

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,8 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
#
17-
# https://stackoverflow.com/questions/6003374/what-is-cmake-equivalent-of-configure-prefix-dir-make-all-install
18-
# https://cmake.org/cmake/help/v3.28/variable/CMAKE_OSX_SYSROOT.html
19-
# https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#switching-between-device-and-simulator
20-
# https://stackoverflow.com/questions/27660048/cmake-check-if-mac-os-x-use-apple-or-apple
21-
# https://stackoverflow.com/questions/49711514/building-c-projects-which-have-cmake-build-files-for-android-using-ndk
22-
23-
set -e
24-
25-
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
26-
cd "$THIS_DIR"
27-
28-
echo "----------------------"
29-
echo "[*] configurate $LIB_NAME"
30-
echo "----------------------"
31-
32-
build="${MR_BUILD_SOURCE}/_tmp"
33-
34-
rm -rf "$build"
35-
mkdir -p "$build"
36-
cd "$build"
3716

38-
cmake -S ${MR_BUILD_SOURCE} \
39-
-DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \
40-
-DCMAKE_TOOLCHAIN_FILE=${MR_ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
41-
-DANDROID_NDK=${MR_ANDROID_NDK_HOME} \
42-
-DANDROID_ABI=${MR_ANDROID_ABI} \
43-
-DANDROID_PLATFORM=android-${MR_ANDROID_API} \
44-
-DANDROID_STL=c++_shared \
45-
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${LIB1_DIRECTORY}/libs/${MR_ANDROID_ABI}
17+
# call common cmake build shell
18+
./cmake-compatible.sh
4619

47-
echo "----------------------"
48-
echo "[*] compile $LIB_NAME"
49-
echo "----------------------"
5020

51-
cmake --build . --target $LIB_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
52-
cmake --install .
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#! /usr/bin/env bash
2+
#
3+
# Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>
4+
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# https://stackoverflow.com/questions/6003374/what-is-cmake-equivalent-of-configure-prefix-dir-make-all-install
18+
# https://cmake.org/cmake/help/v3.28/variable/CMAKE_OSX_SYSROOT.html
19+
# https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#switching-between-device-and-simulator
20+
# https://stackoverflow.com/questions/27660048/cmake-check-if-mac-os-x-use-apple-or-apple
21+
22+
23+
set -e
24+
25+
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
26+
cd "$THIS_DIR"
27+
CMAKE_OTHER_FLAGS="$1"
28+
29+
echo "----------------------"
30+
echo "[*] configurate $LIB_NAME"
31+
echo "[*] other cmake flags: $CMAKE_OTHER_FLAGS"
32+
echo "----------------------"
33+
34+
build="${MR_BUILD_SOURCE}/camke_wksp"
35+
36+
rm -rf "$build"
37+
mkdir -p "$build"
38+
cd "$build"
39+
40+
pf=
41+
if [[ "$MR_PLAT" == 'ios' ]];then
42+
if [[ $_MR_ARCH == 'arm64_simulator' ]];then
43+
pf='SIMULATORARM64'
44+
elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then
45+
pf='SIMULATOR64'
46+
else
47+
pf='OS64'
48+
fi
49+
elif [[ "$MR_PLAT" == 'tvos' ]];then
50+
if [[ $_MR_ARCH == 'arm64_simulator' ]];then
51+
pf='SIMULATORARM64_TVOS'
52+
elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then
53+
pf='SIMULATOR_TVOS'
54+
else
55+
pf='TVOS'
56+
fi
57+
elif [[ "$MR_PLAT" == 'macos' ]];then
58+
if [[ $_MR_ARCH == 'arm64' ]];then
59+
pf='MAC_ARM64'
60+
elif [[ $_MR_ARCH == 'x86_64' ]];then
61+
pf='MAC'
62+
fi
63+
fi
64+
65+
cmake -S ${MR_BUILD_SOURCE} \
66+
-DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \
67+
-DCMAKE_TOOLCHAIN_FILE="${MR_SHELL_TOOLS_DIR}/ios.toolchain.cmake" \
68+
-DPLATFORM=$pf \
69+
${CMAKE_OTHER_FLAGS} \
70+
-GXcode
71+
72+
echo "----------------------"
73+
echo "[*] compile $LIB_NAME"
74+
echo "----------------------"
75+
76+
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
77+
cmake --install .

do-compile/apple/soundtouch.sh

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -13,76 +13,6 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16-
#
17-
# https://stackoverflow.com/questions/6003374/what-is-cmake-equivalent-of-configure-prefix-dir-make-all-install
18-
# https://cmake.org/cmake/help/v3.28/variable/CMAKE_OSX_SYSROOT.html
19-
# https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html#switching-between-device-and-simulator
20-
# https://stackoverflow.com/questions/27660048/cmake-check-if-mac-os-x-use-apple-or-apple
21-
22-
set -e
23-
24-
THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
25-
cd "$THIS_DIR"
26-
27-
echo "=== [$0] check env begin==="
28-
env_assert "MR_ARCH"
29-
env_assert "_MR_ARCH"
30-
env_assert "MR_BUILD_NAME"
31-
env_assert "MR_CC"
32-
env_assert "MR_BUILD_SOURCE"
33-
env_assert "MR_BUILD_PREFIX"
34-
env_assert "MR_SYS_ROOT"
35-
env_assert "MR_HOST_NPROC"
36-
env_assert "MR_PLAT"
37-
echo "MR_DEBUG:$MR_DEBUG"
38-
echo "===check env end==="
39-
40-
41-
toolchain=$MR_SHELL_TOOLS_DIR/ios.toolchain.cmake
42-
43-
echo "----------------------"
44-
echo "[*] configurate $LIB_NAME"
45-
echo "[*] cmake config $cfg"
46-
echo "[*] cmake toolchain $toolchain"
47-
echo "----------------------"
48-
49-
build="${MR_BUILD_SOURCE}/_tmp"
50-
51-
rm -rf "$build"
52-
mkdir -p "$build"
53-
54-
cd "$build"
55-
56-
pf=
57-
if [[ "$MR_PLAT" == 'ios' ]];then
58-
if [[ $_MR_ARCH == 'arm64_simulator' ]];then
59-
pf='SIMULATORARM64'
60-
elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then
61-
pf='SIMULATOR64'
62-
else
63-
pf='OS64'
64-
fi
65-
elif [[ "$MR_PLAT" == 'tvos' ]];then
66-
if [[ $_MR_ARCH == 'arm64_simulator' ]];then
67-
pf='SIMULATORARM64_TVOS'
68-
elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then
69-
pf='SIMULATOR_TVOS'
70-
else
71-
pf='TVOS'
72-
fi
73-
elif [[ "$MR_PLAT" == 'macos' ]];then
74-
if [[ $_MR_ARCH == 'arm64' ]];then
75-
pf='MAC_ARM64'
76-
elif [[ $_MR_ARCH == 'x86_64' ]];then
77-
pf='MAC'
78-
fi
79-
fi
80-
81-
cmake -S ${MR_BUILD_SOURCE} -DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} -GXcode -DCMAKE_TOOLCHAIN_FILE=$toolchain -DPLATFORM=$pf -DSOUNDSTRETCH=0
82-
83-
echo "----------------------"
84-
echo "[*] compile $LIB_NAME"
85-
echo "----------------------"
8616

87-
cmake --build . --target SoundTouch --config Release -- CODE_SIGNING_ALLOWED=NO
88-
cmake --install .
17+
# call common cmake build shell
18+
./cmake-compatible.sh "-DSOUNDSTRETCH=0"

0 commit comments

Comments
 (0)