summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/linux/prober.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/scripts/platform/linux/prober.lua')
-rw-r--r--xmake/scripts/platform/linux/prober.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua
index 5e382e5e4..1a3024df1 100644
--- a/xmake/scripts/platform/linux/prober.lua
+++ b/xmake/scripts/platform/linux/prober.lua
@@ -45,12 +45,53 @@ function prober._probe_arch(configs)
return true
end
+-- probe the ccache
+function prober._probe_ccache(configs)
+
+ -- get the ccache mode
+ local mode = configs.ccache
+
+ -- ok?
+ if mode and mode == "y" and configs.__ccache then return true end
+
+ -- disable?
+ if mode and mode == "n" then
+ configs.__ccache = nil
+ return true
+ end
+
+ -- probe the ccache path
+ local ccache_path = tools.probe("ccache", {"/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin"})
+
+ -- probe ok? update it
+ if ccache_path then
+ configs.ccache = "y"
+ configs.__ccache = ccache_path
+ else
+ configs.ccache = "n"
+ end
+
+ -- ok
+ return true
+end
+
-- probe the project configure
function prober.config(configs)
-- probe the architecture
if not prober._probe_arch(configs) then return end
+ -- probe the ccache
+ if not prober._probe_ccache(configs) then return end
+
+end
+
+-- probe the global configure
+function prober.global(configs)
+
+ -- probe the ccache
+ if not prober._probe_ccache(configs) then return end
+
end
-- return module: prober