Kiwaku 0.1-beta
Containers Well Made
 
Loading...
Searching...
No Matches
Installation and Quick Start

Installation & Quick Start

Pre-requisites

KIWAKU requires a C++20 compliant compiler. Here is the current minimal compiler version supported:

Compiler Version
g++ 11 or above
clang++ 14 or above


Retrieving the source

Github

KIWAKU is available on GitHub and can be retrieved via the following command:

$ git clone  https://github.com/jfalcou/kiwaku.git

This retrieves the main branch which contains the latest stable version. Development happens live on main so if you need stability, use a tagged versions.

CPM

You can install KIWAKU directly via CPM. After adding CPM to your CMake setup, just add the following commands:

include(CPM)
CPMAddPackage(
NAME eve
URL https://github.com/jfalcou/kiwaku
)

Installation from Source

If you didn't fetched KIWAKU from a package manager, you'll need to install it via our CMake system.

Setting up the Library

Create a build directory here and enter it. Once in the build directory, you can use CMake to generate the build system for KIWAKU.

We recommend using Ninja but any build system is fine.

$ mkdir build
$ cd build
$ cmake .. -G Ninja

Once CMake completes, you can use the install target to build and install KIWAKU. By default, the library will be installed in the /usr/localdirectory, thus requiring root privileges on Linux.

$ ninja install

You can select an alternative installation path by specifying the CMAKE_INSTALL_PREFIX option at configuration time.

$ cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=path/to/install
$ ninja install

Building the Documentation

You can rebuild KIWAKU documentation if you have the latest version of Doxygen installed using the doxygen target:

ninja kwk-doxygen

The resulting HTML files will be available in the doc folder.

Using the library

Compilation

Once installed, you can compile the following code to check if everything is alright.

#include <kwk/container.hpp>
#include <iostream>
int main()
{
float ref[] = {1,2,3,4,5,6,7,8,9,10,11,12};
auto v = kwk::view{ kwk::source = ref
, kwk::of_size(4,3)
, kwk::label = "Test matrix"
};
std::cout << v << "\n";
}
constexpr __::label_ label
Label setting for kwk::table and kwk::view.
Definition label.hpp:37
constexpr __::source_ source
Data source setting for kwk::table and kwk::view.
Definition source.hpp:61
constexpr auto of_size(D... d)
Generates a kwk::shape from a list of Extent.
Definition shape.hpp:339
Non-owning, contiguous multi-dimensional container.
Definition view.hpp:25

To do so, use your C++20 aware favorite compiler, for example g++.

$ g++ test.cpp -std=c++20 -O3 -DNDEBUG -I/path/to/install/include -o output

Don't forget the --std=c++20 option to be sure to activate C++20 support. If you use a different compiler, check your compiler user's manual to use the proper option.

You can notice we use the -O3 -DNEDBUG options. This is required if you want to be sure to get the best performance out of KIWAKU.

The -DNDEBUG setting can be omitted but then asserts will be inserted into the code to prevent logic errors.

Execution

Once done, execute the binary adn you should be looking at the following results:

$ ./output
 Test matrix:
    [ 1 2 3 ]
    [ 4 5 6 ]
    [ 7 8 9 ]
    [ 10 11 12 ]

That's it, KIWAKU is properly installed and ready to use.