summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-02-19 00:34:42 +0800
committerruki <[email protected]>2019-02-18 21:28:17 +0800
commitb9b6a34e539f3356717b5e4953d37f185ea86476 (patch)
treeaec2bd7ed3a5414351b4cbd22a7cb7c76d51ea7a
parent675353dcc422de761ebfe76f3857b98392d58e51 (diff)
improve check_xxx functions
-rw-r--r--xmake/includes/check_cflags.lua4
-rw-r--r--xmake/includes/check_cfuncs.lua3
-rw-r--r--xmake/includes/check_cincludes.lua3
-rw-r--r--xmake/includes/check_csnippets.lua3
-rw-r--r--xmake/includes/check_ctypes.lua3
-rw-r--r--xmake/includes/check_cxxflags.lua4
-rw-r--r--xmake/includes/check_cxxfuncs.lua3
-rw-r--r--xmake/includes/check_cxxincludes.lua3
-rw-r--r--xmake/includes/check_cxxsnippets.lua3
-rw-r--r--xmake/includes/check_cxxtypes.lua3
-rw-r--r--xmake/includes/check_features.lua3
-rw-r--r--xmake/includes/check_links.lua3
12 files changed, 26 insertions, 12 deletions
diff --git a/xmake/includes/check_cflags.lua b/xmake/includes/check_cflags.lua
index b0028d499..e1d3fcc50 100644
--- a/xmake/includes/check_cflags.lua
+++ b/xmake/includes/check_cflags.lua
@@ -50,12 +50,14 @@ end
--
-- configvar_check_cflags("HAS_SSE2", "-msse2")
-- configvar_check_cflags("HAS_SSE2", {"-msse2", "/arch:SSE2"})
+-- configvar_check_cflags("SSE=2", "-msse2")
--
function configvar_check_cflags(definition, flags, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
on_check(function (option)
import("core.tool.compiler")
if compiler.has_flags("c", flags, opt) then
diff --git a/xmake/includes/check_cfuncs.lua b/xmake/includes/check_cfuncs.lua
index aaa30f28d..089a588ed 100644
--- a/xmake/includes/check_cfuncs.lua
+++ b/xmake/includes/check_cfuncs.lua
@@ -73,9 +73,10 @@ end
function configvar_check_cfuncs(definition, funcs, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_cfuncs(funcs)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.links then
add_links(opt.links)
end
diff --git a/xmake/includes/check_cincludes.lua b/xmake/includes/check_cincludes.lua
index b812d9c64..c7051d56b 100644
--- a/xmake/includes/check_cincludes.lua
+++ b/xmake/includes/check_cincludes.lua
@@ -49,9 +49,10 @@ end
function configvar_check_cincludes(definition, includes, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_cincludes(includes)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
option_end()
add_options(optname)
end
diff --git a/xmake/includes/check_csnippets.lua b/xmake/includes/check_csnippets.lua
index db197529e..5d43ff34f 100644
--- a/xmake/includes/check_csnippets.lua
+++ b/xmake/includes/check_csnippets.lua
@@ -65,9 +65,10 @@ end
function configvar_check_csnippets(definition, snippets, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_csnippets(definition, snippets)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.links then
add_links(opt.links)
end
diff --git a/xmake/includes/check_ctypes.lua b/xmake/includes/check_ctypes.lua
index 8bed250b9..6253651fe 100644
--- a/xmake/includes/check_ctypes.lua
+++ b/xmake/includes/check_ctypes.lua
@@ -64,9 +64,10 @@ end
function configvar_check_ctypes(definition, types, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_ctypes(types)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.languages then
set_languages(opt.languages)
end
diff --git a/xmake/includes/check_cxxflags.lua b/xmake/includes/check_cxxflags.lua
index 00a73b3af..876598566 100644
--- a/xmake/includes/check_cxxflags.lua
+++ b/xmake/includes/check_cxxflags.lua
@@ -50,12 +50,14 @@ end
--
-- configvar_check_cxxflags("HAS_SSE2", "-msse2")
-- configvar_check_cxxflags("HAS_SSE2", {"-msse2", "/arch:SSE2"})
+-- configvar_check_cxxflags("SSE=2", "-msse2")
--
function configvar_check_cxxflags(definition, flags, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
on_check(function (option)
import("core.tool.compiler")
if compiler.has_flags("cxx", flags, opt) then
diff --git a/xmake/includes/check_cxxfuncs.lua b/xmake/includes/check_cxxfuncs.lua
index 2b53fc3f7..96ea5190d 100644
--- a/xmake/includes/check_cxxfuncs.lua
+++ b/xmake/includes/check_cxxfuncs.lua
@@ -73,9 +73,10 @@ end
function configvar_check_cxxfuncs(definition, funcs, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_cxxfuncs(funcs)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.links then
add_links(opt.links)
end
diff --git a/xmake/includes/check_cxxincludes.lua b/xmake/includes/check_cxxincludes.lua
index f1f63ea2e..d7caec81e 100644
--- a/xmake/includes/check_cxxincludes.lua
+++ b/xmake/includes/check_cxxincludes.lua
@@ -49,9 +49,10 @@ end
function configvar_check_cxxincludes(definition, includes, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_cxxincludes(includes)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
option_end()
add_options(optname)
end
diff --git a/xmake/includes/check_cxxsnippets.lua b/xmake/includes/check_cxxsnippets.lua
index 864397f68..2d146904b 100644
--- a/xmake/includes/check_cxxsnippets.lua
+++ b/xmake/includes/check_cxxsnippets.lua
@@ -65,9 +65,10 @@ end
function configvar_check_cxxsnippets(definition, snippets, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_cxxsnippets(definition, snippets)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.links then
add_links(opt.links)
end
diff --git a/xmake/includes/check_cxxtypes.lua b/xmake/includes/check_cxxtypes.lua
index 29e1737c4..e3c32a137 100644
--- a/xmake/includes/check_cxxtypes.lua
+++ b/xmake/includes/check_cxxtypes.lua
@@ -64,9 +64,10 @@ end
function configvar_check_cxxtypes(definition, types, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_cxxtypes(types)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.languages then
set_languages(opt.languages)
end
diff --git a/xmake/includes/check_features.lua b/xmake/includes/check_features.lua
index 987749f98..a1cb55fe1 100644
--- a/xmake/includes/check_features.lua
+++ b/xmake/includes/check_features.lua
@@ -61,9 +61,10 @@ end
function configvar_check_features(definition, features, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_features(features)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
if opt.languages then
set_languages(opt.languages)
end
diff --git a/xmake/includes/check_links.lua b/xmake/includes/check_links.lua
index 02a2b0678..118123234 100644
--- a/xmake/includes/check_links.lua
+++ b/xmake/includes/check_links.lua
@@ -49,9 +49,10 @@ end
function configvar_check_links(definition, links, opt)
opt = opt or {}
local optname = "__" .. (opt.name or definition)
+ local defname, defval = unpack(definition:split('='))
option(optname)
add_links(links)
- set_configvar(definition, 1)
+ set_configvar(defname, defval or 1)
option_end()
add_options(optname)
end