Skip to content

Commit 36f8f67

Browse files
setup CCACHE_BASEDIR
This is to help in better ccache utilization while building the same code but located in different folders. Signed-off-by: Artur Harasimiuk <[email protected]>
1 parent 4d953fd commit 36f8f67

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,20 @@ option(CCACHE_ALLOWED "allow use of ccache" TRUE)
461461
find_program(CCACHE_EXE_FOUND ccache)
462462
if(CCACHE_EXE_FOUND AND CCACHE_ALLOWED)
463463
message(STATUS "Found ccache: ${CCACHE_EXE_FOUND}")
464-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
465-
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
464+
465+
if(NOT NEO_DONT_SET_CCACHE_BASEDIR AND NOT DEFINED ENV{CCACHE_BASEDIR})
466+
get_filename_component(__tmp_dir "../infra" ABSOLUTE)
467+
if(IS_DIRECTORY ${__tmp_dir})
468+
get_filename_component(NEO_CCACHE_BASEDIR ".." ABSOLUTE)
469+
list(APPEND NEO_RULE_LAUNCH_LIST "CCACHE_BASEDIR=${NEO_CCACHE_BASEDIR}")
470+
endif()
471+
endif()
472+
list(APPEND NEO_RULE_LAUNCH_LIST "ccache")
473+
string(REPLACE ";" " " NEO_RULE_LAUNCH_STR "${NEO_RULE_LAUNCH_LIST}")
474+
message(STATUS "Using rule: ${NEO_RULE_LAUNCH_STR}")
475+
476+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${NEO_RULE_LAUNCH_STR})
477+
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${NEO_RULE_LAUNCH_STR})
466478
endif()
467479

468480
# Miscs options

manifests/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ components:
2020
infra:
2121
branch: master
2222
dest_dir: infra
23-
revision: 11aaa1edfccd2ddb7918a70b75d1a202aaf05e8c
23+
revision: 10e6b6d86e073c56034712770b16160f8957b18f
2424
type: git
2525
internal:
2626
branch: master

0 commit comments

Comments
 (0)