diff options
author | 2020-02-05 23:21:10 +0100 | |
---|---|---|
committer | 2020-02-05 17:21:10 -0500 | |
commit | a06d8e9cc68e6c91fcd58770e972ff81ffd20275 (patch) | |
tree | c5d0413234347f12b126e2384e972e3eaa0ffb6c /3rdparty/genie/src/actions/ninja/ninja_cpp.lua | |
parent | 095a13d02c65c22e31b8e0f905a7f497aea181ff (diff) |
Sync with GENie upstream revision ce9f3c5 (#6262)
* Change makerules to take variable $(PROJECT_TYPE) instead of hardcoded 'gmake'
This allows to run `make projgen PROJECT_TYPE=ninja` to generate ninja build files instead.
and to build GENie using ninja by running `make release PROJECT_TYPE=ninja`.
Using ninja improves build times,
e.g. for macOS: 12.47s with gmake goes down to 2.05s with ninja.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Set prefer project set as solution.startproject as default target
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Adding `GenerateMapFiles` flag.
Causes Visual Studio's linker to generate .map files for that
configuration.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Add ninja support for 'wholearchive' libraries
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Fixup ninja.esc to gracefully ignore nil passed as value
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Use -Wl,-force_load for wholearchive libs when building for macosx
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Updated README.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Add space after filename in 'Generating' message
This makes the filename 'clickable' to open in iTerm and VSCode
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Print generated filenames as quoted string
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Remove '...' after filename
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Pop cwd after pushing to run file
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Make paths in embed.lua rely on script dir
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Updated README.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Fix issues caused by make-4.3 no longer adding spaces to variables in some cases The fix was found by @asavah.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Fixed release script.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Updated README.
Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
* Update scripts.c
Co-authored-by: Christian Helmich <kagekirin@gmail.com>
Co-authored-by: Johan Sköld <johan@skold.cc>
Co-authored-by: Бранимир Караџић <branimirkaradzic@gmail.com>
Diffstat (limited to '3rdparty/genie/src/actions/ninja/ninja_cpp.lua')
-rw-r--r-- | 3rdparty/genie/src/actions/ninja/ninja_cpp.lua | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/3rdparty/genie/src/actions/ninja/ninja_cpp.lua b/3rdparty/genie/src/actions/ninja/ninja_cpp.lua index 14cbf5d0456..5db216fb453 100644 --- a/3rdparty/genie/src/actions/ninja/ninja_cpp.lua +++ b/3rdparty/genie/src/actions/ninja/ninja_cpp.lua @@ -85,7 +85,7 @@ end _p(" command = " .. wrap_ninja_cmd("$pre_link " .. link .. " -o $out @$out.rsp $all_ldflags $post_build")) _p(" description = link $out") _p(" rspfile = $out.rsp") - _p(" rspfile_content = $all_outputfiles " .. string.format("%s $libs %s", startgroup, endgroup)) + _p(" rspfile_content = $all_outputfiles $walibs" .. string.format("%s $libs %s", startgroup, endgroup)) _p("") _p("rule exec") @@ -330,15 +330,36 @@ end end function cpp.linker(prj, cfg, objfiles, tool) - local all_ldflags = ninja.list(table.join(tool.getlibdirflags(cfg), tool.getldflags(cfg), cfg.linkoptions)) - local lddeps = ninja.list(premake.getlinks(cfg, "siblings", "fullpath")) - local libs = lddeps .. " " .. ninja.list(tool.getlinkflags(cfg)) - + local all_ldflags = ninja.list(table.join(tool.getlibdirflags(cfg), tool.getldflags(cfg), cfg.linkoptions)) local prebuildsuffix = #cfg.prebuildcommands > 0 and "||__prebuildcommands" or "" + local libs = {} + local walibs = {} + local lddeps = {} + + if #cfg.wholearchive > 0 then + for _, linkcfg in ipairs(premake.getlinks(cfg, "siblings", "object")) do + local linkpath = path.rebase(linkcfg.linktarget.fullpath, linkcfg.location, cfg.location) + table.insert(lddeps, linkpath) + + if table.icontains(cfg.wholearchive, linkcfg.project.name) then + table.insert(walibs, table.concat(tool.wholearchive(linkpath), ' ')) + else + table.insert(libs, linkpath) + end + end + else + lddeps = premake.getlinks(cfg, "siblings", "fullpath") + libs = lddeps + end + + lddeps = ninja.list(lddeps) + libs = ninja.list(libs) .. " " .. ninja.list(tool.getlinkflags(cfg)) + walibs = ninja.list(walibs) local function writevars() _p(1, "all_ldflags = " .. all_ldflags) _p(1, "libs = " .. libs) + _p(1, "walibs = " .. walibs) _p(1, "all_outputfiles = " .. table.concat(objfiles, " ")) if #cfg.prelinkcommands > 0 then _p(1, 'pre_link = echo Running pre-link commands && ' .. table.implode(cfg.prelinkcommands, "", "", " && ") .. " && ") |