Skip to content

Commit

Permalink
fix(ccache): enable ccache on bare-metal setups (autowarefoundation#4566
Browse files Browse the repository at this point in the history
)

* .

Signed-off-by: Oguz Ozturk <[email protected]>

* fix ccache usage in docker build

Signed-off-by: oguzkaganozt <[email protected]>

* .

Signed-off-by: oguzkaganozt <[email protected]>

* change ccache directory

Signed-off-by: oguzkaganozt <[email protected]>

* .

Signed-off-by: oguzkaganozt <[email protected]>

* .

Signed-off-by: Oguz Ozturk <[email protected]>

---------

Signed-off-by: Oguz Ozturk <[email protected]>
Signed-off-by: oguzkaganozt <[email protected]>
  • Loading branch information
oguzkaganozt authored Mar 29, 2024
1 parent 12185e1 commit b3e4094
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 13 additions & 1 deletion ansible/roles/build_tools/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- name: Add CCACHE_DIR to .bashrc
ansible.builtin.lineinfile:
dest: ~/.bashrc
line: export CCACHE_DIR="/ccache"
line: export CCACHE_DIR="/var/tmp/ccache"
state: present
create: true
mode: 0644
Expand All @@ -28,3 +28,15 @@
state: present
create: true
mode: 0644

- name: Create ccache directory
ansible.builtin.file:
path: /var/tmp/ccache
state: directory
mode: 0755

- name: Source .bashrc
ansible.builtin.shell: source ~/.bashrc
args:
executable: /bin/bash
changed_when: false
5 changes: 4 additions & 1 deletion docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG SETUP_ARGS
ARG ROS_DISTRO
ENV CCACHE_DIR="/var/tmp/ccache"
ENV CC="/usr/lib/ccache/gcc"
ENV CXX="/usr/lib/ccache/g++"

# Set up development environment
RUN --mount=type=ssh \
Expand All @@ -71,7 +74,7 @@ RUN --mount=type=ssh \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
&& find /autoware/install -type d -exec chmod 777 {} \; \
&& chmod -R 777 /ccache \
&& chmod -R 777 /var/tmp/ccache \
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \
&& rm -rf /autoware/build /autoware/src

Expand Down

0 comments on commit b3e4094

Please sign in to comment.