From: Cody Northrop Date: Tue, 31 Oct 2017 23:05:03 +0000 (-0600) Subject: build: Add optional ccache support to cmake X-Git-Tag: upstream/1.1.92~673 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7e1e947486411f1c761addb30684bcf2554f6df;p=platform%2Fupstream%2FVulkan-Tools.git build: Add optional ccache support to cmake --- diff --git a/BUILD.md b/BUILD.md index bb78c9c..8b884c9 100644 --- a/BUILD.md +++ b/BUILD.md @@ -40,6 +40,8 @@ cd dbuild make ``` +If your build system supports ccache, you can enable that via cmake option `-DUSE_CCACHE=On` + If you have installed a Vulkan driver obtained from your graphics hardware vendor, the install process should have configured the driver so that the Vulkan loader can find and load it. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2412236..8b91674 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,15 @@ string(TOLOWER ${API_NAME} API_LOWERCASE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") find_package(PythonInterp 3 REQUIRED) +option(USE_CCACHE "Use ccache" OFF) +if (USE_CCACHE) + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif(CCACHE_FOUND) +endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") set(FALLBACK_CONFIG_DIRS "/etc/xdg" CACHE STRING "Search path to use when XDG_CONFIG_DIRS is unset or empty or the current process is SUID/SGID. Default is freedesktop compliant.")