jalcine/cmake.vim

Add Ninja support

Closed this issue · 10 comments

Ninja is a fast alternative to make, and CMake supports it. If you have never tried it, you should definitely check it out, it's really cool. cmake.vim could benefit from this. To generate Ninja files, this is simply:

$ cmake -GNinja ..

I guess you'd need to adapt this part, and make sure that ninja is called instead of make. FYI, I currently use ninja with vim-dispatch by simply setting makeprg accordingly.

Sounds like a plan, but probably would want to slate this as a breaking chance since a lot of the other commands use make directly. I've been meaning to use CMake's wrapper commands on that (and also do some version checking on CMake to invoke the right commands for the right version).

Added e1dbf54; that's like one segway for this. My visions is to eventually whatever the commands necessary for a build transparent (by means of using cmake in place of all make commands).

For the build process itself, vim-dispatch makes a really good job, so makeprg could be set to the proper value here (make or ninja) to make things more transparent. Then you'd just need to replace the explicit make in your code to use that variable, and you can still offer some simple compilation functions for people who do not need asynchronous builds, tmux integration etc.

I'd want to remove those references from the project altogether. I know that cmake has a way to invoke make build or ninja build without one having to know those specific commands. This is something I'll be researching tonight and aim to incorporate as a beta bump for 0.5.0.

So, I've started the work for this (at least from the makeprg standpoint) in a separate branch (pushing after I commit, probably would update this comment as well. I'm reading the docs for ninja as well; its generated files look really nice!

This officially works for me in ec5e102. It's going to be a moment before
it's in master but after a bit of a sanity-check, it'd be in develop.

Merging this into master now.

Er, develop, sorry. Please feel free to check it out. I'm confident that'll fail because the code still uses the GNU make file layout to find the files for a project. Going to open another PR to handle the work to find files using Ninja.

Ninja support is a complete go now! Really excited for the upcoming
release.

Nice! I'll test it ASAP.