diff options
| author | ruki <[email protected]> | 2019-02-03 15:27:07 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-03 15:27:07 +0800 |
| commit | 640c2e7e81809d122adca38aca09d2448f14ed50 (patch) | |
| tree | f0516a372a39d0e6b42461f8352d43210be67a72 | |
| parent | b3985752dd4ff11e6fbcf38058da40ff92635c81 (diff) | |
improve target kind
| -rw-r--r-- | xmake/actions/install/install.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/run/main.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/uninstall/uninstall.lua | 2 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 2 | ||||
| -rw-r--r-- | xmake/core/tool/builder.lua | 4 | ||||
| -rw-r--r-- | xmake/core/tool/compiler.lua | 12 | ||||
| -rw-r--r-- | xmake/core/tool/linker.lua | 4 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua | 6 | ||||
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 6 |
9 files changed, 21 insertions, 21 deletions
diff --git a/xmake/actions/install/install.lua b/xmake/actions/install/install.lua index b6b68b78a..fc8db342c 100644 --- a/xmake/actions/install/install.lua +++ b/xmake/actions/install/install.lua @@ -110,7 +110,7 @@ function _do_install_target(target) } -- call script - local script = scripts[target:get("kind")] + local script = scripts[target:targetkind()] if script then script(target) end diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index 041a6774e..21783a125 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -168,7 +168,7 @@ function _check_targets(targetname) -- install default or all targets for _, target in pairs(project.targets()) do local default = target:get("default") - if (default == nil or default == true or option.get("all")) and target:get("kind") == "binary" then + if (default == nil or default == true or option.get("all")) and target:targetkind() == "binary" then table.insert(targets, target) end end @@ -217,7 +217,7 @@ function main() -- run default or all binary targets for _, target in pairs(project.targets()) do local default = target:get("default") - if (default == nil or default == true or option.get("all")) and target:get("kind") == "binary" then + if (default == nil or default == true or option.get("all")) and target:targetkind() == "binary" then _run_deps(target) _run(target) end diff --git a/xmake/actions/uninstall/uninstall.lua b/xmake/actions/uninstall/uninstall.lua index 9b41aa4ca..f79727947 100644 --- a/xmake/actions/uninstall/uninstall.lua +++ b/xmake/actions/uninstall/uninstall.lua @@ -87,7 +87,7 @@ function _do_uninstall_target(target) } -- call script - local script = scripts[target:get("kind")] + local script = scripts[target:targetkind()] if script then script(target) end diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index c71baf45d..7c3e3ac15 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -775,7 +775,7 @@ end -- get the target kind function target:targetkind() - return self:get("kind") + return self:get("kind") or "phony" end -- get the target directory diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 09daa029f..8c6a3a105 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -153,8 +153,8 @@ function builder:_inherit_from_targetdeps(results, target, flagname) local dep = orderdeps[total + 1 - idx] -- is static or shared target library? link it - local depkind = dep:get("kind") - local targetkind = target:get("kind") + local depkind = dep:targetkind() + local targetkind = target:targetkind() local depconfig = table.wrap(target:depconfig(dep:name())) if (depkind == "static" or depkind == "shared" or depkind == "object") and (depconfig.inherit == nil or depconfig.inherit) then if (flagname == "links" or flagname == "syslinks") and (targetkind == "binary" or targetkind == "shared") then diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua index 52dc23c91..51ea1a312 100644 --- a/xmake/core/tool/compiler.lua +++ b/xmake/core/tool/compiler.lua @@ -174,8 +174,8 @@ function compiler:build(sourcefiles, targetfile, opt) -- get target kind local targetkind = opt.targetkind - if not targetkind and opt.target then - targetkind = opt.target:get("kind") + if not targetkind and opt.target and opt.target.targetkind then + targetkind = opt.target:targetkind() end -- get it @@ -206,8 +206,8 @@ function compiler:buildargv(sourcefiles, targetfile, opt) -- get target kind local targetkind = opt.targetkind - if not targetkind and opt.target then - targetkind = opt.target:get("kind") + if not targetkind and opt.target and opt.target.targetkind then + targetkind = opt.target:targetkind() end -- get it @@ -280,8 +280,8 @@ function compiler:compflags(opt) -- get target kind local targetkind = opt.targetkind - if not targetkind and target then - targetkind = target:get("kind") + if not targetkind and target and target.targetkind then + targetkind = target:targetkind() end -- add flags from the configure diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 8eac1eb9d..ea653c1db 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -259,8 +259,8 @@ function linker:linkflags(opt) -- get target kind local targetkind = opt.targetkind - if not targetkind and target then - targetkind = target:get("kind") + if not targetkind and target and target.targetkind then + targetkind = target:targetkind() end -- add flags from the configure diff --git a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua index e240b667a..272c37755 100644 --- a/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua +++ b/xmake/plugins/project/vstudio/impl/vs200x_vcproj.lua @@ -74,7 +74,7 @@ end function _make_linkflags(target, vcprojdir) -- make the linking flags - local linkflags = linker.linkflags(target:get("kind"), target:sourcekinds(), {target = target}) + local linkflags = linker.linkflags(target:targetkind(), target:sourcekinds(), {target = target}) -- replace -libpath:dir or /libpath:dir, -pdb:symbol.pdb or /pdb:symbol.pdb local flags = {} @@ -214,7 +214,7 @@ end function _make_VCLinkerTool(vcprojfile, vsinfo, target, vcprojdir) -- need not linker? - local kind = target:get("kind") + local kind = target:targetkind() if kind ~= "binary" and kind ~= "shared" then vcprojfile:enter("<Tool") vcprojfile:print("Name=\"VCLinkerTool\"") @@ -304,7 +304,7 @@ function _make_configurations(vcprojfile, vsinfo, target, vcprojdir) vcprojfile:print("Name=\"$(mode)|Win32\"") vcprojfile:print("OutputDirectory=\"%s\"", path.relative(path.absolute(target:targetdir()), vcprojdir)) vcprojfile:print("IntermediateDirectory=\"%s\"", path.relative(path.absolute(target:objectdir()), vcprojdir)) - vcprojfile:print("ConfigurationType=\"%d\"", assert(configuration_types[target:get("kind")])) + vcprojfile:print("ConfigurationType=\"%d\"", assert(configuration_types[target:targetkind()])) vcprojfile:print("CharacterSet=\"%d\"", unicode and 1 or 2) -- mbc: 2, wcs: 1 vcprojfile:print("UseOfMFC=\"%d\"", usemfc) vcprojfile:print(">") diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index 30ea20837..0fd80605a 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -90,7 +90,7 @@ function _make_targetinfo(mode, arch, target) end -- save linker flags - local linkflags = linker.linkflags(target:get("kind"), target:sourcekinds(), {target = target}) + local linkflags = linker.linkflags(target:targetkind(), target:sourcekinds(), {target = target}) targetinfo.linkflags = linkflags -- use mfc? save the mfc runtime kind @@ -116,7 +116,7 @@ end function _make_targetheaders(mode, arch, target, last) -- only for static and shared target - local kind = target:get("kind") + local kind = target:targetkind() if kind == "static" or kind == "shared" then -- TODO make headers, (deprecated) @@ -258,7 +258,7 @@ function make(outputdir, vsinfo) -- init target info _target.name = targetname - _target.kind = target:get("kind") + _target.kind = target:targetkind() _target.scriptdir = target:scriptdir() _target.info = _target.info or {} table.insert(_target.info, _make_targetinfo(mode, arch, target)) |
