第6组:启用ccache加速重复编译并保持闭环

This commit is contained in:
cnc
2026-06-01 06:42:35 +08:00
parent 4c55ab3435
commit 6f9431a389
7 changed files with 35 additions and 1 deletions

View File

@@ -9,6 +9,10 @@ if ! [[ "$build_jobs" =~ ^[1-9][0-9]*$ ]]; then
echo "CNC_SIM_BUILD_JOBS must be a positive integer: $build_jobs" >&2
exit 1
fi
cmake_compiler_launcher_mode=none
if [[ -z ${CXX:-} ]] && command -v ccache >/dev/null 2>&1; then
cmake_compiler_launcher_mode=ccache
fi
build_dir=${CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR-build/wasm-cmake-safe-probe}
if [[ -z "$build_dir" ]]; then
echo "CNC_SIM_WASM_CMAKE_SAFE_PROBE_BUILD_DIR must not be empty" >&2
@@ -99,6 +103,7 @@ build_next_signature=$(mktemp "${TMPDIR:-/tmp}/cnc_sim_wasm_cmake_safe_probe.sig
printf 'LINUXCNC_ROOT=%s\n' "$linuxcnc_root"
printf 'MANIFEST=%s\n' "$manifest"
printf 'BUILD_JOBS=%s\n' "$build_jobs"
printf 'COMPILER_LAUNCHER=%s\n' "$cmake_compiler_launcher_mode"
} > "$build_next_signature"
if [[ ! -f "$build_signature" ]] || ! cmp -s "$build_signature" "$build_next_signature"; then
rm -rf "$build_dir"