File tree Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Expand file tree Collapse file tree 4 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -179,3 +179,12 @@ make coverage # or make -C build-build coverage
179179``` sh
180180make -C build-build coverage-lcovr
181181```
182+
183+ ### SCCache / CCache
184+
185+ The build systems supports sccache/ccache, you just need to have it available in your path. You can
186+ install it into your dev container with the following commands:
187+
188+ ```
189+ docker exec -u 0 -it bitbox02-firmware-dev bash -c 'apt update && apt install -y libssl-dev && CARGO_HOME=/opt/cargo cargo install --locked sccache'
190+ ```
Original file line number Diff line number Diff line change 3636 message (FATAL_ERROR "Invalid CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} " )
3737endif ()
3838
39+ find_program (SCCACHE_PROGRAM sccache)
40+ find_program (CCACHE_PROGRAM ccache)
41+ if (SCCACHE_PROGRAM)
42+ set (CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM} " )
43+ elseif (CCACHE_PROGRAM)
44+ set (CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM} " )
45+ endif ()
46+
3947project (bitbox02 C)
4048
4149# nosys is set in arm.cmake so that `project(c)` above works. Remove it since it interferes with compile options
@@ -257,6 +265,7 @@ message(STATUS "Processor: ${CMAKE_SYSTEM_PROCESSOR}")
257265message (STATUS " - Build -" )
258266message (STATUS "Compiler version: ${CMAKE_C_COMPILER_ID} ${C_COMPILER_VERSION} " )
259267message (STATUS "Compiler: ${CMAKE_C_COMPILER} " )
268+ message (STATUS "Compiler cache: ${CMAKE_C_COMPILER_LAUNCHER} " )
260269message (STATUS "Linker: ${CMAKE_LINKER} " )
261270message (STATUS "Archiver: ${CMAKE_AR} " )
262271message (STATUS "Default CFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} }" )
Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ include(ExternalProject)
22
33if (CMAKE_CROSSCOMPILING )
44 set (CONFIGURE_FLAGS
5- --host=${CMAKE_SYSTEM_PROCESSOR} -none-eabi --build =${CMAKE_HOST_SYSTEM_PROCESSOR} -linux-gnu)
5+ --host=${CMAKE_SYSTEM_PROCESSOR} -none-eabi
6+ --build =${CMAKE_HOST_SYSTEM_PROCESSOR} -linux-gnu
7+ "$<$<BOOL:${CMAKE_C_COMPILER_LAUNCHER} >:CC=${CMAKE_C_COMPILER_LAUNCHER} ${CMAKE_C_COMPILER} >"
8+ )
69endif ()
710
811# Remove parameters to make build identical to older build
Original file line number Diff line number Diff line change @@ -508,6 +508,7 @@ foreach(type ${RUST_LIBS})
508508 CMAKE_CURRENT_BINARY_DIR =${CMAKE_CURRENT_BINARY_DIR}
509509 RUSTFLAGS=${RUSTFLAGS}
510510 FIRMWARE_VERSION_SHORT=${FIRMWARE_VERSION}
511+ $<$<BOOL :${SCCACHE_PROGRAM} >:RUSTC_WRAPPER=${SCCACHE_PROGRAM} >
511512 ${CARGO} build $<$<BOOL :${CMAKE_VERBOSE_MAKEFILE} >:-v> --features target -${type} --target -dir ${RUST_BINARY_DIR} /feature-${type} ${RUST_CARGO_FLAG} ${RUST_TARGET_ARCH_ARG}
512513 COMMAND
513514 ${CMAKE_COMMAND} -E copy_if_different ${lib} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} /lib${type} _rust_c.a
You can’t perform that action at this time.
0 commit comments