|
| 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 | + |
| 18 | +set -e |
| 19 | + |
| 20 | +THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd) |
| 21 | +cd "$THIS_DIR" |
| 22 | + |
| 23 | +echo "----------------------" |
| 24 | +echo "[*] sync dependencies for $LIB_NAME" |
| 25 | +echo "----------------------" |
| 26 | + |
| 27 | +cd $MR_BUILD_SOURCE |
| 28 | +if [ -f "./utils/git-sync-deps" ]; then |
| 29 | + echo "running git-sync-deps..." |
| 30 | + chmod +x ./utils/git-sync-deps |
| 31 | + ./utils/git-sync-deps |
| 32 | +else |
| 33 | + echo "git-sync-deps not found" |
| 34 | + exit 1 |
| 35 | +fi |
| 36 | + |
| 37 | +cd "$THIS_DIR" |
| 38 | + |
| 39 | +pf= |
| 40 | +if [[ "$MR_PLAT" == 'ios' ]];then |
| 41 | + if [[ $_MR_ARCH == 'arm64_simulator' ]];then |
| 42 | + pf='SIMULATORARM64' |
| 43 | + elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then |
| 44 | + pf='SIMULATOR64' |
| 45 | + else |
| 46 | + pf='OS64' |
| 47 | + fi |
| 48 | +elif [[ "$MR_PLAT" == 'tvos' ]];then |
| 49 | + if [[ $_MR_ARCH == 'arm64_simulator' ]];then |
| 50 | + pf='SIMULATORARM64_TVOS' |
| 51 | + elif [[ $_MR_ARCH == 'x86_64_simulator' ]];then |
| 52 | + pf='SIMULATOR_TVOS' |
| 53 | + else |
| 54 | + pf='TVOS' |
| 55 | + fi |
| 56 | +elif [[ "$MR_PLAT" == 'macos' ]];then |
| 57 | + if [[ $_MR_ARCH == 'arm64' ]];then |
| 58 | + pf='MAC_ARM64' |
| 59 | + elif [[ $_MR_ARCH == 'x86_64' ]];then |
| 60 | + pf='MAC' |
| 61 | + fi |
| 62 | + # glslang requires macOS 10.15+ for std::filesystem |
| 63 | + export MR_DEPLOYMENT_TARGET_VER=11.0 |
| 64 | +fi |
| 65 | + |
| 66 | +echo "----------------------" |
| 67 | +echo "[*] configurate $LIB_NAME" |
| 68 | +echo "----------------------" |
| 69 | + |
| 70 | +build="${MR_BUILD_SOURCE}/cmake_wksp" |
| 71 | +rm -rf "$build" |
| 72 | +mkdir -p "$build" |
| 73 | +cd "$build" |
| 74 | + |
| 75 | +cmake -S ${MR_BUILD_SOURCE} \ |
| 76 | + -DCMAKE_INSTALL_PREFIX=${MR_BUILD_PREFIX} \ |
| 77 | + -DCMAKE_TOOLCHAIN_FILE="${MR_SHELL_TOOLS_DIR}/ios.toolchain.cmake" \ |
| 78 | + -DPLATFORM=$pf \ |
| 79 | + -DDEPLOYMENT_TARGET=$MR_DEPLOYMENT_TARGET_VER \ |
| 80 | + -DCMAKE_BUILD_TYPE=Release \ |
| 81 | + -DSHADERC_SKIP_TESTS=ON \ |
| 82 | + -DBUILD_SHARED_LIBS=OFF \ |
| 83 | + -DCMAKE_MACOSX_BUNDLE=OFF \ |
| 84 | + -GNinja |
| 85 | + |
| 86 | +echo "----------------------" |
| 87 | +echo "[*] compile $LIB_NAME" |
| 88 | +echo "----------------------" |
| 89 | + |
| 90 | +cmake --build . --config Release --parallel |
| 91 | + |
| 92 | +echo "----------------------" |
| 93 | +echo "[*] install $LIB_NAME" |
| 94 | +echo "----------------------" |
| 95 | + |
| 96 | +cmake --install . |
0 commit comments