summaryrefslogtreecommitdiff
path: root/xmake/toolchains/xcode
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-17 10:59:28 +0800
committerGitHub <[email protected]>2020-12-17 10:59:28 +0800
commite95f99d7d99daf3c065dd04d457b2a8a81545380 (patch)
tree72816b1c749dd12e31da06b9b9d97ffc8d057866 /xmake/toolchains/xcode
parent37521d4aa857d57773b0f6cb9311856d3787c6f5 (diff)
parent98a044d2947d070d035fe76c651fdbf9f0c3b135 (diff)
Merge pull request #1141 from xmake-io/toolchain
Improve toolchain
Diffstat (limited to 'xmake/toolchains/xcode')
-rw-r--r--xmake/toolchains/xcode/check.lua49
-rw-r--r--xmake/toolchains/xcode/load_iphoneos.lua4
-rw-r--r--xmake/toolchains/xcode/load_macosx.lua4
-rw-r--r--xmake/toolchains/xcode/load_watchos.lua4
4 files changed, 42 insertions, 19 deletions
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua
index 579def16c..7bd6eca84 100644
--- a/xmake/toolchains/xcode/check.lua
+++ b/xmake/toolchains/xcode/check.lua
@@ -27,13 +27,38 @@ import("detect.sdks.find_xcode")
function main(toolchain)
-- find xcode
- local xcode = find_xcode(config.get("xcode"), {force = not optional, verbose = true, plat = toolchain:plat(), arch = toolchain:arch()})
- if xcode then
- config.set("xcode", xcode.sdkdir, {force = true, readonly = true})
- else
+ local xcode_sdkver = toolchain:config("xcode_sdkver") or config.get("xcode_sdkver")
+ local xcode = find_xcode(config.get("xcode"), {force = true, verbose = true,
+ find_codesign = toolchain:global(),
+ sdkver = xcode_sdkver,
+ plat = toolchain:plat(),
+ arch = toolchain:arch()})
+ if not xcode then
+ cprint("checking for Xcode directory ... ${color.nothing}${text.nothing}")
return false
end
+ -- xcode found
+ xcode_sdkver = xcode.sdkver
+ if toolchain:global() then
+ config.set("xcode", xcode.sdkdir, {force = true, readonly = true})
+ config.set("xcode_mobile_provision", xcode.mobile_provision, {force = true, readonly = true})
+ config.set("xcode_codesign_identity", xcode.codesign_identity, {force = true, readonly = true})
+ cprint("checking for Xcode directory ... ${color.success}%s", xcode.sdkdir)
+ if xcode.codesign_identity then
+ cprint("checking for Codesign Identity of Xcode ... ${color.success}%s", xcode.codesign_identity)
+ else
+ cprint("checking for Codesign Identity of Xcode ... ${color.nothing}${text.nothing}")
+ end
+ if toolchain:is_plat("iphoneos") then
+ if xcode.mobile_provision then
+ cprint("checking for Mobile Provision of Xcode ... ${color.success}%s", xcode.mobile_provision)
+ else
+ cprint("checking for Mobile Provision of Xcode ... ${color.nothing}${text.nothing}")
+ end
+ end
+ end
+
-- save target minver
--
-- @note we need to differentiate the version for the system,
@@ -44,14 +69,7 @@ function main(toolchain)
-- target("test")
-- set_toolchains("xcode", {plat = os.host(), arch = os.arch()})
--
- local xcode_sdkver = toolchain:is_plat(config.plat()) and config.get("xcode_sdkver")
- if not xcode_sdkver then
- xcode_sdkver = config.get("xcode_sdkver_" .. toolchain:plat())
- end
- local target_minver = toolchain:is_plat(config.plat()) and config.get("target_minver")
- if not target_minver then
- target_minver = config.get("target_minver_" .. toolchain:plat())
- end
+ local target_minver = toolchain:config("target_minver") and config.get("target_minver")
if xcode_sdkver and not target_minver then
target_minver = xcode_sdkver
if toolchain:is_plat("macosx") then
@@ -61,6 +79,11 @@ function main(toolchain)
end
end
end
- config.set("target_minver_" .. toolchain:plat(), target_minver)
+ toolchain:config_set("xcode", xcode.sdkdir)
+ toolchain:config_set("xcode_sdkver", xcode_sdkver)
+ toolchain:config_set("target_minver", target_minver)
+ toolchain:configs_save()
+ cprint("checking for SDK version of Xcode for %s (%s) ... ${color.success}%s", toolchain:plat(), toolchain:arch(), xcode_sdkver)
+ cprint("checking for Minimal target version of Xcode for %s (%s) ... ${color.success}%s", toolchain:plat(), toolchain:arch(), target_minver)
return true
end
diff --git a/xmake/toolchains/xcode/load_iphoneos.lua b/xmake/toolchains/xcode/load_iphoneos.lua
index cbae31f91..e399f290a 100644
--- a/xmake/toolchains/xcode/load_iphoneos.lua
+++ b/xmake/toolchains/xcode/load_iphoneos.lua
@@ -32,7 +32,7 @@ function main(toolchain)
local platname = simulator and "iPhoneSimulator" or "iPhoneOS"
-- init target minimal version
- local target_minver = config.get("target_minver_iphoneos")
+ local target_minver = toolchain:config("target_minver")
if target_minver and tonumber(target_minver) > 10 and (arch == "armv7" or arch == "armv7s" or arch == "i386") then
target_minver = "10" -- iOS 10 is the maximum deployment target for 32-bit targets
end
@@ -40,7 +40,7 @@ function main(toolchain)
-- init the xcode sdk directory
local xcode_dir = config.get("xcode")
- local xcode_sdkver = config.get("xcode_sdkver_iphoneos")
+ local xcode_sdkver = toolchain:config("xcode_sdkver")
local xcode_sdkdir = format("%s/Contents/Developer/Platforms/%s.platform/Developer/SDKs/%s%s.sdk", xcode_dir, platname, platname, xcode_sdkver)
-- init flags for c/c++
diff --git a/xmake/toolchains/xcode/load_macosx.lua b/xmake/toolchains/xcode/load_macosx.lua
index 8b5241b45..86bd03252 100644
--- a/xmake/toolchains/xcode/load_macosx.lua
+++ b/xmake/toolchains/xcode/load_macosx.lua
@@ -26,11 +26,11 @@ function main(toolchain)
-- init flags for architecture
local arch = toolchain:arch()
- local target_minver = config.get("target_minver_macosx")
+ local target_minver = toolchain:config("target_minver")
-- init flags for the xcode sdk directory
local xcode_dir = config.get("xcode")
- local xcode_sdkver = config.get("xcode_sdkver_macosx")
+ local xcode_sdkver = toolchain:config("xcode_sdkver")
local xcode_sdkdir = nil
if xcode_dir and xcode_sdkver then
xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" .. xcode_sdkver .. ".sdk"
diff --git a/xmake/toolchains/xcode/load_watchos.lua b/xmake/toolchains/xcode/load_watchos.lua
index 6efa6f547..08121277e 100644
--- a/xmake/toolchains/xcode/load_watchos.lua
+++ b/xmake/toolchains/xcode/load_watchos.lua
@@ -32,12 +32,12 @@ function main(toolchain)
local platname = simulator and "WatchSimulator" or "WatchOS"
-- init target minimal version
- local target_minver = config.get("target_minver_watchos")
+ local target_minver = toolchain:config("target_minver")
local target_minver_flags = (simulator and "-mwatchos-simulator-version-min=" or "-mwatchos-version-min=") .. target_minver
-- init the xcode sdk directory
local xcode_dir = config.get("xcode")
- local xcode_sdkver = config.get("xcode_sdkver_watchos")
+ local xcode_sdkver = toolchain:config("xcode_sdkver")
local xcode_sdkdir = format("%s/Contents/Developer/Platforms/%s.platform/Developer/SDKs/%s%s.sdk", xcode_dir, platname, platname, xcode_sdkver)
-- init flags for c/c++