Skip to content

Commit e8d69e6

Browse files
committed
cmake compatible support multiple targets
1 parent 9bb1f4b commit e8d69e6

7 files changed

Lines changed: 37 additions & 9 deletions

File tree

configs/libs/opus.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
export LIB_NAME='opus'
2626
export LIPO_LIBS="libopus"
2727
export LIB_DEPENDS_BIN="cmake"
28-
export CMAKE_TARGET_NAME=opus
28+
export CMAKE_TARGETS_NAME=opus
2929
export GIT_LOCAL_REPO=extra/opus
3030
export GIT_COMMIT=v1.5.2
3131
export REPO_DIR=opus

configs/libs/smb2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
export LIB_NAME='smb2'
2626
export LIPO_LIBS="libsmb2"
2727
export LIB_DEPENDS_BIN="cmake"
28-
export CMAKE_TARGET_NAME=smb2
28+
export CMAKE_TARGETS_NAME=smb2
2929
export GIT_LOCAL_REPO=extra/smb2
3030
export GIT_COMMIT=libsmb2-6.2
3131
export REPO_DIR=smb2

configs/libs/soundtouch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
export LIB_NAME='soundtouch'
2626
export LIPO_LIBS="libsoundtouch"
2727
export LIB_DEPENDS_BIN="cmake"
28-
export CMAKE_TARGET_NAME=SoundTouch
28+
export CMAKE_TARGETS_NAME=SoundTouch
2929
export GIT_LOCAL_REPO=extra/soundtouch
3030
export REPO_DIR=soundtouch
3131
export GIT_COMMIT=2.3.3

configs/libs/uavs3d.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
export LIB_NAME='uavs3d'
2424
export LIPO_LIBS="libuavs3d"
2525
export LIB_DEPENDS_BIN="cmake"
26-
export CMAKE_TARGET_NAME=uavs3d
26+
export CMAKE_TARGETS_NAME=uavs3d
2727
export GIT_LOCAL_REPO=extra/uavs3d
2828
export GIT_COMMIT=1fd0491
2929
export REPO_DIR=uavs3d

configs/libs/yuv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
export LIB_NAME='yuv'
2121
export LIPO_LIBS="libyuv"
2222
export LIB_DEPENDS_BIN="cmake"
23-
export CMAKE_TARGET_NAME=yuv
23+
export CMAKE_TARGETS_NAME=yuv
2424
export GIT_LOCAL_REPO=extra/yuv
2525
export GIT_COMMIT=eb6e7bb
2626
export REPO_DIR=yuv

do-compile/android/cmake-compatible.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,25 @@ echo "----------------------"
5858
echo "[*] compile $LIB_NAME"
5959
echo "----------------------"
6060

61+
# 初始化构建命令
62+
camke_cmd="cmake --build ."
63+
64+
# 以逗号分割目标名称,并为每个目标添加 --target 参数
65+
IFS=',' read -ra targets <<< "$CMAKE_TARGETS_NAME"
66+
for target in "${targets[@]}"; do
67+
camke_cmd="$camke_cmd --target $target"
68+
done
69+
70+
6171
if [[ "$MR_DEBUG" == "debug" ]];then
62-
cmake --build . --target $CMAKE_TARGET_NAME --config Debug -- CODE_SIGNING_ALLOWED=NO
72+
camke_cmd="$camke_cmd --config Debug -- CODE_SIGNING_ALLOWED=NO"
6373
else
64-
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
74+
camke_cmd="$camke_cmd --config Release -- CODE_SIGNING_ALLOWED=NO"
6575
fi
6676

77+
# 执行构建命令
78+
eval "$camke_cmd"
79+
6780
if [[ -n $CMAKE_COMPONENT ]];then
6881
cmake --install . --strip --component "$CMAKE_COMPONENT"
6982
else

do-compile/apple/cmake-compatible.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,27 @@ echo "----------------------"
7272
echo "[*] compile $LIB_NAME"
7373
echo "----------------------"
7474

75+
76+
# 初始化构建命令
77+
camke_cmd="cmake --build ."
78+
79+
# 以逗号分割目标名称,并为每个目标添加 --target 参数
80+
IFS=',' read -ra targets <<< "$CMAKE_TARGETS_NAME"
81+
for target in "${targets[@]}"; do
82+
camke_cmd="$camke_cmd --target $target"
83+
done
84+
85+
7586
if [[ "$MR_DEBUG" == "debug" ]];then
76-
cmake --build . --target $CMAKE_TARGET_NAME --config Debug -- CODE_SIGNING_ALLOWED=NO
87+
camke_cmd="$camke_cmd --config Debug -- CODE_SIGNING_ALLOWED=NO"
7788
else
78-
cmake --build . --target $CMAKE_TARGET_NAME --config Release -- CODE_SIGNING_ALLOWED=NO
89+
camke_cmd="$camke_cmd --config Release -- CODE_SIGNING_ALLOWED=NO"
7990
fi
8091

92+
93+
# 执行构建命令
94+
eval "$camke_cmd"
95+
8196
if [[ -n $CMAKE_COMPONENT ]];then
8297
cmake --install . --component "$CMAKE_COMPONENT"
8398
else

0 commit comments

Comments
 (0)