Live data from Hacker News

Ninja – A small build system with a focus on speed

martine.github.io

11–20 of 30 posts

Re: Ninja – A small build system with a focus on speed

#11

If this is designed for generated build files, why isn't it a library? It seems to use files as a shit IPC.

Using files as an API is one of the most generic interfaces you can get. You can use it from any system/language you can imagine, assuming it can write to a file.

Re: Ninja – A small build system with a focus on speed

#14

If this is designed for generated build files, why isn't it a library? It seems to use files as a shit IPC.

The files serve as a cache of the output of the build file generator: each time the user executes a build (e.g. after each edit to a source file) you only run ninja, not the generator program.

Re: Ninja – A small build system with a focus on speed

#15
post #3
post #2

Jeez, can't you kids just quit this square-wheel churn and just buckle down and learn to write makefiles? It's really not that hard.

Sigh. As far as I can tell ninja is primarily used as a cmake backend. Mostly because the people who wrote cmake never learned to write Makefiles and as a result using ninja with cmake is much faster.

If you measure by "number of users of the resulting binaries", Ninja is primarily used as a backend for Chrome's bespoke build system. But by number of projects, cmake is likely dominant.

(And yes, part of the reason Ninja succeeded is because it ties the hands of the person generating the files. Make gives people enough rope to hang themselves and they frequently do. From the manual: "To restate, Ninja is faster than other build systems because it is painfully simple. You must tell Ninja exactly what to do when you create your project’s .ninja files.")

Re: Ninja – A small build system with a focus on speed

#18
post #7
post #2

Jeez, can't you kids just quit this square-wheel churn and just buckle down and learn to write makefiles? It's really not that hard.

A Ninja file is probably no easier to write than a Makefile. But Ninja is a lot faster than make, which is the reason for using it. To see this, configure Chromium to build with Xcode, make, and ninja, and compare the build times.

I once wrote a custom build systems in python to generate Make files. I did this because I wanted to use convention instead of configuration and achieve fast builds on multicore machines. Later, after leaving that company, I wanted to recreate a similar build system. I wrote it in python to generate Ninja build files. I found it easier and cleaner to write Ninja build files.

I wasn't able to do a direct comparison of the build speeds of the two systems, but I bet the Ninja builds were significantly faster.

Re: Ninja – A small build system with a focus on speed

#19
post #4
post #3

Earlier quoted context omitted.

Sigh. As far as I can tell ninja is primarily used as a cmake backend. Mostly because the people who wrote cmake never learned to write Makefiles and as a result using ninja with cmake is much faster.

Kitware have a lot to apologise for.

A lot of people don't like cmake.

...but you categorically cannot argue that Kitware has single handed transformed the entire C++ build infrastructure landscape; the brand new cross platform IDE by JetBrains (CLion) uses cmake as their primary build method.

You have to tip your hat to the fact that KitWare been fantastically successful in their mission.

Like it or not, it's a fact. Cmake is here to stay.

Make could have been a contender, but the only people who cared enough about it to actually build anything useful with it, built automake; which is a piece of stinking rubbish, not portable, and has a syntax even more arcane than make OR cmake.

Maybe if android and the google make toolchain had arrived 4 years earlier, we'd be somewhere else now, but the gate is closed now. Make is obsolete as a build system for a modern project that has to, you know, actually compile on multiple targets.

Re: Ninja – A small build system with a focus on speed

#20

I still think build systems should be written in node and js from now on. Node is easy to install on most environments, in my experience it is much easier than python or ruby and javascript knowledge is spreading.

You can generate .ninja files using code in any language you like, including Javascript. Do you have a use case that this doesn't satisfy?
Post reply on HN