Skip to content
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

Support more compiler launchers: distcc sccache #3738

Merged
merged 5 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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()