已合并
Involve ccache in compiling #11111
dilililiwhy创建于 2024年4月11日
Involve ccache in compiling #11111
已合并
从refs/pull/11111/head合入到master
共 2 个文件变更+20-0
| @@ -1,5 +1,15 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) | 1 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) |
| 2 | 2 | ||
| 3 | +find_program(CCACHE ccache) | ||
| 4 | +if(${CCACHE} STREQUAL "CCACHE-NOTFOUND") | ||
| 5 | + message(STATUS "Compile without ccache") | ||
| 6 | +else() | ||
| 7 | + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE} CACHE PATH "cache Compiler") | ||
| 8 | + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE} CACHE PATH "cache Compiler") | ||
| 9 | + message(STATUS "CMAKE_C_COMPILER_LAUNCHER:${CMAKE_C_COMPILER_LAUNCHER}") | ||
| 10 | + message(STATUS "CMAKE_CXX_COMPILER_LAUNCHER:${CMAKE_CXX_COMPILER_LAUNCHER}") | ||
| 11 | +endif() | ||
| 12 | + | ||
| 3 | project(TORCHNPU CXX C) | 13 | project(TORCHNPU CXX C) |
| 4 | 14 | ||
| 5 | set(LINUX TRUE) | 15 | set(LINUX TRUE) |
| @@ -1,5 +1,15 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.13 FATAL_ERROR) | 1 | cmake_minimum_required(VERSION 3.13 FATAL_ERROR) |
| 2 | 2 | ||
| 3 | +find_program(CCACHE ccache) | ||
| 4 | +if(${CCACHE} STREQUAL "CCACHE-NOTFOUND") | ||
| 5 | + message(STATUS "Compile without ccache") | ||
| 6 | +else() | ||
| 7 | + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE} CACHE PATH "cache Compiler") | ||
| 8 | + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE} CACHE PATH "cache Compiler") | ||
| 9 | + message(STATUS "CMAKE_C_COMPILER_LAUNCHER:${CMAKE_C_COMPILER_LAUNCHER}") | ||
| 10 | + message(STATUS "CMAKE_CXX_COMPILER_LAUNCHER:${CMAKE_CXX_COMPILER_LAUNCHER}") | ||
| 11 | +endif() | ||
| 12 | + | ||
| 3 | project(LibtorchNPUDemo CXX C) | 13 | project(LibtorchNPUDemo CXX C) |
| 4 | 14 | ||
| 5 | set(LINUX TRUE) | 15 | set(LINUX TRUE) |