Skip to content

Commit

Permalink
[script] add ccache to build script to speed up builds when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
lmnotran committed Jun 26, 2024
1 parent 570f711 commit 667ab4f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
15 changes: 14 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ jobs:
with:
submodules: true

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.gcc_ver }}
verbose: 2

- name: Create LFS file hash list
run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

Expand All @@ -94,7 +100,14 @@ jobs:
run: docker load -i ot-efr32-dev.tar

- name: Start ot-efr32-dev container
run: docker run --rm -it --user $(id -u) --name ot-efr32-dev -d -v $PWD:/ot-efr32 -w /ot-efr32 ${{ env.DOCKER_IMAGE_SHA_TAG }}
run: |
docker run \
--rm -it -d \
--user $(id -u) \
--name ot-efr32-dev \
--env CCACHE_DIR=/ot-efr32/.ccache \
-v $PWD:/ot-efr32 -w /ot-efr32\
${{ env.DOCKER_IMAGE_SHA_TAG }}
- name: Bootstrap ARM Toolchain
run: docker exec ot-efr32-dev script/bootstrap arm_toolchain ${{ matrix.gcc_download_url }} ${{ matrix.gcc_extract_dir }} ${{ env.TOOLCHAIN_DIR }}
Expand Down
2 changes: 2 additions & 0 deletions script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ install_packages_apt()
# Install dependencies
sudo apt-get update
apt_packages=(
ccache
coreutils
git
git-lfs
Expand Down Expand Up @@ -77,6 +78,7 @@ install_packages_brew()
echo 'Installing script dependencies...'

brew_packages=(
ccache
coreutils
git
git-lfs
Expand Down
6 changes: 6 additions & 0 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ OT_OPTIONS=(
"-DOT_EXTERNAL_HEAP=ON"
"-DOT_SLAAC=ON"
)

# Check if ccache is installed and use it if available
if command -v ccache >/dev/null; then
OT_OPTIONS+=("-DCMAKE_C_COMPILER_LAUNCHER=ccache")
OT_OPTIONS+=("-DCMAKE_CXX_COMPILER_LAUNCHER=ccache")
fi
readonly OT_OPTIONS

generate()
Expand Down
6 changes: 6 additions & 0 deletions script/build_example_apps
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ OT_OPTIONS=(
"-DOT_PING_SENDER=ON"
"-DOT_SLAAC=ON"
)

# Check if ccache is installed and use it if available
if command -v ccache >/dev/null; then
OT_OPTIONS+=("-DCMAKE_C_COMPILER_LAUNCHER=ccache")
OT_OPTIONS+=("-DCMAKE_CXX_COMPILER_LAUNCHER=ccache")
fi
readonly OT_OPTIONS

die()
Expand Down

0 comments on commit 667ab4f

Please sign in to comment.