summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-12-13 00:39:22 +0800
committerruki <[email protected]>2018-12-12 22:35:17 +0800
commita16fcd5180de7d18426106e5d398ebc04a96841d (patch)
treeebffa6df08a28820f54a047b9b457c13c8bb8a32
parentfd4ca8751a6d64de8088a05e6f0a8ac4e6e48d2d (diff)
improve to xmake global
-rw-r--r--xmake/actions/config/xmake.lua3
-rw-r--r--xmake/core/sandbox/modules/import/core/base/global.lua9
-rw-r--r--xmake/modules/detect/sdks/find_xcode.lua4
-rw-r--r--xmake/platforms/android/check.lua2
-rw-r--r--xmake/platforms/checker.lua2
-rw-r--r--xmake/platforms/cross/check.lua2
-rw-r--r--xmake/platforms/iphoneos/check.lua4
-rw-r--r--xmake/platforms/linux/check.lua2
-rw-r--r--xmake/platforms/macosx/check.lua4
-rw-r--r--xmake/platforms/mingw/check.lua2
-rw-r--r--xmake/platforms/watchos/check.lua4
-rw-r--r--xmake/platforms/windows/check.lua2
12 files changed, 18 insertions, 22 deletions
diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua
index a19d7140a..dd869cdbe 100644
--- a/xmake/actions/config/xmake.lua
+++ b/xmake/actions/config/xmake.lua
@@ -135,7 +135,8 @@ task("config")
, {category = "Other Configuration"}
, {nil, "debugger", "kv", "auto", "The Debugger" }
- , {nil, "ccache", "kv", true, "Enable or disable the c/c++ compiler cache." }
+ , {nil, "ccache", "kv", true, "Enable or disable the c/c++ compiler cache."
+ , " --ccache=[y|n]" }
, {'o', "buildir", "kv", "build", "Set the build directory." }
, {}
diff --git a/xmake/core/sandbox/modules/import/core/base/global.lua b/xmake/core/sandbox/modules/import/core/base/global.lua
index 6ae8c7811..b74b0e987 100644
--- a/xmake/core/sandbox/modules/import/core/base/global.lua
+++ b/xmake/core/sandbox/modules/import/core/base/global.lua
@@ -26,6 +26,7 @@
local sandbox_core_base_global = sandbox_core_base_global or {}
-- load modules
+local os = require("base/os")
local table = require("base/table")
local global = require("base/global")
local platform = require("platform/platform")
@@ -90,17 +91,11 @@ function sandbox_core_base_global.check()
-- belong to the current host?
for _, host in ipairs(table.wrap(instance:hosts())) do
- if host == xmake._HOST then
-
- -- get the check script
+ if host == os.host() then
local check = instance:get("check")
if check ~= nil then
-
- -- check it
check("global")
end
-
- -- ok
break
end
end
diff --git a/xmake/modules/detect/sdks/find_xcode.lua b/xmake/modules/detect/sdks/find_xcode.lua
index 0a71f0d84..3d381f665 100644
--- a/xmake/modules/detect/sdks/find_xcode.lua
+++ b/xmake/modules/detect/sdks/find_xcode.lua
@@ -106,9 +106,9 @@ function main(sdkdir, opt)
opt = opt or {}
-- attempt to load cache first
- local key = "detect.sdks.find_vscode." .. (sdkdir or "")
+ local key = "detect.sdks.find_vscode"
local cacheinfo = cache.load(key)
- if not opt.force and cacheinfo.xcode then
+ if not opt.force and cacheinfo.xcode and cacheinfo.xcode.sdkdir and os.isdir(cacheinfo.xcode.sdkdir) then
return cacheinfo.xcode
end
diff --git a/xmake/platforms/android/check.lua b/xmake/platforms/android/check.lua
index b33bdcf5f..4e5d4e9ea 100644
--- a/xmake/platforms/android/check.lua
+++ b/xmake/platforms/android/check.lua
@@ -23,7 +23,7 @@
--
-- imports
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
import("detect.sdks.find_ndk")
-- check the ndk toolchain
diff --git a/xmake/platforms/checker.lua b/xmake/platforms/checker.lua
index 927590d41..35efba82f 100644
--- a/xmake/platforms/checker.lua
+++ b/xmake/platforms/checker.lua
@@ -122,7 +122,7 @@ end
function check_xcode(config, optional)
-- find xcode
- local xcode = find_xcode(config.get("xcode"), {force = true, verbose = true, plat = config.get("plat"), arch = config.get("arch")})
+ local xcode = find_xcode(config.get("xcode"), {force = not optional, verbose = true, plat = config.get("plat"), arch = config.get("arch")})
if xcode then
-- save it (maybe to global)
diff --git a/xmake/platforms/cross/check.lua b/xmake/platforms/cross/check.lua
index 7cfc02190..0508eae17 100644
--- a/xmake/platforms/cross/check.lua
+++ b/xmake/platforms/cross/check.lua
@@ -24,7 +24,7 @@
-- imports
import("detect.sdks.find_cross_toolchain")
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
-- check the architecture
function __check_arch(config)
diff --git a/xmake/platforms/iphoneos/check.lua b/xmake/platforms/iphoneos/check.lua
index 4d81689d4..fc1b971b1 100644
--- a/xmake/platforms/iphoneos/check.lua
+++ b/xmake/platforms/iphoneos/check.lua
@@ -23,7 +23,7 @@
--
-- imports
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
-- get toolchains
function _toolchains(config)
@@ -96,7 +96,7 @@ function main(kind, toolkind)
-- init the check list of global
_g.global =
{
- checker.check_xcode
+ { checker.check_xcode, true }
}
-- check it
diff --git a/xmake/platforms/linux/check.lua b/xmake/platforms/linux/check.lua
index 5c52b877f..87a225eec 100644
--- a/xmake/platforms/linux/check.lua
+++ b/xmake/platforms/linux/check.lua
@@ -24,7 +24,7 @@
-- imports
import("detect.sdks.find_cross_toolchain")
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
-- check the architecture
function __check_arch(config)
diff --git a/xmake/platforms/macosx/check.lua b/xmake/platforms/macosx/check.lua
index c85d408e7..1a6f4d1ef 100644
--- a/xmake/platforms/macosx/check.lua
+++ b/xmake/platforms/macosx/check.lua
@@ -23,7 +23,7 @@
--
-- imports
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
-- get toolchains
function _toolchains(config)
@@ -156,7 +156,7 @@ function main(kind, toolkind)
-- init the check list of global
_g.global =
{
- checker.check_xcode
+ { checker.check_xcode, true }
, checker.check_cuda
}
diff --git a/xmake/platforms/mingw/check.lua b/xmake/platforms/mingw/check.lua
index bdf87b715..085d207ea 100644
--- a/xmake/platforms/mingw/check.lua
+++ b/xmake/platforms/mingw/check.lua
@@ -24,7 +24,7 @@
-- imports
import("detect.sdks.find_cross_toolchain")
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
-- get toolchains
function _toolchains(config)
diff --git a/xmake/platforms/watchos/check.lua b/xmake/platforms/watchos/check.lua
index d38639f01..b9c943210 100644
--- a/xmake/platforms/watchos/check.lua
+++ b/xmake/platforms/watchos/check.lua
@@ -23,7 +23,7 @@
--
-- imports
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
-- get toolchains
function _toolchains(config)
@@ -96,7 +96,7 @@ function main(kind, toolkind)
-- init the check list of global
_g.global =
{
- checker.check_xcode
+ { checker.check_xcode, true }
}
-- check it
diff --git a/xmake/platforms/windows/check.lua b/xmake/platforms/windows/check.lua
index c0100e249..4bcc123e0 100644
--- a/xmake/platforms/windows/check.lua
+++ b/xmake/platforms/windows/check.lua
@@ -23,7 +23,7 @@
--
-- imports
-import(".checker")
+import("platforms.checker", {rootdir = os.programdir()})
import("environment")
import("core.base.option")
import("detect.sdks.find_vstudio")