-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_deps.sh
executable file
·61 lines (47 loc) · 1.24 KB
/
build_deps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
PROJECT_ROOT=$(pwd)
BUILD_ROOT=${PROJECT_ROOT}/build
OUT_ROOT=${BUILD_ROOT}/out
LIB_ROOT=${BUILD_ROOT}/lib
DEPS_ROOT=${PROJECT_ROOT}/deps
function build_dep_for_platform() {
local DEP=$1
local TARGET=$2
local ARCH=$3
local PLATFORM=$4
local BUILD_PATH=${OUT_ROOT}/${PLATFORM}/deps/${DEP}
test -d ${BUILD_PATH} || mkdir -p ${BUILD_PATH}
cd ${BUILD_PATH}
cmake \
-GXcode \
-DCMAKE_TOOLCHAIN_FILE=${PROJECT_ROOT}/toolchains/ios.cmake \
-DIOS_ARCH=${ARCH} \
${DEPS_ROOT}/$1
local SDK=$(echo ${PLATFORM} | tr '[:upper:]' '[:lower:]')
xcodebuild \
ARCHS=${ARCH} \
-sdk $SDK \
-configuration Release \
-parallelizeTargets \
-jobs 16 \
-target ALL_BUILD
}
function build_dep() {
local DEP=$1
local TARGET=$2
build_dep_for_platform $DEP $TARGET x86_64 iPhoneSimulator
build_dep_for_platform $DEP $TARGET arm64 iPhoneOS
}
function ln_deps() {
local PLATFORM=$1
local LIB_DIR=${LIB_ROOT}/${PLATFORM}
test -d ${LIB_DIR} || mkdir -p ${LIB_DIR}
find ${OUT_ROOT}/${PLATFORM} -name lib*.a | while read S_FILE; do
ln -s ${S_FILE} ${LIB_DIR}/
done
}
# deps
build_dep cmus-client-cpp cmusclient
ln_deps iPhoneOS
ln_deps iPhoneSimulator
cd $PROJECT_ROOT