diff options
| author | ruki <[email protected]> | 2015-12-28 08:52:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-12-28 08:52:20 +0800 |
| commit | e0dab0305d1967b57b12d2deb94e4253bf7cde06 (patch) | |
| tree | 4210f509a4684bd552333fd283a54d29c528b648 | |
| parent | f68d912cc271ec162b07ca68538d7f3689415b54 (diff) | |
add kind configure and remove set_targetname api
| -rw-r--r-- | xmake/scripts/action/_config.lua | 4 | ||||
| -rw-r--r-- | xmake/scripts/action/_package.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/base/project.lua | 18 | ||||
| -rw-r--r-- | xmake/scripts/base/rule.lua | 5 |
4 files changed, 22 insertions, 7 deletions
diff --git a/xmake/scripts/action/_config.lua b/xmake/scripts/action/_config.lua index 970cc2b64..a883b0499 100644 --- a/xmake/scripts/action/_config.lua +++ b/xmake/scripts/action/_config.lua @@ -140,6 +140,10 @@ function _config.menu() , " - debug" , " - release" , " - profile" } + , {'k', "kind", "kv", "static", "Compile for the given target kind." + , " - static" + , " - shared" + , " - binary" } , {nil, "host", "kv", xmake._HOST, "The current host environment." } -- the options for project diff --git a/xmake/scripts/action/_package.lua b/xmake/scripts/action/_package.lua index 80eac56e3..e39604a33 100644 --- a/xmake/scripts/action/_package.lua +++ b/xmake/scripts/action/_package.lua @@ -129,7 +129,7 @@ function _package._makeconf(target_name, target) local configs_arch = configs_target.archs[arch] -- save name - configs_target.name = utils.ifelse(target.targetname, target.targetname, target_name) + configs_target.name = target_name -- save kind configs_target.kind = target.kind 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) |
