Skip to content

Commit

Permalink
Support more compiler launchers: distcc sccache (#3738)
Browse files Browse the repository at this point in the history
Co-authored-by: Yee <[email protected]>
Co-authored-by: Sophie <[email protected]>
  • Loading branch information
3 people authored Mar 15, 2022
1 parent 0992736 commit 0322542
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ include(GeneralCMakeOptions)
include(GeneralCMakeConfig)
include(GeneralCompilerConfig)
include(LinkerConfig)
include(CcacheConfig)
include(CompilerLauncher)
include(ThirdPartyConfig)
include(SanitizerConfig)
include(GitHooksConfig)
Expand Down
16 changes: 0 additions & 16 deletions cmake/nebula/CcacheConfig.cmake

This file was deleted.

29 changes: 29 additions & 0 deletions cmake/nebula/CompilerLauncher.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
option(ENABLE_COMPILER_LAUNCHER "Using compiler launcher if available" ON)
if(NOT ENABLE_COMPILER_LAUNCHER)
return()
endif()

set(COMPILER_LAUNCHER_OPTION
"ccache"
CACHE STRING "Compiler cache to be used")
set(COMPILER_LAUNCHER_OPTION_VALUES "ccache" "sccache" "distcc")
set_property(CACHE COMPILER_LAUNCHER_OPTION PROPERTY STRINGS ${COMPILER_LAUNCHER_OPTION_VALUES})
list(
FIND
COMPILER_LAUNCHER_OPTION_VALUES
${COMPILER_LAUNCHER_OPTION}
COMPILER_LAUNCHER_OPTION_INDEX)

if(${COMPILER_LAUNCHER_OPTION_INDEX} EQUAL -1)
message(
STATUS
"Using custom compiler launcher system: '${COMPILER_LAUNCHER_OPTION}', explicitly supported entries are ${COMPILER_LAUNCHER_OPTION_VALUES}")
endif()

find_program(COMPILER_LAUNCHER_BINARY ${COMPILER_LAUNCHER_OPTION})
if(COMPILER_LAUNCHER_BINARY)
message(STATUS "${COMPILER_LAUNCHER_OPTION} found and enabled")
set(CMAKE_CXX_COMPILER_LAUNCHER ${COMPILER_LAUNCHER_BINARY})
else()
message(WARNING "${COMPILER_LAUNCHER_OPTION} is enabled but was not found. Not using it")
endif()

0 comments on commit 0322542

Please sign in to comment.