Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Compiling with ninja

From: Dario Lombardo <dario.lombardo.ml@xxxxxxxxx>
Date: Tue, 4 Nov 2014 15:12:22 +0100
Hi list
Some days ago I played a bit with ninja and I found useful info I'd like to share with you.
Ninja is a compilation system similar to make. It's advantage is that it was built with parallelism in mind, to take advantage of multi-core CPUs. 
Wireshark uses cmake that has a generator for ninja, so I decided to make some tests.

1) cmake and make
This a very common way to compile stuff, and wireshark too. The advantage of using cmake and make is that you get a progress of the compilation. Very useful! The disadvantage is that this progress runs bad with parallel make (-j). Not only the output is a mess, but sometimes compilation breaks. I think that cmake doesn't manage well parallel gcc instances. Autotools manage well parallel make, but afaik the cmake subsystem in wireshark has a better support.

With this setup I'm able to compile wireshark in about 10m.

2) cmake and ninja
To speed up things I made a second setup for ninja, on my ubuntu 14.04

sudo apt-get install ninja-build
mkdir build-ninja
cd build-ninja
cmake -GNinja ..
ninja

The compilation went well and the compilation took about 2.5m! I lost the progress in term of percentage, but I still have a progress in term of #compiled/#total. But the BIG advantage is the speed: only 25% of the other setup on the same machine. The other advantage is that, using cmake, you can have separate build dirs, that don't pollute each other.

Hope it helps people who like faster compilation :).

Dario.