summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform/iphoneos
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-05 10:18:00 +0800
committerruki <[email protected]>2015-06-05 10:18:00 +0800
commit12ce7dea3c7a74f77e9792236cb85bab4fd001e4 (patch)
treea64fd1ef7c1380ae63e5c982472e8712489b3374 /xmake/scripts/platform/iphoneos
parentf9cecfd11c958122bb6d619069593b91333bdf6f (diff)
add ccache
Diffstat (limited to 'xmake/scripts/platform/iphoneos')
-rw-r--r--xmake/scripts/platform/iphoneos/iphoneos.lua29
-rw-r--r--xmake/scripts/platform/iphoneos/prober.lua37
2 files changed, 52 insertions, 14 deletions
diff --git a/xmake/scripts/platform/iphoneos/iphoneos.lua b/xmake/scripts/platform/iphoneos/iphoneos.lua
index 7c6567416..75f8453a3 100644
--- a/xmake/scripts/platform/iphoneos/iphoneos.lua
+++ b/xmake/scripts/platform/iphoneos/iphoneos.lua
@@ -36,24 +36,25 @@ iphoneos._ARCHS = {"armv7", "armv7s", "arm64"}
function iphoneos.make(configs)
-- init the file formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"lib", ".dylib"}
+ configs.formats = {}
+ configs.formats.static = {"lib", ".a"}
+ configs.formats.object = {"", ".o"}
+ configs.formats.shared = {"lib", ".dylib"}
-- init the toolchains
- configs.tools = {}
- configs.tools.make = "make"
- configs.tools.cc = config.get("cc") or "xcrun -sdk iphoneos clang"
- configs.tools.cxx = config.get("cxx") or "xcrun -sdk iphoneos clang++"
- configs.tools.mm = config.get("mm") or configs.tools.cc
- configs.tools.mxx = config.get("mxx") or configs.tools.cxx
- configs.tools.ld = config.get("ld") or "xcrun -sdk iphoneos clang++"
- configs.tools.ar = config.get("ar") or "xcrun -sdk iphoneos ar"
- configs.tools.sh = config.get("sh") or "xcrun -sdk iphoneos clang++"
+ configs.tools = {}
+ configs.tools.make = "make"
+ configs.tools.ccache = config.get("__ccache")
+ configs.tools.cc = config.get("cc") or "xcrun -sdk iphoneos clang"
+ configs.tools.cxx = config.get("cxx") or "xcrun -sdk iphoneos clang++"
+ configs.tools.mm = config.get("mm") or configs.tools.cc
+ configs.tools.mxx = config.get("mxx") or configs.tools.cxx
+ configs.tools.ld = config.get("ld") or "xcrun -sdk iphoneos clang++"
+ configs.tools.ar = config.get("ar") or "xcrun -sdk iphoneos ar"
+ configs.tools.sh = config.get("sh") or "xcrun -sdk iphoneos clang++"
-- init xcode sdk directory
- configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. config.get("xcode_sdkver") .. ".sdk"
+ configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. config.get("xcode_sdkver") .. ".sdk"
end
diff --git a/xmake/scripts/platform/iphoneos/prober.lua b/xmake/scripts/platform/iphoneos/prober.lua
index d5de4a7c5..33ebe03ad 100644
--- a/xmake/scripts/platform/iphoneos/prober.lua
+++ b/xmake/scripts/platform/iphoneos/prober.lua
@@ -25,6 +25,7 @@ local os = require("base/os")
local path = require("base/path")
local utils = require("base/utils")
local string = require("base/string")
+local tools = require("tools/tools")
-- define module: prober
local prober = prober or {}
@@ -125,6 +126,36 @@ function prober._probe_xcode_sdkver(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)
@@ -137,6 +168,9 @@ function prober.config(configs)
-- probe the xcode sdk version
if not prober._probe_xcode_sdkver(configs) then return end
+ -- probe the ccache
+ if not prober._probe_ccache(configs) then return end
+
end
-- probe the global configure
@@ -145,6 +179,9 @@ function prober.global(configs)
-- probe the xcode application directory
if not prober._probe_xcode(configs) then return end
+ -- probe the ccache
+ if not prober._probe_ccache(configs) then return end
+
end
-- return module: prober