summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-19 23:04:04 +0800
committerruki <[email protected]>2020-06-19 12:24:29 +0800
commitca1bd50cc1e0b5939311ac73c61180957763cbbc (patch)
treecbcb328543c2d58041d8902dd8f74871aa98898a
parent92dd2db73694ab13671db73194ab1e9fae1b9371 (diff)
support to set plat/arch for target/toolchains
-rw-r--r--xmake/core/sandbox/modules/import/core/project/config.lua17
-rw-r--r--xmake/core/tool/tool.lua2
-rw-r--r--xmake/modules/detect/sdks/find_xcode.lua4
3 files changed, 19 insertions, 4 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua
index 3ea6d3a30..20fec1d4f 100644
--- a/xmake/core/sandbox/modules/import/core/project/config.lua
+++ b/xmake/core/sandbox/modules/import/core/project/config.lua
@@ -23,6 +23,7 @@ local sandbox_core_project_config = sandbox_core_project_config or {}
-- load modules
local config = require("project/config")
+local project = require("project/project")
local platform = require("platform/platform")
local raise = require("sandbox/modules/raise")
@@ -113,7 +114,7 @@ end
-- check the configuration
function sandbox_core_project_config.check()
- -- get the current platform
+ -- check configuration for the current platform
local instance, errors = platform.load()
if instance then
local ok, errors = instance:check()
@@ -123,6 +124,20 @@ function sandbox_core_project_config.check()
else
raise(errors)
end
+
+ -- check toolchains configuration for all target in the current project
+ local targets = project.targets()
+ if targets then
+ for _, target in pairs(targets) do
+ if target:get("enabled") ~= false and target:get("toolchains") then
+ for _, toolchain_inst in pairs(target:toolchains()) do
+ if not toolchain_inst:check() then
+ raise("toolchain(\"%s\"): not found!", toolchain_inst:name())
+ end
+ end
+ end
+ end
+ end
end
-- dump the configuration
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index 9e6dec6d4..5736ded22 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -39,7 +39,7 @@ function _instance.new(kind, name, program)
-- import "core.tools.xxx"
local toolclass = nil
if os.isfile(path.join(os.programdir(), "modules", "core", "tools", name .. ".lua")) then
- toolclass = import("core.tools." .. name)
+ toolclass = import("core.tools." .. name, {nocache = true}) -- @note we need create a tool instance with unique toolclass context (_g)
end
-- not found?
diff --git a/xmake/modules/detect/sdks/find_xcode.lua b/xmake/modules/detect/sdks/find_xcode.lua
index d7eb2ddd7..3b33ab955 100644
--- a/xmake/modules/detect/sdks/find_xcode.lua
+++ b/xmake/modules/detect/sdks/find_xcode.lua
@@ -148,7 +148,7 @@ function main(sdkdir, opt)
local arch = opt.arch or config.get("arch") or "x86_64"
-- find xcode
- local xcode = _find_xcode(sdkdir or config.get("xcode") or global.get("xcode") or config.get("sdk"), opt.sdkver or config.get("xcode_sdkver"), plat, arch)
+ local xcode = _find_xcode(sdkdir or config.get("xcode") or global.get("xcode"), opt.sdkver or config.get("xcode_sdkver"), plat, arch)
if xcode and xcode.sdkdir then
-- save to config
@@ -166,7 +166,7 @@ function main(sdkdir, opt)
else
cprint("checking for the Codesign Identity of Xcode ... ${color.nothing}${text.nothing}")
end
- if is_plat("iphoneos") then
+ if plat == "iphoneos" then
if xcode.mobile_provision then
cprint("checking for the Mobile Provision of Xcode ... ${color.success}%s", xcode.mobile_provision)
else