|
| 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 "[*] init submodules for $LIB_NAME" |
| 25 | +echo "----------------------" |
| 26 | + |
| 27 | +cd $MR_BUILD_SOURCE |
| 28 | +git submodule update --init --recursive |
| 29 | + |
| 30 | +cd "$THIS_DIR" |
| 31 | + |
| 32 | +echo "----------------------" |
| 33 | +echo "[*] configure $LIB_NAME" |
| 34 | +echo "----------------------" |
| 35 | + |
| 36 | +# libplacebo uses meson, and we need to specify MoltenVK as Vulkan ICD |
| 37 | +# Only enable vulkan backend (no opengl/d3d11) |
| 38 | +# Use shaderc for SPIRV compilation |
| 39 | + |
| 40 | +# Find lcms2 and shaderc from our build |
| 41 | +PKG_CONFIG_PATH="${MR_BUILD_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 42 | + |
| 43 | +# Set deployment target for macOS |
| 44 | +export MACOSX_DEPLOYMENT_TARGET=11.0 |
| 45 | + |
| 46 | +MESON_OPTS="--buildtype=release \ |
| 47 | +--prefix=$MR_BUILD_PREFIX \ |
| 48 | +--default-library=static \ |
| 49 | +-Dvulkan=enabled \ |
| 50 | +-Dshaderc=enabled \ |
| 51 | +-Dglslang=disabled \ |
| 52 | +-Dopengl=disabled \ |
| 53 | +-Dd3d11=disabled \ |
| 54 | +-Dlcms=enabled \ |
| 55 | +-Dtests=false \ |
| 56 | +-Dbench=false \ |
| 57 | +-Ddemos=false \ |
| 58 | +-Dxxhash=disabled" |
| 59 | + |
| 60 | +build="${MR_BUILD_SOURCE}/meson_build" |
| 61 | +rm -rf "$build" |
| 62 | +mkdir -p "$build" |
| 63 | +cd "$build" |
| 64 | + |
| 65 | +# Set up environment for MoltenVK |
| 66 | +export VK_ICD_FILENAMES="${MR_BUILD_PREFIX}/share/vulkan/icd.d/MoltenVK_icd.json" |
| 67 | + |
| 68 | +# Disable assertions to fix Xcode SDK compatibility issue |
| 69 | +export CFLAGS="-U_LIBCPP_ENABLE_ASSERTIONS" |
| 70 | +export CXXFLAGS="-U_LIBCPP_ENABLE_ASSERTIONS" |
| 71 | + |
| 72 | +meson setup . ${MR_BUILD_SOURCE} ${MESON_OPTS} |
| 73 | + |
| 74 | +echo "----------------------" |
| 75 | +echo "[*] compile $LIB_NAME" |
| 76 | +echo "----------------------" |
| 77 | + |
| 78 | +ninja |
| 79 | + |
| 80 | +echo "----------------------" |
| 81 | +echo "[*] install $LIB_NAME" |
| 82 | +echo "----------------------" |
| 83 | + |
| 84 | +meson install |
0 commit comments