Skip to content

Commit 5385c8b

Browse files
authored
add ccache to speed up builds (#16)
1 parent 3419425 commit 5385c8b

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

.github/workflows/nightly.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ jobs:
2828
optimized: false
2929
arch: aarch64
3030
container: ghcr.io/pkgforge-dev/archlinux:latest
31+
env:
32+
CCACHE_DIR: ${{ github.workspace }}/.ccache
33+
CCACHE_COMPILERCHECK: content
34+
CCACHE_SLOPPINESS: time_macros
3135
steps:
3236
- uses: actions/checkout@v4
3337
with:
@@ -37,6 +41,14 @@ jobs:
3741
if: always()
3842
run: chmod +x ./get-dependencies.sh && ./get-dependencies.sh
3943

44+
- name: Restore ccache
45+
uses: actions/cache@v4
46+
with:
47+
path: ${{ env.CCACHE_DIR }}
48+
key: ${{ matrix.runs-on }}-ccache-${{ matrix.optimized }}-${{ github.sha }}
49+
restore-keys: |
50+
${{ matrix.runs-on }}-ccache-${{ matrix.optimized }}-
51+
4052
- name: Compile Azahar (Normal)
4153
if: ${{ matrix.optimized == false }}
4254
run: |

.github/workflows/stable.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Appimage
22
concurrency:
3-
group: build-${{ github.ref }}
3+
group: build-stable-${{ github.ref }}
44
cancel-in-progress: true
55

66
on:
@@ -28,6 +28,10 @@ jobs:
2828
optimized: false
2929
arch: aarch64
3030
container: ghcr.io/pkgforge-dev/archlinux:latest
31+
env:
32+
CCACHE_DIR: ${{ github.workspace }}/.ccache
33+
CCACHE_COMPILERCHECK: content
34+
CCACHE_SLOPPINESS: time_macros
3135
steps:
3236
- uses: actions/checkout@v4
3337
with:
@@ -37,6 +41,14 @@ jobs:
3741
if: always()
3842
run: chmod +x ./get-dependencies.sh && ./get-dependencies.sh
3943

44+
- name: Restore ccache
45+
uses: actions/cache@v4
46+
with:
47+
path: ${{ env.CCACHE_DIR }}
48+
key: ${{ matrix.runs-on }}-ccache-stable-${{ matrix.optimized }}-${{ github.sha }}
49+
restore-keys: |
50+
${{ matrix.runs-on }}-ccache-stable-${{ matrix.optimized }}-
51+
4052
- name: Compile Azahar (Normal)
4153
if: ${{ matrix.optimized == false }}
4254
run: |

azahar-appimage.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ SHARUN="https://raw.githubusercontent.com/pkgforge-dev/Anylinux-AppImages/refs/h
1111
if [ "$1" = 'v3' ] && [ "$ARCH" = 'x86_64' ]; then
1212
echo "Making x86-64-v3 optimized build of azahar..."
1313
ARCH="${ARCH}_v3"
14-
ARCH_FLAGS="-march=x86-64-v3 -O3 -flto=thin -DNDEBUG"
14+
ARCH_FLAGS="-march=x86-64-v3 -O3 -flto=thin -fuse-ld=lld -DNDEBUG"
1515
elif [ "$ARCH" = 'x86_64' ]; then
1616
echo "Making x86-64 generic build of azahar..."
17-
ARCH_FLAGS="-march=x86-64 -mtune=generic -O3 -flto=thin -DNDEBUG"
17+
ARCH_FLAGS="-march=x86-64 -mtune=generic -O3 -flto=thin -fuse-ld=lld -DNDEBUG"
1818
else
1919
echo "Making aarch64 build of azahar..."
20-
ARCH_FLAGS="-march=armv8-a -mtune=generic -O3 -flto=thin -DNDEBUG"
20+
ARCH_FLAGS="-march=armv8-a -mtune=generic -O3 -flto=thin -fuse-ld=lld -DNDEBUG"
2121
fi
2222

2323
# Determine to build nightly or stable
@@ -48,25 +48,29 @@ echo "$VERSION" > ~/version
4848
qpaheader=$(find /usr/include -type f -name 'qplatformnativeinterface.h' -print -quit)
4949
sed -i "s|#include <qpa/qplatformnativeinterface.h>|#include <$qpaheader>|" ./src/citra_qt/bootmanager.cpp
5050

51-
mkdir ./build
51+
mkdir -p ./build
5252
cd ./build
53-
cmake .. -DCMAKE_CXX_COMPILER=clang++ \
53+
cmake .. -G Ninja \
54+
-DCMAKE_CXX_COMPILER=clang++ \
5455
-DCMAKE_C_COMPILER=clang \
5556
-DCMAKE_INSTALL_PREFIX=/usr \
5657
-DENABLE_QT_TRANSLATION=ON \
5758
-DUSE_SYSTEM_BOOST=OFF \
5859
-DCMAKE_BUILD_TYPE=Release \
59-
-DUSE_DISCORD_PRESENCE=OFF \
60-
-DCMAKE_C_FLAGS="$ARCH_FLAGS" \
6160
-DUSE_SYSTEM_VULKAN_HEADERS=ON \
6261
-DENABLE_LTO=OFF \
62+
-DENABLE_TESTS=OFF \
63+
-DENABLE_ROOM_STANDALONE=OFF \
6364
-DUSE_SYSTEM_GLSLANG=ON \
6465
-DCITRA_USE_PRECOMPILED_HEADERS=OFF \
66+
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
67+
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
6568
-DCMAKE_C_FLAGS="$ARCH_FLAGS" \
6669
-DCMAKE_CXX_FLAGS="$ARCH_FLAGS" \
6770
-Wno-dev
68-
cmake --build . -- -j"$(nproc)"
69-
sudo make install
71+
ninja
72+
sudo ninja install
73+
ccache -s -v
7074
)
7175
rm -rf ./azahar
7276

get-dependencies.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pacman -Syu --noconfirm \
1111
boost \
1212
boost-libs \
1313
catch2 \
14+
ccache \
1415
clang \
1516
cmake \
1617
curl \
@@ -31,6 +32,7 @@ pacman -Syu --noconfirm \
3132
libxss \
3233
libzip \
3334
lld \
35+
llvm \
3436
mesa \
3537
meson \
3638
ninja \

0 commit comments

Comments
 (0)