diff options
| author | ruki <[email protected]> | 2020-03-19 00:39:37 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-03-18 21:57:46 +0800 |
| commit | 304d2b4166fdc57b40a5ed7b164a82c8f3610665 (patch) | |
| tree | c36f29287f883170d7c84d7678bfd64f8f925e45 | |
| parent | a4a2b2fefb5247d3d70f844032ebbce57c29fe4c (diff) | |
improve to generate build.ninja
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/project/project.lua | 8 | ||||
| -rw-r--r-- | xmake/plugins/project/ninja/build_ninja.lua | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua index 62fef5e22..8f36af51e 100644 --- a/xmake/core/sandbox/modules/import/core/project/project.lua +++ b/xmake/core/sandbox/modules/import/core/project/project.lua @@ -206,7 +206,13 @@ end -- get the project name function sandbox_core_project.name() - return project.get("project") + local name = project.get("project") + -- TODO multi project names? we only get the first name now. + -- and we need improve it in the future. + if type(name) == "table" then + name = name[1] + end + return name end -- get the project version, the root version of the target scope diff --git a/xmake/plugins/project/ninja/build_ninja.lua b/xmake/plugins/project/ninja/build_ninja.lua index 972f7c534..7bfd65379 100644 --- a/xmake/plugins/project/ninja/build_ninja.lua +++ b/xmake/plugins/project/ninja/build_ninja.lua @@ -211,13 +211,18 @@ function _add_build_for_target(ninjafile, target) -- build target file ninjafile:printf("build %s: %s", targetfile, target:linker():kind()) - for _, dep in ipairs(target:get("deps")) do - ninjafile:write(" " .. project.target(dep):targetfile()) - end local objectfiles = target:objectfiles() for _, objectfile in ipairs(objectfiles) do ninjafile:write(" " .. objectfile) end + local deps = target:get("deps") + if deps then + ninjafile:print(" || $") + ninjafile:write(" ") + for _, dep in ipairs(deps) do + ninjafile:write(" " .. project.target(dep):targetfile()) + end + end ninjafile:print("") ninjafile:print(" ARGS = %s", os.args(target:linkflags())) ninjafile:print("") |
