summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2017-08-10 09:05:03 +0800
committerruki <[email protected]>2017-08-10 09:05:03 +0800
commit3a1d05fd170148a6ae6342bda2e077431bb7570a (patch)
treed1b16fde057219e6934e45d0c103db75ee695f88
parent467e97b99dc9b16dd3db3a5ad743ea954185d497 (diff)
improve add_files and compile speed
-rw-r--r--CHANGELOG.md12
-rw-r--r--xmake/actions/build/kinds/object.lua22
-rw-r--r--xmake/core/base/interpreter.lua84
-rw-r--r--xmake/core/project/target.lua37
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/compiler.lua10
-rw-r--r--xmake/core/sandbox/modules/import/core/tool/linker.lua2
-rw-r--r--xmake/core/tool/builder.lua113
-rw-r--r--xmake/core/tool/compiler.lua88
-rw-r--r--xmake/core/tool/linker.lua37
-rw-r--r--xmake/modules/lib/detect/check_cxsnippets.lua3
-rw-r--r--xmake/modules/lib/detect/has_cfuncs.lua2
-rw-r--r--xmake/modules/lib/detect/has_cincludes.lua2
-rw-r--r--xmake/modules/lib/detect/has_ctypes.lua2
-rw-r--r--xmake/modules/lib/detect/has_cxxfuncs.lua2
-rw-r--r--xmake/modules/lib/detect/has_cxxincludes.lua2
-rw-r--r--xmake/modules/lib/detect/has_cxxtypes.lua2
16 files changed, 297 insertions, 123 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a8ffaf46..91260b983 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
## master (unreleased)
+### Changes
+
+* Improve `add_files` to configure the compile option of the given files
+
+## v2.1.5
+
### New features
* [#83](https://github.com/tboox/xmake/issues/83): Add `add_csnippet` and `add_cxxsnippet` into `option` for detecting some compiler features.
@@ -320,6 +326,12 @@
## master (开发中)
+### 改进
+
+* 改进`add_files`,支持对files粒度进行编译选项的各种配置,更加灵活。
+
+## v2.1.5
+
### 新特性
* [#83](https://github.com/tboox/xmake/issues/83): 添加 `add_csnippet`,`add_cxxsnippet`到`option`来检测一些编译器特性
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua
index bd479a879..7ed363c38 100644
--- a/xmake/actions/build/kinds/object.lua
+++ b/xmake/actions/build/kinds/object.lua
@@ -31,7 +31,7 @@ import("core.language.language")
import("detect.tools.find_ccache")
-- is modified?
-function _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, compiler_instance)
+function _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, program, compflags)
-- rebuild?
if buildinfo.rebuild then
@@ -72,12 +72,12 @@ function _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, compil
end
-- the program has been modified?
- if compiler_instance:program() ~= depinfo.program then
+ if program ~= depinfo.program then
return true
end
-- the flags has been modified?
- return os.args(compiler_instance:compflags({target = target})) ~= os.args(depinfo.flags)
+ return os.args(compflags) ~= os.args(depinfo.flags)
end
-- build the object from the *.[o|obj] source file
@@ -153,8 +153,14 @@ function _build_object(target, buildinfo, index, sourcebatch, ccache)
-- load compiler instance
local compiler_instance = compiler.load(sourcekind)
+ -- get compiler program
+ local program = compiler_instance:program()
+
+ -- get compile flags
+ local compflags = compiler_instance:compflags({target = target, sourcefile = sourcefile})
+
-- is modified?
- local modified = _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, compiler_instance)
+ local modified = _is_modified(target, sourcefile, objectfile, depinfo, buildinfo, program, compflags)
if not modified then
return
end
@@ -174,20 +180,20 @@ function _build_object(target, buildinfo, index, sourcebatch, ccache)
-- trace verbose info
if verbose then
- print(compiler_instance:compcmd(sourcefile, objectfile, {target = target}))
+ print(compiler_instance:compcmd(sourcefile, objectfile, {compflags = compflags}))
end
-- complie it
- assert(compiler_instance:compile(sourcefile, objectfile, {depinfo = depinfo, target = target}))
+ assert(compiler_instance:compile(sourcefile, objectfile, {depinfo = depinfo, compflags = compflags}))
-- save sources to the dependent info
depinfo.sources = table.join(sourcefile, target:pcheaderfile("cxx") or {}, target:pcheaderfile("c"))
-- save program to the dependent info
- depinfo.program = compiler_instance:program()
+ depinfo.program = program
-- save flags to the dependent info
- depinfo.flags = compiler_instance:compflags({target = target})
+ depinfo.flags = compflags
-- save the dependent info
io.save(incdepfile, depinfo)
diff --git a/xmake/core/base/interpreter.lua b/xmake/core/base/interpreter.lua
index 28d4994c7..d8831154f 100644
--- a/xmake/core/base/interpreter.lua
+++ b/xmake/core/base/interpreter.lua
@@ -1068,12 +1068,27 @@ function interpreter:api_register_set_values(scope_kind, ...)
-- define implementation
local implementation = function (self, scope, name, ...)
+
+ -- get extra config
local values = {...}
- if table.is_dictionary(values[#values]) then
- scope["__extra_" .. name] = values[#values] -- save extra info
+ local extra_config = values[#values]
+ if table.is_dictionary(extra_config) then
table.remove(values)
+ else
+ extra_config = nil
end
+
+ -- save values
scope[name] = values
+
+ -- save extra config
+ if extra_config then
+ scope["__extra_" .. name] = scope["__extra_" .. name] or {}
+ local extrascope = scope["__extra_" .. name]
+ for _, value in ipairs(values) do
+ extrascope[value] = extra_config
+ end
+ end
end
-- register implementation
@@ -1088,12 +1103,27 @@ function interpreter:api_register_add_values(scope_kind, ...)
-- define implementation
local implementation = function (self, scope, name, ...)
+
+ -- get extra config
local values = {...}
- if table.is_dictionary(values[#values]) then
- scope["__extra_" .. name] = table.join2(scope["__extra_" .. name] or {}, values[#values]) -- save extra info
+ local extra_config = values[#values]
+ if table.is_dictionary(extra_config) then
table.remove(values)
+ else
+ extra_config = nil
end
+
+ -- save values
scope[name] = table.join2(scope[name] or {}, values)
+
+ -- save extra config
+ if extra_config then
+ scope["__extra_" .. name] = scope["__extra_" .. name] or {}
+ local extrascope = scope["__extra_" .. name]
+ for _, value in ipairs(values) do
+ extrascope[value] = extra_config
+ end
+ end
end
-- register implementation
@@ -1261,12 +1291,29 @@ function interpreter:api_register_set_pathes(scope_kind, ...)
-- define implementation
local implementation = function (self, scope, name, ...)
+ -- get extra config
local values = {...}
- if table.is_dictionary(values[#values]) then
- scope["__extra_" .. name] = values[#values] -- save extra info
+ local extra_config = values[#values]
+ if table.is_dictionary(extra_config) then
table.remove(values)
+ else
+ extra_config = nil
+ end
+
+ -- translate pathes
+ local pathes = self:_api_translate_pathes(values)
+
+ -- save values
+ scope[name] = pathes
+
+ -- save extra config
+ if extra_config then
+ scope["__extra_" .. name] = scope["__extra_" .. name] or {}
+ local extrascope = scope["__extra_" .. name]
+ for _, value in ipairs(pathes) do
+ extrascope[value] = extra_config
+ end
end
- scope[name] = self:_api_translate_pathes(values)
end
-- register implementation
@@ -1282,12 +1329,29 @@ function interpreter:api_register_add_pathes(scope_kind, ...)
-- define implementation
local implementation = function (self, scope, name, ...)
+ -- get extra config
local values = {...}
- if table.is_dictionary(values[#values]) then
- scope["__extra_" .. name] = table.join2(scope["__extra_" .. name] or {}, values[#values]) -- save extra info
+ local extra_config = values[#values]
+ if table.is_dictionary(extra_config) then
table.remove(values)
+ else
+ extra_config = nil
+ end
+
+ -- translate pathes
+ local pathes = self:_api_translate_pathes(values)
+
+ -- save values
+ scope[name] = table.join2(scope[name] or {}, pathes)
+
+ -- save extra config
+ if extra_config then
+ scope["__extra_" .. name] = scope["__extra_" .. name] or {}
+ local extrascope = scope["__extra_" .. name]
+ for _, value in ipairs(pathes) do
+ extrascope[value] = extra_config
+ end
end
- scope[name] = table.join2(scope[name] or {}, self:_api_translate_pathes(values))
end
-- register implementation
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 0e7c8fbcf..eac740619 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -278,6 +278,40 @@ function target:headerdir()
return self:get("headerdir") or config.get("buildir")
end
+-- get the config info of the given source file
+function target:fileconfig(sourcefile)
+
+ -- get files config
+ local filesconfig = self._FILESCONFIG
+ if not filesconfig then
+ filesconfig = {}
+ for filepath, fileconfig in pairs(table.wrap(self:get("__extra_files"))) do
+
+ -- match source files
+ local results = os.match(filepath)
+ if #results == 0 then
+ utils.warning("cannot match add_files(\"%s\")", filepath)
+ end
+
+ -- process source files
+ for _, file in ipairs(results) do
+
+ -- convert to the relative path
+ if path.is_absolute(file) then
+ file = path.relative(file, os.projectdir())
+ end
+
+ -- save it
+ filesconfig[file] = fileconfig
+ end
+ end
+ self._FILESCONFIG = filesconfig
+ end
+
+ -- get file config
+ return filesconfig[sourcefile]
+end
+
-- get the source files
function target:sourcefiles()
@@ -669,9 +703,10 @@ function target:configprefix()
-- get the config prefix
local configprefix = nil
+ local configheader = self:get("config_header")
local configheader_extra = self:get("__extra_config_header")
if type(configheader_extra) == "table" then
- configprefix = configheader_extra.prefix
+ configprefix = table.wrap(configheader_extra[configheader]).prefix
end
if not configprefix then
configprefix = self:get("config_h_prefix") or (self:name():upper() .. "_CONFIG")
diff --git a/xmake/core/sandbox/modules/import/core/tool/compiler.lua b/xmake/core/sandbox/modules/import/core/tool/compiler.lua
index 35adf8413..f629c4ec6 100644
--- a/xmake/core/sandbox/modules/import/core/tool/compiler.lua
+++ b/xmake/core/sandbox/modules/import/core/tool/compiler.lua
@@ -116,12 +116,20 @@ end
--
-- @param sourcefiles the source files
-- @param opt the argument options (contain all the compiler attributes of target),
--- .e.g {target = ..., targetkind = "static", cxflags = "", defines = "", includedirs = "", ...}
+-- .e.g {target = ..., targetkind = "static", config = {cxflags = "", defines = "", includedirs = "", ...}}
--
-- @return the flags list
--
function sandbox_core_tool_compiler.compflags(sourcefiles, opt)
+ -- init options
+ opt = opt or {}
+
+ -- patch sourcefile to get flags of the given source file
+ if type(sourcefiles) == "string" then
+ opt.sourcefile = sourcefiles
+ end
+
-- get source kind if only one source file
local sourcekind = opt.sourcekind
if not sourcekind and type(sourcefiles) == "string" then
diff --git a/xmake/core/sandbox/modules/import/core/tool/linker.lua b/xmake/core/sandbox/modules/import/core/tool/linker.lua
index 2181594ac..e80102457 100644
--- a/xmake/core/sandbox/modules/import/core/tool/linker.lua
+++ b/xmake/core/sandbox/modules/import/core/tool/linker.lua
@@ -66,7 +66,7 @@ end
-- @param targetkind the target kind
-- @param sourcekinds the source kinds
-- @param opt the argument options (contain all the linker attributes of target),
--- .e.g {target = ..., targetkind = "static", cxflags = "", defines = "", includedirs = "", ...}
+-- .e.g {target = ..., targetkind = "static", config = {cxflags = "", defines = "", includedirs = "", ...}}
--
function sandbox_core_tool_linker.linkflags(targetkind, sourcekinds, opt)
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index 8d0fdabf0..84ef22838 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -124,24 +124,52 @@ function builder:_addflags_from_config(flags)
end
end
+-- add flags from the option
+function builder:_addflags_from_option(flags, target)
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(flags, self:_mapflags(target:get(flagkind)))
+ end
+end
+
-- add flags from the target
function builder:_addflags_from_target(flags, target)
- -- add the target flags
- for _, flagkind in ipairs(self:_flagkinds()) do
- table.join2(flags, self:_mapflags(target:get(flagkind)))
+ -- no target?
+ if not target then
+ return
end
+
+ -- init cache
+ self._TARGETFLAGS = self._TARGETFLAGS or {}
+ local cache = self._TARGETFLAGS
- -- for target options?
- if target.options then
+ -- get flags from cache first
+ local key = tostring(target)
+ local targetflags = cache[key]
+ if not targetflags then
+
+ -- add the target flags
+ targetflags = {}
+ for _, flagkind in ipairs(self:_flagkinds()) do
+ table.join2(targetflags, self:_mapflags(target:get(flagkind)))
+ end
-- add the flags for the target options
- for _, opt in ipairs(target:options()) do
-
- -- add the flags from the option
- self:_addflags_from_target(flags, opt)
+ if target.options then
+ for _, opt in ipairs(target:options()) do
+ self:_addflags_from_option(targetflags, opt)
+ end
end
+
+ -- add flags (named) from language
+ self:_addflags_from_language(targetflags, target)
+
+ -- cache it
+ cache[key] = targetflags
end
+
+ -- add flags
+ table.join2(flags, targetflags)
end
-- add flags from target deps
@@ -187,17 +215,25 @@ function builder:_addflags_from_targetdeps(results, target, flagname)
end
-- add flags from the argument option
-function builder:_addflags_from_argument(flags, args)
+function builder:_addflags_from_argument(flags, target, args)
+
+ -- add flags from the flag kinds (cxflags, ..)
for _, flagkind in ipairs(self:_flagkinds()) do
table.join2(flags, self:_mapflags(args[flagkind]))
end
+
+ -- add flags (named) from the language
+ if target then
+ local key = utils.ifelse(target.options, "target", "option")
+ self:_addflags_from_language(flags, target, {[key] = function (name) return args[name] end})
+ end
end
-- add flags (named) from the language
-function builder:_addflags_from_language(flags, target)
+function builder:_addflags_from_language(flags, target, getters)
-- init getters
- local getters =
+ local getters = getters or
{
config = config.get
, platform = platform.get
@@ -237,34 +273,35 @@ function builder:_addflags_from_language(flags, target)
-- get getter
local getter = getters[flagscope]
- assert(getter)
+ if getter then
- -- get api name of tool
- --
- -- ignore "nf_" and "_if_ok"
- --
- -- .e.g
- --
- -- defines => define
- -- defines_if_ok => define
- -- ...
- --
- local apiname = flagname:gsub("^nf_", ""):gsub("_if_ok$", "")
- if apiname:endswith("s") then
- apiname = apiname:sub(1, #apiname - 1)
- end
+ -- get api name of tool
+ --
+ -- ignore "nf_" and "_if_ok"
+ --
+ -- .e.g
+ --
+ -- defines => define
+ -- defines_if_ok => define
+ -- ...
+ --
+ local apiname = flagname:gsub("^nf_", ""):gsub("_if_ok$", "")
+ if apiname:endswith("s") then
+ apiname = apiname:sub(1, #apiname - 1)
+ end
- -- map name flag to real flag
- local mapper = self:_tool()["nf_" .. apiname]
- if mapper then
-
- -- add the flags
- for _, flagvalue in ipairs(table.wrap(getter(flagname))) do
-
- -- map and check flag
- local flag = mapper(self:_tool(), flagvalue, target, self:_targetkind())
- if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then
- table.join2(flags, flag)
+ -- map name flag to real flag
+ local mapper = self:_tool()["nf_" .. apiname]
+ if mapper then
+
+ -- add the flags
+ for _, flagvalue in ipairs(table.wrap(getter(flagname))) do
+
+ -- map and check flag
+ local flag = mapper(self:_tool(), flagvalue, target, self:_targetkind())
+ if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then
+ table.join2(flags, flag)
+ end
end
end
end
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index 612018ee3..a48c42b7e 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -41,8 +41,6 @@ local platform = require("platform/platform")
-- get the language of compiler
function compiler:_language()
-
- -- get it
return self._LANGUAGE
end
@@ -130,8 +128,18 @@ function compiler:build(sourcefiles, targetfile, opt)
-- init options
opt = opt or {}
+ -- get compile flags
+ local compflags = opt.compflags
+ if not compflags then
+ -- patch sourcefile to get flags of the given source file
+ if type(sourcefiles) == "string" then
+ opt.sourcefile = sourcefiles
+ end
+ compflags = self:compflags(opt)
+ end
+
-- make flags
- local flags = self:compflags(opt)
+ local flags = compflags
if opt.target then
flags = table.join(flags, opt.target:linkflags())
end
@@ -152,8 +160,18 @@ function compiler:buildargv(sourcefiles, targetfile, opt)
-- init options
opt = opt or {}
+ -- get compile flags
+ local compflags = opt.compflags
+ if not compflags then
+ -- patch sourcefile to get flags of the given source file
+ if type(sourcefiles) == "string" then
+ opt.sourcefile = sourcefiles
+ end
+ compflags = self:compflags(opt)
+ end
+
-- make flags
- local flags = self:compflags(opt)
+ local flags = compflags
if opt.target then
flags = table.join(flags, opt.target:linkflags())
end
@@ -179,13 +197,36 @@ function compiler:compile(sourcefiles, objectfile, opt)
-- init options
opt = opt or {}
+ -- get compile flags
+ local compflags = opt.compflags
+ if not compflags then
+ -- patch sourcefile to get flags of the given source file
+ if type(sourcefiles) == "string" then
+ opt.sourcefile = sourcefiles
+ end
+ compflags = self:compflags(opt)
+ end
+
-- compile it
- return sandbox.load(self:_tool().compile, self:_tool(), sourcefiles, objectfile, opt.depinfo, self:compflags(opt))
+ return sandbox.load(self:_tool().compile, self:_tool(), sourcefiles, objectfile, opt.depinfo, compflags)
end
-- get the compile arguments list
function compiler:compargv(sourcefiles, objectfile, opt)
- return self:_tool():compargv(sourcefiles, objectfile, self:compflags(opt))
+
+ -- init options
+ opt = opt or {}
+
+ -- get compile flags
+ local compflags = opt.compflags
+ if not compflags then
+ -- patch sourcefile to get flags of the given source file
+ if type(sourcefiles) == "string" then
+ opt.sourcefile = sourcefiles
+ end
+ compflags = self:compflags(opt)
+ end
+ return self:_tool():compargv(sourcefiles, objectfile, compflags)
end
-- get the compile command
@@ -196,7 +237,8 @@ end
-- get the compling flags
--
-- @param opt the argument options (contain all the compiler attributes of target),
--- .e.g {target = ..., targetkind = "static", cxflags = "", defines = "", includedirs = "", ...}
+-- .e.g
+-- {target = ..., targetkind = "static", config = {defines = "", cxflags = "", includedirs = ""}}
--
-- @return flags string, flags list
--
@@ -208,10 +250,6 @@ function compiler:compflags(opt)
-- get target
local target = opt.target
- -- init cache
- self._COMPFLAGS = self._COMPFLAGS or {}
- local cache = self._COMPFLAGS
-
-- get target kind
local targetkind = opt.targetkind
if not targetkind and target then
@@ -222,29 +260,21 @@ function compiler:compflags(opt)
local flags = {}
self:_addflags_from_config(flags)
- -- add flags about target
- if target then
-
- -- get flags from cache first
- local key = tostring(target)
- local targetflags = cache[key]
- if not targetflags then
-
- -- add flags for the target
- targetflags = {}
- self:_addflags_from_target(targetflags, target)
-
- -- add flags (named) from language
- self:_addflags_from_language(targetflags, target)
+ -- add flags for the target
+ self:_addflags_from_target(flags, target)
- -- cache it
- cache[key] = targetflags
+ -- add flags for the source file
+ if opt.sourcefile and target and target.fileconfig then
+ local fileconfig = target:fileconfig(opt.sourcefile)
+ if fileconfig then
+ self:_addflags_from_argument(flags, target, fileconfig)
end
- table.join2(flags, targetflags)
end
-- add flags for the argument
- self:_addflags_from_argument(flags, opt)
+ if opt.config then
+ self:_addflags_from_argument(flags, target, opt.config)
+ end
-- add flags from the platform
if target then
diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua
index c9c21f262..118fbd4e3 100644
--- a/xmake/core/tool/linker.lua
+++ b/xmake/core/tool/linker.lua
@@ -179,12 +179,13 @@ end
-- link the target file
function linker:link(objectfiles, targetfile, opt)
- return sandbox.load(self:_tool().link, self:_tool(), table.wrap(objectfiles), self:_targetkind(), targetfile, self:linkflags(opt))
+ opt = opt or {}
+ return sandbox.load(self:_tool().link, self:_tool(), table.wrap(objectfiles), self:_targetkind(), targetfile, opt.linkflags or self:linkflags(opt))
end
-- get the link arguments list
function linker:linkargv(objectfiles, targetfile, opt)
- return self:_tool():linkargv(table.wrap(objectfiles), self:_targetkind(), targetfile, self:linkflags(opt))
+ return self:_tool():linkargv(table.wrap(objectfiles), self:_targetkind(), targetfile, opt.linkflags or self:linkflags(opt))
end
-- get the link command
@@ -195,7 +196,7 @@ end
-- get the link flags
--
-- @param opt the argument options (contain all the linker attributes of target),
--- .e.g {target = ..., targetkind = "static", ldflags = "", links = "", linkdirs = "", ...}
+-- .e.g {target = ..., targetkind = "static", config = {ldflags = "", links = "", linkdirs = "", ...}}
--
function linker:linkflags(opt)
@@ -205,10 +206,6 @@ function linker:linkflags(opt)
-- get target
local target = opt.target
- -- init cache
- self._COMPFLAGS = self._COMPFLAGS or {}
- local cache = self._COMPFLAGS
-
-- get target kind
local targetkind = opt.targetkind
if not targetkind and target then
@@ -219,29 +216,13 @@ function linker:linkflags(opt)
local flags = {}
self:_addflags_from_config(flags)
- -- add flags about target
- if target then
-
- -- get flags from cache first
- local key = tostring(target)
- local targetflags = cache[key]
- if not targetflags then
-
- -- add flags for the target
- targetflags = {}
- self:_addflags_from_target(targetflags, target)
-
- -- add flags (named) from language
- self:_addflags_from_language(targetflags, target)
-
- -- cache it
- cache[key] = targetflags
- end
- table.join2(flags, targetflags)
- end
+ -- add flags for the target
+ self:_addflags_from_target(flags, target)
-- add flags for the argument
- self:_addflags_from_argument(flags, opt)
+ if opt.config then
+ self:_addflags_from_argument(flags, target, opt.config)
+ end
-- add flags from the platform
if target then
diff --git a/xmake/modules/lib/detect/check_cxsnippets.lua b/xmake/modules/lib/detect/check_cxsnippets.lua
index dcf809524..b451a1118 100644
--- a/xmake/modules/lib/detect/check_cxsnippets.lua
+++ b/xmake/modules/lib/detect/check_cxsnippets.lua
@@ -119,7 +119,8 @@ end
-- @param opt the argument options
-- .e.g
-- { verbose = false, target = [target|option], sourcekind = "[cc|cxx]"
--- , types = {"wchar_t", "char*"}, includes = "stdio.h", funcs = {"sigsetjmp", "sigsetjmp((void*)0, 0)"}}
+-- , types = {"wchar_t", "char*"}, includes = "stdio.h", funcs = {"sigsetjmp", "sigsetjmp((void*)0, 0)"}
+-- , config = {defines = "xx", cxflags = ""}}
--
-- funcs:
-- sigsetjmp
diff --git a/xmake/modules/lib/detect/has_cfuncs.lua b/xmake/modules/lib/detect/has_cfuncs.lua
index 0f3835f0b..e87d41065 100644
--- a/xmake/modules/lib/detect/has_cfuncs.lua
+++ b/xmake/modules/lib/detect/has_cfuncs.lua
@@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets")
-- @param funcs the funcs
-- @param opt the argument options
-- .e.g
--- { verbose = false, target = [target|option], linkdirs = .., links = .., includes = .., defines = .., .. }
+-- { verbose = false, target = [target|option], includes = "", config = {linkdirs = .., links = .., defines = .., ..}}
--
-- funcs:
-- sigsetjmp
diff --git a/xmake/modules/lib/detect/has_cincludes.lua b/xmake/modules/lib/detect/has_cincludes.lua
index f3b6edded..50c69f445 100644
--- a/xmake/modules/lib/detect/has_cincludes.lua
+++ b/xmake/modules/lib/detect/has_cincludes.lua
@@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets")
-- @param includes the includes
-- @param opt the argument options
-- .e.g
--- { verbose = false, target = [target|option], defines = "..", .. }
+-- { verbose = false, target = [target|option], config = {defines = "..", .. }}
--
-- @return true or false
--
diff --git a/xmake/modules/lib/detect/has_ctypes.lua b/xmake/modules/lib/detect/has_ctypes.lua
index 914c849ea..e6fed14e5 100644
--- a/xmake/modules/lib/detect/has_ctypes.lua
+++ b/xmake/modules/lib/detect/has_ctypes.lua
@@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets")
-- @param types the types
-- @param opt the argument options
-- .e.g
--- { verbose = false, target = [target|option], includes = .., defines = .., .. }
+-- { verbose = false, target = [target|option], includes = .., config = {defines = .., ..}}
--
-- @return true or false
--
diff --git a/xmake/modules/lib/detect/has_cxxfuncs.lua b/xmake/modules/lib/detect/has_cxxfuncs.lua
index 342a1e6b5..5eee07d91 100644
--- a/xmake/modules/lib/detect/has_cxxfuncs.lua
+++ b/xmake/modules/lib/detect/has_cxxfuncs.lua
@@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets")
-- @param funcs the funcs
-- @param opt the argument options
-- .e.g
--- { verbose = false, target = [target|option], linkdirs = .., links = .., includes = .., defines = .., .. }
+-- { verbose = false, target = [target|option], includes = "", config = {linkdirs = .., links = .., defines = .., ..}}
--
-- funcs:
-- sigsetjmp
diff --git a/xmake/modules/lib/detect/has_cxxincludes.lua b/xmake/modules/lib/detect/has_cxxincludes.lua
index d36025593..c5df37b26 100644
--- a/xmake/modules/lib/detect/has_cxxincludes.lua
+++ b/xmake/modules/lib/detect/has_cxxincludes.lua
@@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets")
-- @param includes the includes
-- @param opt the argument options
-- .e.g
--- { verbose = false, target = [target|option], defines = "..", .. }
+-- { verbose = false, target = [target|option], config = {defines = "..", .. }}
--
-- @return true or false
--
diff --git a/xmake/modules/lib/detect/has_cxxtypes.lua b/xmake/modules/lib/detect/has_cxxtypes.lua
index 3d290132c..a3d813210 100644
--- a/xmake/modules/lib/detect/has_cxxtypes.lua
+++ b/xmake/modules/lib/detect/has_cxxtypes.lua
@@ -30,7 +30,7 @@ import("lib.detect.check_cxsnippets")
-- @param types the types
-- @param opt the argument options
-- .e.g
--- { verbose = false, target = [target|option], includes = .., defines = .., .. }
+-- { verbose = false, target = [target|option], includes = .., config = {defines = .., ..}}
--
-- @return true or false
--