Skip to content

Commit

Permalink
sccache
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Sep 15, 2024
1 parent 429e379 commit 412fbc7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 51 deletions.
55 changes: 10 additions & 45 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ jobs:
mingw:
runs-on: ubuntu-24.04
env:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
SCCACHE_GHA_ENABLED: "on"
strategy:
fail-fast: false
matrix:
Expand All @@ -47,22 +45,14 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get time
id: get_time
run: echo "timestamp=`date +%s%N`" >> $GITHUB_OUTPUT

- name: Restore cache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
- name: Setup sccache
uses: mozilla-actions/[email protected]

- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y ccache g++-mingw-w64 gcc-multilib meson nasm ninja-build pkg-config ${{ matrix.wine }}
sudo apt-get install -y g++-mingw-w64 gcc-multilib meson nasm ninja-build pkg-config ${{ matrix.wine }}
- name: Install Meson Wraps
run: |
Expand Down Expand Up @@ -108,25 +98,16 @@ jobs:
name: mpv-${{ matrix.target }}
path: mpv-git-*.zip

- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}

win32:
runs-on: windows-latest
env:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "ccache clang"
CXX: "ccache clang++"
CC: "sccache clang"
CXX: "sccache clang++"
CC_LD: "lld"
CXX_LD: "lld"
WINDRES: "llvm-rc"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
SCCACHE_GHA_ENABLED: "on"
steps:
- name: Disable autocrlf
run: |
Expand All @@ -135,17 +116,8 @@ jobs:
- uses: actions/checkout@v4

- name: Get time
id: get_time
run: |
"timestamp=$((Get-Date).Ticks)" >> $env:GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: x86_64-windows-msvc-${{ steps.get_time.outputs.timestamp }}
restore-keys: x86_64-windows-msvc-
- name: Setup sccache
uses: mozilla-actions/[email protected]

# https://github.com/mesonbuild/meson/pull/11715
- name: Install dependencies
Expand All @@ -154,7 +126,7 @@ jobs:
python -m pip install build wheel
python -m build --wheel --no-isolation meson
python -m pip install (Get-Item ./meson/dist/meson-*-py3-none-any.whl).FullName
choco install ccache nasm
choco install nasm
- name: Update Meson WrapDB
run: |
Expand Down Expand Up @@ -202,13 +174,6 @@ jobs:
build/vulkan-*.dll
!build/mpv.lib
- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: x86_64-windows-msvc-${{ steps.get_time.outputs.timestamp }}

macos:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
12 changes: 6 additions & 6 deletions ci/build-mingw64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ cat >"$prefix_dir/crossfile" <<EOF
buildtype = 'release'
wrap_mode = 'nofallback'
[binaries]
c = ['ccache', '${CC}']
cpp = ['ccache', '${CXX}']
c = ['sccache', '${CC}']
cpp = ['sccache', '${CXX}']
ar = '${AR}'
strip = '${TARGET}-strip'
pkgconfig = 'pkg-config'
Expand Down Expand Up @@ -67,8 +67,8 @@ cmake_args=(
-DCMAKE_BUILD_TYPE=Release
)

export CC="ccache $CC"
export CXX="ccache $CXX"
export CC="sccache $CC"
export CXX="sccache $CXX"

function builddir {
[ -d "$1/builddir" ] && rm -rf "$1/builddir"
Expand Down Expand Up @@ -262,11 +262,11 @@ _libass_mark=lib/libass.dll.a
_luajit () {
[ -d LuaJIT ] || $gitclone https://github.com/LuaJIT/LuaJIT.git
pushd LuaJIT
local hostcc="ccache cc"
local hostcc="sccache cc"
local flags=
[[ "$TARGET" == "i686-"* ]] && { hostcc="$hostcc -m32"; flags=XCFLAGS=-DLUAJIT_NO_UNWIND; }
make TARGET_SYS=Windows clean
make TARGET_SYS=Windows HOST_CC="$hostcc" CROSS="ccache $TARGET-" \
make TARGET_SYS=Windows HOST_CC="$hostcc" STATIC_CC="$CC" CROSS="$TARGET-" \
BUILDMODE=static $flags amalg
make DESTDIR="$prefix_dir" INSTALL_DEP= FILE_T=luajit.exe install
popd
Expand Down

0 comments on commit 412fbc7

Please sign in to comment.