Installation

Dependencies

This requires the following packages to be installed:

On Debian- and Ubuntu-like systems, these can be installed with:

$ sudo apt install libsfml-dev libhdf5-dev libomp-dev

Installing

Note

We have tested Kilosim primarily on Ubuntu. Although CMake makes it possible to use across operating systems, we have not thoroughly tested this beyond Linux. Installation of dependencies will differ depending on your system.

You can either clone the repository from GitHub or download the latest release.

Using Static Library

This is the primary way of using Kilosim.

If your project uses cmake, then incorporating Kilosim is easy!

Just add the following lines to your CMakeLists.txt file:

add_subdirectory(path/to/kilosim EXCLUDE_FROM_ALL)
target_link_libraries(your_executable_target PRIVATE kilosim)

And everything will just work.

For a more detailed example, see the Kilosim Demo repository.

Compiling

Compiling the library explicitly as follows is only necessary to run its tests and generate its documentation.

To compile, run the following:

$ mkdir build  # Create a build directory
$ cd build  # Move into build directory
$ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=../ ..  #Configure for your system
$ make  # Build the library (equivalent to `make kilosim`)
$ make install  # Install the library to that indicated by `CMAKE_INSTALL_PREFIX` above
$ cd ..  # Move back to source directory

If you want to generate more than the library, you can alternatively run:

$ make kilosim       # Build library
$ make docs          # Build documentation (optional)
$ make install       # Install all the components generated by the above commands

To clean up the build enter the source directory and run:

$ rm -rf build bin lib

Flags:

  • -DSANITIZE_ADDRESS=On: Use address sanitizer to check memory safety

  • -DCMAKE_CXX_FLAGS=-pg: Enable call-graph generation. (This is useful for debugging and code profiling.)

Use flags like so:

$ cmake -DSANITIZE_ADDRESS=ON ..

Compatibility:

  • g++ 5 - doesn’t work

  • g++ 7.3 - works

  • g++ 8.1 - fails due to compiler issue(?)

  • g++ 8.3 - works

  • g++ 9.2.1 - works

Running

In addition to the static library, we provide an executable example to test your installation.

Run the examples generated by make and make install:

$ ./bin/kilosim_example examples/exampleConfig.json