Documentation/Labs/Ninja

From Slicer Wiki
Jump to: navigation, search
Home < Documentation < Labs < Ninja

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
./bootstrap.py

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
.\bootstrap.py

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

Linux / MacOSX

  • 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. Time statistics will soon follow.

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.