Skip to content

Commit adb2780

Browse files
committed
add shaderc
1 parent d6902bf commit adb2780

File tree

5 files changed

+148
-2
lines changed

5 files changed

+148
-2
lines changed

.github/workflows/build all libs.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,15 @@ on:
4242
- soundtouch
4343
- opus
4444
- openssl3
45-
- moltenvk
4645
- dvdread
4746
- dvdnav
4847
- bluray
4948
- dav1d
5049
- uavs3d
5150
- smb2
5251
- webp
52+
- shaderc
53+
- moltenvk
5354
- ijkffmpeg
5455
- fftutorial
5556
- ffmpeg4
@@ -132,6 +133,16 @@ jobs:
132133
fi
133134
fi
134135
136+
if [[ "$lib_name" == "shaderc" ]]; then
137+
if [[ "$platform" == "android" ]]; then
138+
echo "Skip shaderc for android"
139+
return
140+
elif [[ "$platform" == "all" ]]; then
141+
echo "Skip shaderc for android"
142+
platform='apple'
143+
fi
144+
fi
145+
135146
echo "------compile $platform $lib_name------------------------------------"
136147
rm -rf build || git reset --hard || git pull origin
137148
.github/workflows/install-dependencies.sh $lib_name $platform # 补全依赖安装步骤
@@ -150,14 +161,15 @@ jobs:
150161
"soundtouch"
151162
"opus"
152163
"openssl3"
153-
"moltenvk"
154164
"dvdread"
155165
"dvdnav"
156166
"bluray"
157167
"dav1d"
158168
"uavs3d"
159169
"smb2"
160170
"webp"
171+
"shaderc"
172+
"moltenvk"
161173
"ijkffmpeg"
162174
"fftutorial"
163175
"ffmpeg4"

.github/workflows/build one lib.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ on:
6868
- openssl3
6969
- openssl
7070
- opus
71+
- shaderc
7172
- smb2
7273
- soundtouch
7374
- uavs3d

.github/workflows/install-dependencies.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ case $LIB_NAME in
188188
moltenvk)
189189
echo "MoltenVK has no external dependencies, it fetches its own dependencies"
190190
;;
191+
shaderc)
192+
echo "shaderc has no external dependencies, it fetches its own dependencies via git-sync-deps"
193+
;;
191194
*)
192195
;;
193196
esac

configs/libs/shaderc.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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='shaderc'
19+
export LIPO_LIBS="libshaderc libshaderc_combined"
20+
export LIB_DEPENDS_BIN="cmake"
21+
export GIT_LOCAL_REPO=extra/shaderc
22+
export GIT_COMMIT=v2025.3
23+
export REPO_DIR=shaderc
24+
export GIT_REPO_VERSION=v2025.3
25+
26+
# macOS deployment target must be 11.0+ for std::filesystem in glslang
27+
export MR_DEPLOYMENT_TARGET_VER_MACOS=11.0
28+
29+
# you can export GIT_SHADERC_UPSTREAM=git@xx:yy/shaderc.git use your mirror
30+
if [[ "$GIT_SHADERC_UPSTREAM" != "" ]] ;then
31+
export GIT_UPSTREAM="$GIT_SHADERC_UPSTREAM"
32+
else
33+
export GIT_UPSTREAM=https://github.com/google/shaderc.git
34+
fi

do-compile/apple/shaderc.sh

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

Comments
 (0)