Commit 37cf49b0 authored by Rosen Matev's avatar Rosen Matev 🌲
Browse files

Add support for the icecream distributed compiler

parent 3b71d761
......@@ -54,13 +54,14 @@ endif()
find_program(ccache_cmd NAMES ccache ccache-swig)
find_program(distcc_cmd distcc)
find_program(icecc_cmd icecc)
set(_clang_format_names)
foreach(_clang_version 5.0 4.0 3.9 3.8 3.7)
list(APPEND _clang_format_names lcg-clang-format-${_clang_version} clang-format-${_clang_version})
endforeach()
list(APPEND _clang_format_names clang-format)
find_program(clang_format_cmd NAMES ${_clang_format_names})
mark_as_advanced(ccache_cmd distcc_cmd clang_format_cmd)
mark_as_advanced(ccache_cmd distcc_cmd icecc_cmd clang_format_cmd)
if(ccache_cmd)
option(CMAKE_USE_CCACHE "Use ccache to speed up compilation." OFF)
......@@ -70,16 +71,29 @@ if(ccache_cmd)
endif()
endif()
set(_distributed_compiler)
if(distcc_cmd)
option(CMAKE_USE_DISTCC "Use distcc to speed up compilation." OFF)
if(CMAKE_USE_DISTCC)
if(CMAKE_USE_CCACHE)
set(GAUDI_RULE_LAUNCH_COMPILE_ENV "${GAUDI_RULE_LAUNCH_COMPILE_ENV} CCACHE_PREFIX=${distcc_cmd}")
message(STATUS "Enabling distcc builds in ccache")
else()
set(GAUDI_RULE_LAUNCH_COMPILE "${GAUDI_RULE_LAUNCH_COMPILE} ${distcc_cmd}")
message(STATUS "Using distcc for building")
set(_distributed_compiler distcc)
endif()
endif()
if(icecc_cmd)
option(CMAKE_USE_ICECC "Use icecc to speed up compilation." OFF)
if(CMAKE_USE_ICECC)
if(_distributed_compiler)
message(FATAL_ERROR "Cannot use multiple distributed compilers at the same time")
endif()
set(_distributed_compiler icecc)
endif()
endif()
if(_distributed_compiler)
if(CMAKE_USE_CCACHE)
set(GAUDI_RULE_LAUNCH_COMPILE_ENV "${GAUDI_RULE_LAUNCH_COMPILE_ENV} CCACHE_PREFIX=${_distributed_compiler}")
message(STATUS "Enabling ${_distributed_compiler} builds in ccache")
else()
set(GAUDI_RULE_LAUNCH_COMPILE "${GAUDI_RULE_LAUNCH_COMPILE} ${_distributed_compiler}")
message(STATUS "Using ${_distributed_compiler} for building")
endif()
endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment