diff options
Diffstat (limited to 'xmake/modules/private/cache/build_cache.lua')
| -rw-r--r-- | xmake/modules/private/cache/build_cache.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/xmake/modules/private/cache/build_cache.lua b/xmake/modules/private/cache/build_cache.lua index b0960c37a..6b3b85f52 100644 --- a/xmake/modules/private/cache/build_cache.lua +++ b/xmake/modules/private/cache/build_cache.lua @@ -21,6 +21,7 @@ -- imports import("core.base.bytes") import("core.base.hashset") +import("core.base.global") import("core.cache.memcache") import("core.project.config") import("core.project.policy") @@ -124,8 +125,18 @@ end -- get cache root directory function rootdir() - local cachedir = config.get("ccachedir") - return cachedir or path.join(config.buildir(), ".build_cache") + local cachedir = _g.cachedir + if not cachedir then + cachedir = config.get("ccachedir") + if not cachedir and project.policy("build.ccache.global_storage") then + cachedir = path.join(global.directory(), ".build_cache") + end + if not cachedir then + cachedir = path.join(config.buildir(), ".build_cache") + end + _g.cachedir = cachedir + end + return cachedir end -- clean cached files |
