diff options
| author | ruki <[email protected]> | 2017-05-12 11:03:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-12 11:03:34 +0800 |
| commit | 2cfd41ae2fe1c008e9572538ebf90e5f898513f9 (patch) | |
| tree | ab1186b3705253ce7f1130b12ce3008fa34a524a /xmake/core/project/project.lua | |
| parent | 149d26d8fefd4d3dbba882131b926f4a852e336c (diff) | |
add includes and links from target deps automatically
Diffstat (limited to 'xmake/core/project/project.lua')
| -rw-r--r-- | xmake/core/project/project.lua | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index d0434a3b1..8952cbdc3 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -348,6 +348,23 @@ function project._interpreter() return interp end +-- load target deps +function project._load_target_deps(target, targets) + + -- get dep targets + local deptargets = {} + for _, dep in ipairs(table.wrap(target:get("deps"))) do + local deptarget = targets[dep] + if deptarget then + table.join2(deptargets, project._load_target_deps(deptarget)) + table.insert(deptargets, deptarget) + end + end + + -- ok? + return table.unique(deptargets) +end + -- get the project directory function project.directory() @@ -444,6 +461,11 @@ function project.load() targets[targetname] = target.new(targetname, targetinfo) end + -- load and attach target deps + for _, target in pairs(targets) do + target._DEPS = project._load_target_deps(target, targets) + end + -- save targets project._TARGETS = targets @@ -455,7 +477,7 @@ end function project.target(targetname) -- check - assert(targetname and targetname ~= "all") + assert(targetname) -- the targets local targets = project.targets() |
