Skip to content

Commit f24cf21

Browse files
committed
add cms2 and placebo
1 parent 72ee5a0 commit f24cf21

File tree

7 files changed

+245
-2
lines changed

7 files changed

+245
-2
lines changed

.github/workflows/build all libs.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ on:
4242
- soundtouch
4343
- opus
4444
- openssl3
45+
- lcms2
46+
- shaderc
47+
- moltenvk
48+
- libplacebo
4549
- dvdread
4650
- dvdnav
4751
- bluray
4852
- dav1d
4953
- uavs3d
5054
- smb2
5155
- webp
52-
- shaderc
53-
- moltenvk
5456
- ijkffmpeg
5557
- fftutorial
5658
- ffmpeg4
@@ -143,6 +145,16 @@ jobs:
143145
fi
144146
fi
145147
148+
if [[ "$lib_name" == "libplacebo" ]]; then
149+
if [[ "$platform" == "android" ]]; then
150+
echo "Skip libplacebo for android"
151+
return
152+
elif [[ "$platform" == "all" ]]; then
153+
echo "Skip libplacebo for android"
154+
platform='apple'
155+
fi
156+
fi
157+
146158
echo "------compile $platform $lib_name------------------------------------"
147159
rm -rf build || git reset --hard || git pull origin
148160
.github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤
@@ -168,8 +180,10 @@ jobs:
168180
"uavs3d"
169181
"smb2"
170182
"webp"
183+
"lcms2"
171184
"shaderc"
172185
"moltenvk"
186+
"libplacebo"
173187
"ijkffmpeg"
174188
"fftutorial"
175189
"ffmpeg4"

.github/workflows/build one lib.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ on:
6464
- fontconfig
6565
- freetype
6666
- fribidi
67+
- lcms2
68+
- libplacebo
6769
- moltenvk
6870
- openssl3
6971
- openssl

.github/workflows/install-dependencies.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,31 @@ case $LIB_NAME in
191191
shaderc)
192192
echo "shaderc has no external dependencies, it fetches its own dependencies via git-sync-deps"
193193
;;
194+
libplacebo)
195+
if [[ $PLAT == all ]];then
196+
./main.sh install -l 'lcms2' -p ios
197+
./main.sh install -l 'lcms2' -p tvos
198+
./main.sh install -l 'lcms2' -p macos
199+
./main.sh install -l 'shaderc' -p ios
200+
./main.sh install -l 'shaderc' -p tvos
201+
./main.sh install -l 'shaderc' -p macos
202+
./main.sh install -l 'moltenvk' -p ios
203+
./main.sh install -l 'moltenvk' -p tvos
204+
./main.sh install -l 'moltenvk' -p macos
205+
elif [[ $PLAT == apple ]];then
206+
./main.sh install -l 'lcms2' -p ios
207+
./main.sh install -l 'lcms2' -p tvos
208+
./main.sh install -l 'lcms2' -p macos
209+
./main.sh install -l 'shaderc' -p ios
210+
./main.sh install -l 'shaderc' -p tvos
211+
./main.sh install -l 'shaderc' -p macos
212+
./main.sh install -l 'moltenvk' -p ios
213+
./main.sh install -l 'moltenvk' -p tvos
214+
./main.sh install -l 'moltenvk' -p macos
215+
else
216+
./main.sh install -l 'lcms2 shaderc moltenvk' -p $PLAT
217+
fi
218+
;;
194219
*)
195220
;;
196221
esac

configs/libs/lcms2.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
export LIB_NAME='lcms2'
19+
export LIPO_LIBS="liblcms2"
20+
export LIB_DEPENDS_BIN="cmake"
21+
export GIT_LOCAL_REPO=extra/lcms2
22+
export GIT_COMMIT=lcms2.17
23+
export REPO_DIR=lcms2
24+
export GIT_REPO_VERSION=lcms2.17
25+
26+
# you can export GIT_LCMS2_UPSTREAM=git@xx:yy/lcms2.git use your mirror
27+
if [[ "$GIT_LCMS2_UPSTREAM" != "" ]] ;then
28+
export GIT_UPSTREAM="$GIT_LCMS2_UPSTREAM"
29+
else
30+
export GIT_UPSTREAM=https://github.com/mm2/Little-CMS.git
31+
fi

configs/libs/libplacebo.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
export LIB_NAME='libplacebo'
19+
export LIPO_LIBS="libplacebo"
20+
export LIB_DEPENDS_BIN="meson ninja"
21+
# libplacebo depends on lcms2 and shaderc (for SPIRV), vulkan backend uses MoltenVK
22+
export LIB_DEPENDS='lcms2 shaderc moltenvk'
23+
export GIT_LOCAL_REPO=extra/libplacebo
24+
export GIT_COMMIT=v7.349.0
25+
export REPO_DIR=libplacebo
26+
export GIT_REPO_VERSION=v7.349.0
27+
28+
# you can export GIT_LIBPLACEB0_UPSTREAM=git@xx:yy/libplacebo.git use your mirror
29+
if [[ "$GIT_LIBPLACEB0_UPSTREAM" != "" ]] ;then
30+
export GIT_UPSTREAM="$GIT_LIBPLACEB0_UPSTREAM"
31+
else
32+
export GIT_UPSTREAM=https://github.com/haasn/libplacebo.git
33+
fi

do-compile/apple/lcms2.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
CFG_FLAGS="--prefix=$MR_BUILD_PREFIX --enable-static --disable-shared"
24+
CFLAGS="$MR_DEFAULT_CFLAGS"
25+
26+
# for cross compile
27+
if [[ $(uname -m) != "$MR_ARCH" || "$MR_FORCE_CROSS" ]]; then
28+
echo "[*] cross compile, on $(uname -m) compile $MR_PLAT $MR_ARCH."
29+
CFLAGS="$CFLAGS -isysroot $MR_SYS_ROOT"
30+
CFG_FLAGS="$CFG_FLAGS --host=$MR_ARCH-apple-darwin --with-sysroot=$MR_SYS_ROOT"
31+
fi
32+
33+
cd $MR_BUILD_SOURCE
34+
35+
echo
36+
echo "CC: $MR_CC"
37+
echo "CFG_FLAGS: $CFG_FLAGS"
38+
echo "CFLAGS: $CFLAGS"
39+
echo
40+
41+
echo "----------------------"
42+
echo "[*] configure $LIB_NAME"
43+
echo "----------------------"
44+
45+
./configure $CFG_FLAGS \
46+
CC="$MR_CC" \
47+
CFLAGS="$CFLAGS" \
48+
LDFLAGS="$CFLAGS"
49+
50+
echo "----------------------"
51+
echo "[*] compile $LIB_NAME"
52+
echo "----------------------"
53+
54+
make -j$MR_HOST_NPROC install

do-compile/apple/libplacebo.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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

Comments
 (0)