Commit 3a17c331 authored by Tom Finegan's avatar Tom Finegan
Browse files

Add wrapper function for setting CMake compiler launcher.

Also adds a missing function doc comment.

Change-Id: I0ff00cb326709134259b0aecc6b60046f209d2a8
parent 30f0e15d
...@@ -149,33 +149,15 @@ endif () ...@@ -149,33 +149,15 @@ endif ()
include("${AOM_ROOT}/build/cmake/cpu.cmake") include("${AOM_ROOT}/build/cmake/cpu.cmake")
if (ENABLE_CCACHE) if (ENABLE_CCACHE)
find_program(CCACHE "ccache") set_compiler_launcher(ENABLE_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 () endif ()
if (ENABLE_DISTCC) if (ENABLE_DISTCC)
find_program(DISTCC "distcc") set_compiler_launcher(ENABLE_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 () endif ()
if (ENABLE_GOMA) if (ENABLE_GOMA)
find_program(GOMACC "gomacc") set_compiler_launcher(ENABLE_GOMA gomacc)
if (NOT "${GOMACC}" STREQUAL "")
set(CMAKE_C_COMPILER_LAUNCHER "${GOMACC}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${GOMACC}")
else ()
message("--- Cannot find gomacc, ENABLE_GOMA ignored.")
endif ()
endif () endif ()
if (NOT CONFIG_AV1_DECODER AND NOT CONFIG_AV1_ENCODER) if (NOT CONFIG_AV1_DECODER AND NOT CONFIG_AV1_ENCODER)
......
...@@ -24,6 +24,8 @@ function (create_dummy_source_file basename extension out_file_path) ...@@ -24,6 +24,8 @@ function (create_dummy_source_file basename extension out_file_path)
set(${out_file_path} ${dummy_source_file} PARENT_SCOPE) set(${out_file_path} ${dummy_source_file} PARENT_SCOPE)
endfunction () endfunction ()
# Convenience function for adding a dummy source file to $target_name using
# $extension as the file extension. Wraps create_dummy_source_file().
function (add_dummy_source_file_to_target target_name extension) function (add_dummy_source_file_to_target target_name extension)
create_dummy_source_file("${target_name}" "${extension}" "dummy_source_file") create_dummy_source_file("${target_name}" "${extension}" "dummy_source_file")
target_sources(${target_name} PRIVATE ${dummy_source_file}) target_sources(${target_name} PRIVATE ${dummy_source_file})
...@@ -45,5 +47,20 @@ function (change_config_and_warn feature value cause) ...@@ -45,5 +47,20 @@ function (change_config_and_warn feature value cause)
message(WARNING "--- ${warning_message}") message(WARNING "--- ${warning_message}")
endfunction () endfunction ()
# Sets CMake compiler launcher to $launcher_name when $launcher_name is found in
# $PATH. Warns user about ignoring build flag $launcher_flag when $launcher_name
# is not found in $PATH.
function (set_compiler_launcher launcher_flag launcher_name)
find_program(launcher_path "${launcher_name}")
if (launcher_path)
set(CMAKE_C_COMPILER_LAUNCHER "${launcher_path}" PARENT_SCOPE)
set(CMAKE_CXX_COMPILER_LAUNCHER "${launcher_path}" PARENT_SCOPE)
message("--- Using ${launcher_name} as compiler launcher.")
else ()
message(WARNING
"--- Cannot find ${launcher_name}, ${launcher_flag} ignored.")
endif ()
endfunction ()
endif() # AOM_BUILD_CMAKE_UTIL_CMAKE_ endif() # AOM_BUILD_CMAKE_UTIL_CMAKE_
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