summaryrefslogtreecommitdiff
path: root/xmake/scripts/base
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/scripts/base')
-rw-r--r--xmake/scripts/base/project.lua18
-rw-r--r--xmake/scripts/base/rule.lua5
2 files changed, 17 insertions, 6 deletions
diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua
index 02958c106..531f315b2 100644
--- a/xmake/scripts/base/project.lua
+++ b/xmake/scripts/base/project.lua
@@ -102,6 +102,21 @@ function project._api_archs(env, ...)
end
end
+-- the current kind is belong to the given kinds?
+function project._api_kinds(env, ...)
+
+ -- get the current kind
+ local kind = config.get("kind")
+ if not kind then return false end
+
+ -- exists this kind?
+ for _, k in ipairs(table.join(...)) do
+ if k and type(k) == "string" and k == kind then
+ return true
+ end
+ end
+end
+
-- enable options?
function project._api_options(env, ...)
@@ -1060,6 +1075,7 @@ function project._load_options(file)
-- register interfaces for the condition
newenv.os = function (...) return project._api_os(newenv, ...) end
newenv.modes = function (...) return project._api_modes(newenv, ...) end
+ newenv.kinds = function (...) return project._api_kinds(newenv, ...) end
newenv.plats = function (...) return project._api_plats(newenv, ...) end
newenv.archs = function (...) return project._api_archs(newenv, ...) end
@@ -1169,6 +1185,7 @@ function project._load_targets(file)
-- register interfaces for the condition
newenv.os = function (...) return project._api_os(newenv, ...) end
newenv.modes = function (...) return project._api_modes(newenv, ...) end
+ newenv.kinds = function (...) return project._api_kinds(newenv, ...) end
newenv.plats = function (...) return project._api_plats(newenv, ...) end
newenv.archs = function (...) return project._api_archs(newenv, ...) end
newenv.options = function (...) return project._api_options(newenv, ...) end
@@ -1193,7 +1210,6 @@ function project._load_targets(file)
-- register interfaces for setting values
local interfaces = { "kind"
- , "targetname"
, "config_h_prefix"
, "version"
, "strip"
diff --git a/xmake/scripts/base/rule.lua b/xmake/scripts/base/rule.lua
index 7e83aee80..b3dc1825c 100644
--- a/xmake/scripts/base/rule.lua
+++ b/xmake/scripts/base/rule.lua
@@ -109,11 +109,6 @@ function rule.targetfile(target_name, target, buildir)
local targetdir = target.targetdir or buildir or config.get("buildir")
assert(targetdir and type(targetdir) == "string")
- -- modify target name?
- if target.targetname then
- target_name = target.targetname
- end
-
-- the target file name
local filename = rule.filename(target_name, target.kind)
assert(filename)