summaryrefslogtreecommitdiff
path: root/xmake/core/tool/builder.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-04 19:19:59 +0800
committerruki <[email protected]>2020-04-04 19:19:59 +0800
commit08acbfa0837ce1e9cd45d8d626ffbda996073007 (patch)
treefe5f4c9e5b3637b4c92b53faeb3bc85ea4f80f0d /xmake/core/tool/builder.lua
parent292ac7314365149af63264f6dc6a3e16cc25b8b0 (diff)
improve to inherit links
Diffstat (limited to 'xmake/core/tool/builder.lua')
-rw-r--r--xmake/core/tool/builder.lua88
1 files changed, 0 insertions, 88 deletions
diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua
index d0fdc5a43..c3d67470e 100644
--- a/xmake/core/tool/builder.lua
+++ b/xmake/core/tool/builder.lua
@@ -111,80 +111,6 @@ function builder:_flagkinds()
return self._FLAGKINDS
end
--- inherit links from target deps
-function builder:_inherit_links_from_targetdeps(results, target, flagname)
-
- -- for all target deps
- local orderdeps = target:orderdeps()
- local total = #orderdeps
- local deplinks = {}
- for idx, _ in ipairs(orderdeps) do
-
- -- reverse deps order for links
- local dep = orderdeps[total + 1 - idx]
-
- -- the dependent target is static or shared library? inherit it's links
- local depkind = dep:targetkind()
- local targetkind = target:targetkind()
- local depinherit = target:extraconf("deps", dep:name(), "inherit")
- if (depkind == "static" or depkind == "shared" or depkind == "object") and (depinherit == nil or depinherit) then
- if targetkind == "binary" or targetkind == "shared" then
- if flagname == "links" or flagname == "syslinks" then
-
- -- add dependent link
- if depkind ~= "object" and flagname == "links" then
- table.insert(results, dep:basename())
- end
-
- -- inherit links from the depdent target
- self:_add_values_from_target(deplinks, dep, flagname)
-
- elseif flagname == "linkdirs" then
-
- -- add dependent linkdirs
- if depkind ~= "object" then
- table.insert(results, path.directory(dep:targetfile()))
- end
-
- -- inherit linkdirs from the depdent target
- self:_add_values_from_target(results, dep, flagname)
-
- elseif flagname == "rpathdirs" then
-
- -- add dependent rpathdirs
- if depkind ~= "object" then
- local rpathdir = "@loader_path"
- local subdir = path.relative(path.directory(dep:targetfile()), path.directory(target:targetfile()))
- if subdir and subdir ~= '.' then
- rpathdir = path.join(rpathdir, subdir)
- end
- table.insert(results, rpathdir)
- end
- end
-
- -- TODO deprecated
- elseif flagname == "includedirs" then
-
- -- add dependent headerdir
- if dep:get("headers") and os.isdir(dep:headerdir()) then
- table.insert(results, dep:headerdir())
- end
-
- -- add dependent configheader directory
- local configheader = dep:configheader()
- if configheader and os.isfile(configheader) then
- table.insert(results, path.directory(configheader))
- end
- end
- end
- end
-
- -- @note we need ensure add option and package links after all dependent targets
- if #deplinks > 0 then
- table.join2(results, deplinks)
- end
-end
-
-- inherit flags (only for public/interface) from target deps
--
-- e.g.
@@ -223,15 +149,6 @@ function builder:_inherit_values_from_targetdeps(values, target, name)
end
end
--- add values from target
-function builder:_add_values_from_target(values, target, name)
- table.join2(values, target:get(name))
- if target:type() == "target" then
- self:_add_values_from_targetopts(values, target, name)
- self:_add_values_from_targetpkgs(values, target, name)
- end
-end
-
-- add values from target options
function builder:_add_values_from_targetopts(values, target, name)
for _, opt in ipairs(target:orderopts()) do
@@ -395,11 +312,6 @@ function builder:_add_flags_from_language(flags, target, getters)
local results = {}
if target:type() == "target" then
- -- link? add includes and links of all dependent targets first
- if name == "links" or name == "syslinks" or name == "linkdirs" or name == "rpathdirs" or name == "includedirs" then
- self:_inherit_links_from_targetdeps(results, target, name)
- end
-
-- inherit flagvalues (public or interface) of all dependent targets
self:_inherit_values_from_targetdeps(results, target, name)