summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-11 00:06:24 +0800
committerruki <[email protected]>2026-02-11 00:06:24 +0800
commitf9a18b3ce8bac2a91f0975d2965d07b724524923 (patch)
tree30869204b5070532e1447d3e2cec17fa224e0adf
parentee98b61be7054e1b8b8e2668b67c662ba12e264b (diff)
improve check tips
-rw-r--r--xmake/modules/detect/sdks/find_android_sdk.lua9
-rw-r--r--xmake/modules/detect/sdks/find_mingw.lua4
-rw-r--r--xmake/modules/detect/sdks/find_ndk.lua9
-rw-r--r--xmake/modules/private/detect/find_platform.lua11
-rw-r--r--xmake/toolchains/llvm/check.lua28
-rw-r--r--xmake/toolchains/xcode/check.lua67
6 files changed, 87 insertions, 41 deletions
diff --git a/xmake/modules/detect/sdks/find_android_sdk.lua b/xmake/modules/detect/sdks/find_android_sdk.lua
index 24ea02c4c..c493ae6c7 100644
--- a/xmake/modules/detect/sdks/find_android_sdk.lua
+++ b/xmake/modules/detect/sdks/find_android_sdk.lua
@@ -110,14 +110,17 @@ function main(sdkdir, opt)
-- trace
if opt.verbose or option.get("verbose") then
- cprint("checking for Android SDK directory ... ${color.success}%s", sdk.sdkdir)
- cprint("checking for Build Tools Version of Android SDK ... ${color.success}%s", sdk.build_toolver)
+ local extra = ""
+ if sdk.build_toolver then
+ extra = " (buildtools: " .. sdk.build_toolver .. ")"
+ end
+ cprint("checking for Android SDK ... ${color.success}%s%s", sdk.sdkdir, extra)
end
else
-- trace
if opt.verbose or option.get("verbose") then
- cprint("checking for Android SDK directory ... ${color.nothing}${text.nothing}")
+ cprint("checking for Android SDK ... ${color.nothing}${text.nothing}")
end
end
diff --git a/xmake/modules/detect/sdks/find_mingw.lua b/xmake/modules/detect/sdks/find_mingw.lua
index 1d1c1fab1..bdf97983f 100644
--- a/xmake/modules/detect/sdks/find_mingw.lua
+++ b/xmake/modules/detect/sdks/find_mingw.lua
@@ -152,11 +152,11 @@ function main(sdkdir, opt)
if mingw and mingw.sdkdir then
config.set("mingw", mingw.sdkdir, {force = true, readonly = true})
if opt.verbose or option.get("verbose") then
- cprint("checking for mingw directory ... ${color.success}%s (%s)", mingw.sdkdir, mingw.cross)
+ cprint("checking for Mingw SDK ... ${color.success}%s (%s)", mingw.sdkdir, mingw.cross)
end
else
if opt.verbose or option.get("verbose") then
- cprint("checking for mingw directory ... ${color.nothing}${text.nothing}")
+ cprint("checking for Mingw SDK ... ${color.nothing}${text.nothing}")
end
end
diff --git a/xmake/modules/detect/sdks/find_ndk.lua b/xmake/modules/detect/sdks/find_ndk.lua
index 43d822845..628a76c41 100644
--- a/xmake/modules/detect/sdks/find_ndk.lua
+++ b/xmake/modules/detect/sdks/find_ndk.lua
@@ -302,12 +302,15 @@ function main(sdkdir, opt)
config.set("ndk_sdkver", ndk.sdkver, {force = true, readonly = true})
config.set("ndk_toolchains_ver", ndk.toolchains_ver, {force = true, readonly = true})
if opt.verbose or option.get("verbose") then
- cprint("checking for NDK directory ... ${color.success}%s", ndk.sdkdir)
- cprint("checking for SDK version of NDK ... ${color.success}%s", ndk.sdkver)
+ local extra = ""
+ if ndk.sdkver then
+ extra = " (sdk: " .. ndk.sdkver .. ")"
+ end
+ cprint("checking for Android NDK ... ${color.success}%s%s", ndk.sdkdir, extra)
end
else
if opt.verbose or option.get("verbose") then
- cprint("checking for NDK directory ... ${color.nothing}${text.nothing}")
+ cprint("checking for Android NDK ... ${color.nothing}${text.nothing}")
end
end
diff --git a/xmake/modules/private/detect/find_platform.lua b/xmake/modules/private/detect/find_platform.lua
index 6df2da9fe..a94b5ade3 100644
--- a/xmake/modules/private/detect/find_platform.lua
+++ b/xmake/modules/private/detect/find_platform.lua
@@ -145,19 +145,26 @@ function main(opt)
-- find platform
opt = opt or {}
local plat = _find_plat(opt.plat)
+ local will_set_plat = false
if opt.global then
if not opt.plat and not config.get("plat") then
+ will_set_plat = true
config.set("plat", plat)
- cprint("checking for platform ... ${color.success}%s", plat)
end
end
-- find architecture
local arch = _find_arch(plat, opt.arch)
+ local will_set_arch = false
if opt.global then
if not opt.arch and not config.get("arch") then
+ will_set_arch = true
config.set("arch", arch)
- cprint("checking for architecture ... ${color.success}%s", arch)
+ end
+ end
+ if opt.global then
+ if will_set_plat or will_set_arch then
+ cprint("checking for platform ... ${color.success}%s (%s)", plat, arch)
end
end
return plat, arch
diff --git a/xmake/toolchains/llvm/check.lua b/xmake/toolchains/llvm/check.lua
index 74cc96a7f..24bb229a7 100644
--- a/xmake/toolchains/llvm/check.lua
+++ b/xmake/toolchains/llvm/check.lua
@@ -25,6 +25,26 @@ import("lib.detect.find_tool")
import("detect.sdks.find_xcode")
import("detect.sdks.find_cross_toolchain")
+-- print Xcode SDK summary (single line)
+function _show_checkinfo(toolchain, xcode_sdkdir, xcode_sdkver, target_minver)
+ if xcode_sdkdir then
+ local extras = {}
+ if xcode_sdkver then
+ table.insert(extras, "sdk: " .. xcode_sdkver)
+ end
+ if target_minver then
+ table.insert(extras, "target: " .. target_minver)
+ end
+ local extra = ""
+ if #extras > 0 then
+ extra = " (" .. table.concat(extras, ", ") .. ")"
+ end
+ cprint("checking for Xcode SDK ... ${color.success}%s%s", xcode_sdkdir, extra)
+ else
+ cprint("checking for Xcode SDK ... ${color.nothing}${text.nothing}")
+ end
+end
+
-- find xcode on macos
function _find_xcode(toolchain)
@@ -44,7 +64,7 @@ function _find_xcode(toolchain)
plat = toolchain:plat(),
arch = toolchain:arch()})
if not xcode then
- cprint("checking for Xcode directory ... ${color.nothing}${text.nothing}")
+ cprint("checking for Xcode SDK ... ${color.nothing}${text.nothing}")
return
end
@@ -52,7 +72,6 @@ function _find_xcode(toolchain)
xcode_sdkver = xcode.sdkver
if toolchain:is_global() then
config.set("xcode", xcode.sdkdir, {force = true, readonly = true})
- cprint("checking for Xcode directory ... ${color.success}%s", xcode.sdkdir)
end
local target_minver = toolchain:config("target_minver") or config.get("target_minver")
if xcode_sdkver and not target_minver then
@@ -62,7 +81,9 @@ function _find_xcode(toolchain)
toolchain:config_set("xcode_sdkver", xcode_sdkver)
toolchain:config_set("target_minver", target_minver)
toolchain:config_set("appledev", appledev)
- cprint("checking for SDK version of Xcode for %s (%s) ... ${color.success}%s", toolchain:plat(), toolchain:arch(), xcode_sdkver)
+ if toolchain:is_global() then
+ _show_checkinfo(toolchain, xcode.sdkdir, xcode_sdkver, target_minver)
+ end
end
-- check the cross toolchain
@@ -130,4 +151,3 @@ function main(toolchain)
end
return cross_toolchain
end
-
diff --git a/xmake/toolchains/xcode/check.lua b/xmake/toolchains/xcode/check.lua
index 9e172af8d..5797170f5 100644
--- a/xmake/toolchains/xcode/check.lua
+++ b/xmake/toolchains/xcode/check.lua
@@ -25,6 +25,43 @@ import("detect.sdks.find_xcode")
import("private.utils.executable_path")
import("private.tools.codesign")
+-- print Xcode SDK summary (single line) and optional codesign infos
+function _show_checkinfo(toolchain, xcode, xcode_sdkver, target_minver)
+ if xcode and xcode.sdkdir then
+ local extras = {}
+ if xcode_sdkver then
+ table.insert(extras, "sdk: " .. xcode_sdkver)
+ end
+ if target_minver then
+ table.insert(extras, "target: " .. target_minver)
+ end
+ local extra = ""
+ if #extras > 0 then
+ extra = " (" .. table.concat(extras, ", ") .. ")"
+ end
+ cprint("checking for Xcode SDK ... ${color.success}%s%s", xcode.sdkdir, extra)
+ else
+ cprint("checking for Xcode SDK ... ${color.nothing}${text.nothing}")
+ end
+
+ if option.get("verbose") then
+ local codesign_identity = codesign.xcode_codesign_identity()
+ if codesign_identity then
+ cprint("checking for Codesign Identity of Xcode ... ${color.success}%s", codesign_identity)
+ else
+ cprint("checking for Codesign Identity of Xcode ... ${color.nothing}${text.nothing}")
+ end
+ if toolchain:is_plat("iphoneos") then
+ local mobile_provision = codesign.xcode_mobile_provision()
+ if mobile_provision then
+ cprint("checking for Mobile Provision of Xcode ... ${color.success}%s", mobile_provision)
+ else
+ cprint("checking for Mobile Provision of Xcode ... ${color.nothing}${text.nothing}")
+ end
+ end
+ end
+end
+
-- main entry
function main(toolchain)
@@ -47,7 +84,7 @@ function main(toolchain)
plat = toolchain:plat(),
arch = toolchain:arch()})
if not xcode then
- cprint("checking for Xcode directory ... ${color.nothing}${text.nothing}")
+ cprint("checking for Xcode SDK ... ${color.nothing}${text.nothing}")
return false
end
@@ -55,27 +92,6 @@ function main(toolchain)
xcode_sdkver = xcode.sdkver
if toolchain:is_global() then
config.set("xcode", xcode.sdkdir, {force = true, readonly = true})
- if xcode.sdkdir then
- cprint("checking for Xcode directory ... ${color.success}%s", xcode.sdkdir)
- else
- cprint("checking for Xcode directory ... ${color.nothing}${text.nothing}")
- end
- if option.get("verbose") then
- local codesign_identity = codesign.xcode_codesign_identity()
- if codesign_identity then
- cprint("checking for Codesign Identity of Xcode ... ${color.success}%s", codesign_identity)
- else
- cprint("checking for Codesign Identity of Xcode ... ${color.nothing}${text.nothing}")
- end
- if toolchain:is_plat("iphoneos") then
- local mobile_provision = codesign.xcode_mobile_provision()
- if mobile_provision then
- cprint("checking for Mobile Provision of Xcode ... ${color.success}%s", mobile_provision)
- else
- cprint("checking for Mobile Provision of Xcode ... ${color.nothing}${text.nothing}")
- end
- end
- end
end
-- get xcode bin directory
@@ -152,11 +168,8 @@ function main(toolchain)
toolchain:config_set("xcode_sdkver", xcode_sdkver)
toolchain:config_set("target_minver", target_minver)
toolchain:config_set("appledev", appledev)
- if xcode_sdkver then
- cprint("checking for SDK version of Xcode for %s (%s) ... ${color.success}%s", toolchain:plat(), toolchain:arch(), xcode_sdkver)
- end
- if target_minver then
- cprint("checking for Minimal target version of Xcode for %s (%s) ... ${color.success}%s", toolchain:plat(), toolchain:arch(), target_minver)
+ if toolchain:is_global() then
+ _show_checkinfo(toolchain, xcode, xcode_sdkver, target_minver)
end
return true
end