summaryrefslogtreecommitdiff
path: root/xmake/modules/lib/detect/check_cxsnippets.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-03-21 00:51:10 +0800
committerruki <[email protected]>2023-03-21 00:51:10 +0800
commita5fc88daed1349f4d3f0f6609e326231e2d213d8 (patch)
treec5b0c496704de7f45ca79f3f4ca7fd833fc7af84 /xmake/modules/lib/detect/check_cxsnippets.lua
parentf814c64fc110a1d2c6b1fb4aec6f8b16778058b6 (diff)
add check_msnippets
Diffstat (limited to 'xmake/modules/lib/detect/check_cxsnippets.lua')
-rw-r--r--xmake/modules/lib/detect/check_cxsnippets.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/xmake/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua
index 32de0bee4..08055c3d8 100644
--- a/xmake/modules/lib/detect/check_cxsnippets.lua
+++ b/xmake/modules/lib/detect/check_cxsnippets.lua
@@ -149,7 +149,7 @@ end
-- @param snippets the snippets
-- @param opt the argument options
-- e.g.
--- { verbose = false, target = [target|option], sourcekind = "[cc|cxx]"
+-- { verbose = false, target = [target|option], sourcekind = "[cc|cxx|mm|mxx]"
-- , types = {"wchar_t", "char*"}, includes = "stdio.h", funcs = {"sigsetjmp", "sigsetjmp((void*)0, 0)"}
-- , configs = {defines = "xx", cxflags = ""}
-- , tryrun = true, output = true}
@@ -219,8 +219,9 @@ function main(snippets, opt)
-- get c/c++ extension
local extension = ".c"
- if opt.sourcekind then
- extension = table.wrap(language.sourcekinds()[opt.sourcekind])[1] or ".c"
+ local sourcekind = opt.sourcekind
+ if sourcekind then
+ extension = table.wrap(language.sourcekinds()[sourcekind])[1] or ".c"
end
-- make the source file
@@ -271,7 +272,16 @@ function main(snippets, opt)
-- trace
if opt.verbose or option.get("verbose") or option.get("diagnosis") then
- local kind = opt.sourcekind == "cc" and "c" or "c++"
+ local kind = "c"
+ if sourcekind == "cxx" then
+ kind = "c++"
+ elseif sourcekind == "mxx" then
+ kind = "objc++"
+ elseif sourcekind == "cc" then
+ kind = "c"
+ elseif sourcekind == "mm" then
+ kind = "objc"
+ end
if #includes > 0 then
cprint("${dim}> checking for %s includes(%s)", kind, table.concat(includes, ", "))
end