1+ #! /usr/bin/env bash
2+ #
3+ # Copyright (C) 2021 Matt Reach<[email protected] >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+ set -e
23+
24+ THIS_DIR=$( DIRNAME=$( dirname " $0 " ) ; cd " $DIRNAME " ; pwd)
25+ cd " $THIS_DIR "
26+ source ../tools/env_assert.sh
27+
28+ echo " === [$0 ] check env begin==="
29+ env_assert " XC_ARCH"
30+ env_assert " _XC_ARCH"
31+ env_assert " XC_BUILD_NAME"
32+ env_assert " XCRUN_CC"
33+ env_assert " XC_DEPLOYMENT_TARGET"
34+ env_assert " XC_BUILD_SOURCE"
35+ env_assert " XC_BUILD_PREFIX"
36+ env_assert " XCRUN_SDK_PATH"
37+ env_assert " XC_THREAD"
38+ env_assert " XC_PLAT"
39+ echo " XC_DEBUG:$XC_DEBUG "
40+ echo " ===check env end==="
41+
42+
43+ toolchain=$PWD /../tools/ios.toolchain.cmake
44+
45+ echo " ----------------------"
46+ echo " [*] configurate $LIB_NAME "
47+ echo " [*] cmake config $cfg "
48+ echo " [*] cmake toolchain $toolchain "
49+ echo " ----------------------"
50+
51+ build=" ${XC_BUILD_SOURCE} /_tmp"
52+
53+ rm -rf " $build "
54+ mkdir -p " $build "
55+
56+ cd " $build "
57+
58+ pf=
59+ if [[ " $XC_PLAT " == ' ios' ]]; then
60+ if [[ $_XC_ARCH == ' arm64_simulator' ]]; then
61+ pf=' SIMULATORARM64'
62+ elif [[ $_XC_ARCH == ' x86_64_simulator' ]]; then
63+ pf=' SIMULATOR64'
64+ else
65+ pf=' OS64'
66+ fi
67+ elif [[ " $XC_PLAT " == ' tvos' ]]; then
68+ if [[ $_XC_ARCH == ' arm64_simulator' ]]; then
69+ pf=' SIMULATORARM64_TVOS'
70+ elif [[ $_XC_ARCH == ' x86_64_simulator' ]]; then
71+ pf=' SIMULATOR_TVOS'
72+ else
73+ pf=' TVOS'
74+ fi
75+ elif [[ " $XC_PLAT " == ' macos' ]]; then
76+ if [[ $_XC_ARCH == ' arm64' ]]; then
77+ pf=' MAC_ARM64'
78+ elif [[ $_XC_ARCH == ' x86_64' ]]; then
79+ pf=' MAC'
80+ fi
81+ fi
82+
83+ cmake -S ${XC_BUILD_SOURCE} -DCMAKE_INSTALL_PREFIX=${XC_BUILD_PREFIX} -GXcode -DCMAKE_TOOLCHAIN_FILE=$toolchain -DPLATFORM=$pf -DSOUNDSTRETCH=0
84+
85+ echo " ----------------------"
86+ echo " [*] compile $LIB_NAME "
87+ echo " ----------------------"
88+
89+ cmake --build . --target SoundTouch --config Release -- CODE_SIGNING_ALLOWED=NO
90+ cmake --install .
0 commit comments