Difference between revisions of "Documentation/Labs/Ninja"
m (→Linux / MacOSX) |
|||
Line 30: | Line 30: | ||
git clone git://github.com/martine/ninja.git | git clone git://github.com/martine/ninja.git | ||
cd ninja | cd ninja | ||
− | .\ | + | .\configure.py --bootstrap |
</pre> | </pre> | ||
Revision as of 22:39, 24 November 2014
Home < Documentation < Labs < NinjaContents
Ninja
Ninja is a small build system written with the goal of reducing build time of large projects like Slicer.
Ninja currently works well on linux and mac. It also works on windows, but that's very new and may have issues. It works as an alternative to more commonly known make or GNU Make (gmake) build systems.
For more details, head on to http://martine.github.com/ninja/
Installation
Building from source
Linux / MacOSX
Open up a terminal and execute the following commands:
git clone git://github.com/martine/ninja.git cd ninja ./configure.py --bootstrap
NOTE: Make sure git is in the path.
Windows
Open up a Visual Studio command prompt and execute the following commands:
git clone git://github.com/martine/ninja.git cd ninja .\configure.py --bootstrap
NOTE: Make sure git is in the path.
Linux packages
There are packaged versions available for Ninja on various Linux flavors.
For example, installing the ninja package on Ubuntu can be done using:
sudo apt-get install ninja-build
Using it
- CMake has Ninja generator support beginning version 2.8.8
All one needs to do is choose Ninja as the generator for the project in cmake-gui (GUI for CMake)
OR
cd Slicer/bld ccmake ../src -GNinja
- Once configured using CMake, simply run the
ninja
in the build directory.
- QtCreator has Ninja support beginning version 2.6
Test
I was able to use Ninja to build Slicer on Mac OSX and Linux Ubuntu.
All the dependencies of Slicer built fine and build time was reduced considerably.
The following table shows time statistics for a normal Slicer build on Factory machine on MacOSX.
Build Type | Command Used | Time taken(seconds) |
---|---|---|
Fresh Build | make all -j9 |
1681 |
ninja -j9 |
1671 | |
Re-Build without editing source | make all -j9 |
102 |
ninja -j9 |
2 | |
Re-Build with minor edit | make all -j9 |
1108 |
ninja -j9 |
5 |
As observed, a fresh build takes approximately the same amount of time using both make and ninja. However, successive builds are much faster.
NOTE: Ninja uses all CPU cores by default but for comparison purposes I use the same number of cores for both the build systems.
I have tried using VS compiler on Windows for building Slicer using the above method. However, it was an unsuccessful attempt. There were errors reported in building Python and ITK.
I will soon post my results of using QtCreator on Windows for building Slicer.