Skip to content

Fix PCH and ccache build #2627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
CCACHE_DIR: ${GITHUB_WORKSPACE}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 5
# Help ccache manage generated files and PCH (https://ccache.dev/manual/latest.html#_precompiled_headers)
CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime,pch_defines,time_macros

steps:
- name: Setup Container
Expand Down Expand Up @@ -127,6 +129,9 @@ jobs:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/openrobots/lib:/usr/local/lib:/usr/lib:/usr/lib/x86_64-linux-gnu
export CMAKE_PREFIX_PATH=/opt/openrobots/lib

# Clear ccache statistics
ccache -z

mkdir build
cd build
cmake .. \
Expand Down Expand Up @@ -204,6 +209,11 @@ jobs:
cd build
make uninstall

- name: Display ccache statistics
run: |
# TODO: Add -v option when we drop ubuntu-20.04
ccache -s

check:
if: always()
name: check-linux-apt
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/macos-linux-windows-pixi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
CCACHE_DIR: ${GITHUB_WORKSPACE}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 5
# Since pixi will install a compiler, the compiler mtime will be changed.
# This can invalidate the cache (https://ccache.dev/manual/latest.html#config_compiler_check)
CCACHE_COMPILERCHECK: content
BUILD_ADVANCED_TESTING: ${{ matrix.BUILD_ADVANCED_TESTING }}

strategy:
Expand Down Expand Up @@ -87,8 +90,8 @@ jobs:
- uses: actions/cache@v4
with:
path: .ccache
key: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.python-version }}-${{ github.sha }}
restore-keys: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.python-version }}-
key: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.environment }}_${{ github.sha }}
restore-keys: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.environment }}_

- uses: prefix-dev/[email protected]
with:
Expand Down Expand Up @@ -118,6 +121,9 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL: 2
PINOCCHIO_BUILD_TYPE: ${{ matrix.build_type }}
run: |
# Clear ccache statistics
pixi run -e ${{ matrix.environment }} ccache -z

# Launch configure but overwrite default options
pixi run -e ${{ matrix.environment }} configure \
-DBUILD_ADVANCED_TESTING=${{ env.BUILD_ADVANCED_TESTING }} \
Expand All @@ -129,7 +135,12 @@ jobs:
- name: Uninstall Pinocchio
shell: bash -el {0}
run: |
cmake --build build --target uninstall
pixi run -e ${{ matrix.environment }} cmake --build build --target uninstall

- name: Display ccache statistics
shell: bash -el {0}
run: |
pixi run -e ${{ matrix.environment }} ccache -sv

check:
if: always()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ros_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:
- uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}-${{ github.sha }}
restore-keys: ccache-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}-
key: ccache-${{ matrix.env.ROS_DISTRO }}-${{ github.sha }}
restore-keys: ccache-${{ matrix.env.ROS_DISTRO }}-
# Run industrial_ci
- uses: 'ros-industrial/industrial_ci@3e67ec54d63496e076267392148a26229740befc'
env: ${{ matrix.env }}
5 changes: 4 additions & 1 deletion bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ function(PINOCCHIO_PYTHON_BINDINGS_SPECIFIC_TYPE scalar_name)
# * -Wconversion as the BOOST_PYTHON_FUNCTION_OVERLOADS implicitly converts.
# * -Wcomment as latex equations have multi-line comments.
# * -Wself-assign-overloaded as bp::self operations trigger this (Clang only).
# * -Xclang=-fno-pch-timestamp to allow ccache to use pch
# (https://ccache.dev/manual/latest.html#_precompiled_headers).
cxx_flags_by_compiler_frontend(
GNU -Wno-conversion -Wno-comment -Wno-self-assign-overloaded
GNU -Wno-conversion -Wno-comment -Wno-self-assign-overloaded -Xclang=-fno-pch-timestamp
MSVC -Xclang=-fno-pch-timestamp
OUTPUT PRIVATE_OPTIONS
FILTER)
target_compile_options(${PYTHON_LIB_NAME} PRIVATE ${PRIVATE_OPTIONS})
Expand Down
3 changes: 3 additions & 0 deletions development/scripts/pixi/activation.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set CMAKE_EXPORT_COMPILE_COMMANDS=1
:: Activate color output with Ninja
set CMAKE_COLOR_DIAGNOSTICS=1

:: Help ccache manage generated files and PCH (https://ccache.dev/manual/latest.html#_precompiled_headers)
set CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,pch_defines,time_macros

# Set default build value only if not previously set
if not defined PINOCCHIO_BUILD_TYPE (set PINOCCHIO_BUILD_TYPE=Release)
if not defined PINOCCHIO_PYTHON_STUBS (set PINOCCHIO_PYTHON_STUBS=ON)
Expand Down
7 changes: 7 additions & 0 deletions development/scripts/pixi/activation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ then
# On GNU/Linux, I don't know if these flags are mandatory with g++ but
# it allow to use clang++ as compiler
export LDFLAGS="-Wl,-rpath,$CONDA_PREFIX/lib -Wl,-rpath-link,$CONDA_PREFIX/lib -L$CONDA_PREFIX/lib"

# Conda compiler is named x86_64-conda-linux-gnu-c++, ccache can't resolve it
# (https://ccache.dev/manual/latest.html#config_compiler_type)
export CCACHE_COMPILERTYPE=gcc
fi

# Setup ccache
Expand All @@ -31,6 +35,9 @@ export CMAKE_EXPORT_COMPILE_COMMANDS=1
# Activate color output with Ninja
export CMAKE_COLOR_DIAGNOSTICS=1

# Help ccache manage generated files and PCH (https://ccache.dev/manual/latest.html#_precompiled_headers)
export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,pch_defines,time_macros

# Set default build value only if not previously set
export PINOCCHIO_BUILD_TYPE=${PINOCCHIO_BUILD_TYPE:=Release}
export PINOCCHIO_PYTHON_STUBS=${PINOCCHIO_PYTHON_STUBS:=ON}
Expand Down
3 changes: 3 additions & 0 deletions development/scripts/pixi/activation_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

export CC=clang
export CXX=clang++

# activation.sh set this variable to gcc, we must override it here
export CCACHE_COMPILERTYPE=clang
Loading