Skip to content

Commit 7be9758

Browse files
committed
{build,workflow}: enable ccache
1 parent fe5b71c commit 7be9758

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

.github/workflows/mpv.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
run: |
134134
sudo echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
135135
sudo pacman -Syu --noconfirm
136-
sudo pacman -S --noconfirm --needed git gyp ninja cmake ragel yasm nasm asciidoc enca gperf unzip xz gcc-multilib clang lld libc++ libc++abi python-pip curl lib32-glib2 wget python-cairo
136+
sudo pacman -S --noconfirm --needed git gyp ninja cmake ragel yasm nasm asciidoc enca gperf unzip xz gcc-multilib clang lld libc++ libc++abi python-pip curl lib32-glib2 wget python-cairo mimalloc ccache
137137
mkdir -p /home/opt/7zip
138138
wget -qO - https://www.7-zip.org/a/7z2301-linux-x64.tar.xz | tar -xJf - -C /home/opt/7zip 7zzs
139139
sudo ln -s /home/opt/7zip/7zzs /usr/bin/7z
@@ -144,7 +144,7 @@ jobs:
144144
git config --global rebase.autoStash true
145145
git config --global fetch.prune true
146146
- uses: actions/checkout@v4
147-
- name: Get Params
147+
- name: Prepare
148148
run: |
149149
echo "sha=${{ needs.params.outputs.sha }}" >> $GITHUB_ENV
150150
echo "winbuild_repo=${{ inputs.winbuild_repo }}" >> $GITHUB_ENV
@@ -159,6 +159,10 @@ jobs:
159159
repository: ${{ inputs.winbuild_repo }}
160160
ref: ${{ inputs.winbuild_ref }}
161161
path: mpv-winbuild-cmake
162+
- name: Ccache
163+
run: |
164+
sed -i '/ccache_conf.in/d' mpv-winbuild-cmake/CMakeLists.txt
165+
sed -i '/ccache/d' mpv-winbuild-cmake/exec.in
162166
163167
- name: Lookup Toolchain Cache
164168
id: lookup_toolchain
@@ -266,6 +270,17 @@ jobs:
266270
with:
267271
path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }}
268272
key: ${{ env.build_restore_key }}
273+
- name: Set up ccache
274+
uses: zhongfly/setup-ccache-action@dist
275+
with:
276+
update_packager_index: false
277+
install_ccache: false
278+
override_cache_key: ccache-build${{ matrix.bit }}-${{ inputs.compiler }}
279+
ccache_options: |
280+
cache_dir=$GITHUB_WORKSPACE/.ccache
281+
max_size=500M
282+
sloppiness=locale,time_macros
283+
compiler_check=none
269284
270285
- name: Running custom command
271286
if: ${{ inputs.command != '' }}

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ build() {
5353
if [ "$compiler" == "clang" ]; then
5454
clang_option=(-DCMAKE_INSTALL_PREFIX=$clang_root -DMINGW_INSTALL_PREFIX=$buildroot/build$bit/install/$arch-w64-mingw32)
5555
fi
56-
cmake -DTARGET_ARCH=$arch-w64-mingw32 $gcc_arch -DCOMPILER_TOOLCHAIN=$compiler "${clang_option[@]}" -DALWAYS_REMOVE_BUILDFILES=ON -DSINGLE_SOURCE_LOCATION=$srcdir -DRUSTUP_LOCATION=$buildroot/install_rustup -G Ninja -H$gitdir -B$buildroot/build$bit
56+
cmake --fresh -DTARGET_ARCH=$arch-w64-mingw32 $gcc_arch -DCOMPILER_TOOLCHAIN=$compiler "${clang_option[@]}" -DENABLE_CCACHE=ON -DALWAYS_REMOVE_BUILDFILES=ON -DSINGLE_SOURCE_LOCATION=$srcdir -DRUSTUP_LOCATION=$buildroot/install_rustup -G Ninja -H$gitdir -B$buildroot/build$bit
5757

5858
ninja -C $buildroot/build$bit {libzvbi,libopenmpt}-removeprefix || rm -rf $srcdir/{libzvbi,libopenmpt} || true
5959
ninja -C $buildroot/build$bit download || true

0 commit comments

Comments
 (0)