Skip to content

Commit a742bf2

Browse files
committed
fix
1 parent c24186b commit a742bf2

3 files changed

Lines changed: 25 additions & 29 deletions

File tree

CMakeLists.txt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ project(paimon
3535
VERSION 0.1.0
3636
DESCRIPTION "Paimon C++ Project")
3737

38-
# Setup ccache to accelerate compilation if available
39-
find_program(CCACHE_PROGRAM ccache)
40-
if(CCACHE_PROGRAM)
41-
message(STATUS "Found ccache: ${CCACHE_PROGRAM}")
42-
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
43-
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
44-
else()
45-
message(STATUS "ccache not found, compiling without cache acceleration")
46-
endif()
47-
4838
string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_BUILD_TYPE)
4939

5040
set(CMAKE_CXX_STANDARD 17)
@@ -197,6 +187,21 @@ if(UNIX)
197187
all)
198188
endif(UNIX)
199189
190+
# Setup ccache to accelerate compilation if available
191+
if(PAIMON_USE_CCACHE
192+
AND NOT CMAKE_C_COMPILER_LAUNCHER
193+
AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
194+
195+
find_program(CCACHE_PROGRAM ccache)
196+
if(CCACHE_PROGRAM)
197+
message(STATUS "Found ccache: ${CCACHE_PROGRAM}")
198+
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
199+
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
200+
else()
201+
message(STATUS "ccache not found, compiling without cache acceleration")
202+
endif()
203+
endif()
204+
200205
include(SetupCxxFlags)
201206
202207
# set compile output directory

ci/scripts/setup_ccache.sh

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,12 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# Centralized ccache configuration for CI environments.
18-
# All ccache parameters are defined here as environment variables so that
19-
# they can be tuned in a single place.
17+
echo "PAIMON_USE_CCACHE=ON" >> $GITHUB_ENV
2018

21-
set -euo pipefail
19+
echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV
20+
echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV
21+
echo "CCACHE_MAXSIZE=5G" >> $GITHUB_ENV
22+
echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
23+
echo "CCACHE_COMPRESSLEVEL=6" >> $GITHUB_ENV
2224

23-
# ---- ccache parameters (edit here to change defaults) ----
24-
export CCACHE_MAXSIZE="${CCACHE_MAXSIZE:-5G}"
25-
export CCACHE_COMPRESS="${CCACHE_COMPRESS:-true}"
26-
export CCACHE_COMPRESSLEVEL="${CCACHE_COMPRESSLEVEL:-6}"
27-
28-
# Apply configuration via ccache CLI (persisted to ~/.ccache/ccache.conf)
29-
ccache --set-config=max_size="${CCACHE_MAXSIZE}"
30-
ccache --set-config=compression="${CCACHE_COMPRESS}"
31-
ccache --set-config=compression_level="${CCACHE_COMPRESSLEVEL}"
32-
33-
# Reset statistics so post-build stats reflect only this build
34-
ccache -z
35-
36-
echo "=== ccache configured ==="
37-
ccache -p | grep -E "max_size|compression" || true
25+
mkdir -p "${HOME}/.ccache"

cmake_modules/DefineOptions.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
9595
define_option(PAIMON_BUILD_STATIC "Build static libraries" ON)
9696

9797
define_option(PAIMON_BUILD_SHARED "Build shared libraries" ON)
98+
99+
define_option(PAIMON_USE_CCACHE "Use ccache when compiling (if available)" ON)
100+
98101
#----------------------------------------------------------------------
99102
set_option_category("Test")
100103

0 commit comments

Comments
 (0)