Manual: Installation

From KODE Wiki
Jump to: navigation, search
This article is part
of the KODE Manual
Install and Use
Quick Tutorial
API Reference

Getting the Source Code[edit]

KODE's source code is hosted in Bitbucket:

Currently there are no official releases, so the code can be obtained by cloning the repository:

hg clone

Alternatively, you can use Bitbucket's web interface to download a snapshot of the repository.


  • pkg-config : it's the ubiquitous tool for finding installed libraries on a unix-like system. You might need to set the PKG_CONFIG_PATH environment variable to also include custom installation paths; that is, if by default you install into /usr/local, add this line to your .bashrc:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
This will ensure that manually-installed libraries (that go to /usr/local by default) can be found by pkg-config.
  • Eigen 3 (Optional) : Instead of re-inventing the wheel, KODE performs the heavy numerical work through Eigen, which has platform-specific optimizations; there's a fall-back implementation using plain arrays, but it doesn't try to be as optimized as Eigen. It's highly recommended to use Eigen 3.
  • Boost (Optional) : Used for unit-testing; although not strictly needed for building KODE, while it is still in heavy development you should always do a make check to run the unit tests.
  • Ogre3D and OIS (Optional): currently there are only samples written in Ogre3D + OIS; install these libraries if you want to run the samples.



  • Enter the top-level directory and run:
This will generate the configure script you need to run next.
Note: if you downloaded a release tarball, this step is not necessary.
  • Create a build directory, change to it, and run the configure script from KODE's top-level directory:
mkdir build
cd build
You might want to pass the --help option to configure to see what arguments can be used. For instance:
../configure --enable-double --prefix=/opt CXXFLAGS="-O3"
would build KODE with double precision using optimization "-O3", and the library would be installed into /opt.


After configuration has finished without issues, run:


You'll probably want to use the -jN option to enable parallel compilation, where N is the number of parallel compilation tasks you want.

To run the unit tests that perform some validation on the library, run:

make check


Run the command:

sudo make install

If your system doesn't have sudo, use su instead:

su # type in the root's password when prompted
make install

To uninstall KODE, simply use make uninstall instead.


To use KODE in your program you need to pass specific CFLAGS and LDFLAGS to your program. This can be done with the help of pkg-config.

Assuming this simple source code in test.cpp:

#include <kode/kode.hpp>

int main()
    kode::World world;

To compile it from the command-line:

g++ -std=c++11 test.cpp `pkg-config --cflags --libs kode` -o test

In a hand-crafted Makefile it would look like this:

PROGRAM := test
CXX := g++ -std=c++11
CXXFLAGS := -Wall -Wextra -O2 -g $(shell pkg-config --cflags kode)
LDFLAGS := $(shell pkg-config --libs kode)

.PHONY: all clean

all: $(PROGRAM)

	rm -f *.o $(PROGRAM)

$(PROGRAM) : test.o
	$(CXX) -o [email protected] $^ $(LDFLAGS)

$.o : $.cpp

Note the use of $(shell ...) to invoke pkg-config, instead of backticks.