Add ccache and distcc support to the cmake build. BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76 Change-Id: Ia5622b531d17bb1c67fe4f4bc01e57dd3560021e
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake index 365da4d..ce4bca8 100644 --- a/build/cmake/aom_configure.cmake +++ b/build/cmake/aom_configure.cmake
@@ -16,6 +16,9 @@ set(AOM_SUPPORTED_CPU_TARGETS "arm64 armv7 armv7s generic mips32 mips64 x86 x86_64") +option(ENABLE_CCACHE "Enable ccache support" OFF) +option(ENABLE_DISTCC "Enable distcc support" OFF) + # Generate the user config settings. This must occur before include of # aom_config_defaults.cmake (because it turns every config variable into a cache # variable with its own help string). @@ -115,6 +118,26 @@ include("${AOM_ROOT}/build/cmake/cpu.cmake") +if (ENABLE_CCACHE) + find_program(CCACHE "ccache") + if (NOT "${CCACHE}" STREQUAL "") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE}") + else () + message("--- Cannot find ccache, ENABLE_CCACHE ignored.") + endif () +endif () + +if (ENABLE_DISTCC) + find_program(DISTCC "distcc") + if (NOT "${DISTCC}" STREQUAL "") + set(CMAKE_C_COMPILER_LAUNCHER "${DISTCC}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${DISTCC}") + else () + message("--- Cannot find distcc, ENABLE_DISTCC ignored.") + endif () +endif () + # Test compiler flags. if (MSVC) add_compiler_flag_if_supported("/W3")