diff --git a/CMakeLists.txt b/CMakeLists.txt index a35067acd7b97fab8f374bcd4983fa41e006b77b..70a168672364f6a72d9ed28a013b9faf14d5cb48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,11 @@ option(OGS_ENABLE_AVX2 "Enable the use of AVX2 instructions" OFF) option(OGS_USE_CONAN "Should Conan package manager be used?" ON) set(OGS_CONAN_BUILD "missing" CACHE STRING "Possible values: all, missing, \ never or list of libs to build") -option(OGS_DISABLE_CCACHE "Disables ccache compiler cache." OFF) +if(WIN32) + option(OGS_DISABLE_CLCACHE "Disables clcache compiler cache." OFF) +else() + option(OGS_DISABLE_CCACHE "Disables ccache compiler cache." OFF) +endif() if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16) option(OGS_USE_UNITY_BUILDS "Enables Unity builds for faster compilation." ON) endif() @@ -69,6 +73,7 @@ include(ConanSetup) include(CompilerSetup) include(Find) include(CCacheSetup) +include(CLCacheSetup) include(DocumentationSetup) include(test/Test) if(OGS_COVERAGE AND NOT IS_SUBPROJECT) diff --git a/Jenkinsfile b/Jenkinsfile index e2f27244ec32f44e29c502fa73ca3ada9193fb58..a15a03b92b8c5c820de86b65ee55604ab1c029ca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -412,8 +412,6 @@ pipeline { MSVC_NUMBER = '16' MSVC_VERSION = '2019' OMP_NUM_THREADS = '1' - CC = 'clcache' - CXX = 'clcache' } steps { script { diff --git a/scripts/cmake/CCacheSetup.cmake b/scripts/cmake/CCacheSetup.cmake index e00f95edbcc288921570188c360610bd3515e1bd..147ba5a6aec5777de19d885ece381ab0e8426cc6 100644 --- a/scripts/cmake/CCacheSetup.cmake +++ b/scripts/cmake/CCacheSetup.cmake @@ -1,4 +1,4 @@ -if(NOT CCACHE_TOOL_PATH OR OGS_DISABLE_CCACHE) +if(WIN32 OR NOT CCACHE_TOOL_PATH OR OGS_DISABLE_CCACHE) return() endif() diff --git a/scripts/cmake/CLCacheSetup.cmake b/scripts/cmake/CLCacheSetup.cmake new file mode 100644 index 0000000000000000000000000000000000000000..ccdc39ee5b8417fc73f9d2960652487557d9c18a --- /dev/null +++ b/scripts/cmake/CLCacheSetup.cmake @@ -0,0 +1,6 @@ +if(NOT WIN32 OR NOT CLCACHE_TOOL_PATH OR OGS_DISABLE_CLCACHE) + return() +endif() + +set(CMAKE_C_COMPILER_LAUNCHER ${CLCACHE_TOOL_PATH}) +set(CMAKE_CXX_COMPILER_LAUNCHER ${CLCACHE_TOOL_PATH}) diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index 782d27b9ff933393f26282af1c6147efe2c02a8a..e893c4b17c6615f32b550d66b7865882af22bb64 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -36,7 +36,11 @@ find_program(CURL_TOOL_PATH curl DOC "The curl-tool") find_program(S3CMD_TOOL_PATH s3cmd DOC "S3cmd tool for uploading to Amazon S3") -find_program(CCACHE_TOOL_PATH ccache) +if(WIN32) + find_program(CLCACHE_TOOL_PATH clcache) +else() + find_program(CCACHE_TOOL_PATH ccache) +endif() # Tools for web find_program(VTKJS_CONVERTER vtkDataConverter