Skip to content

How to Build Trinity

Mark Papadakis edited this page Nov 8, 2019 · 6 revisions
  1. Initialise the various submodules
git submodule update  --init Switch/ext/FastPFor Switch/ext/streamvbyte Switch/ext_snappy
  1. Build the Submodules
(cd Switch/ext/FastPFor && mkdir -p build && cd build && cmake ../ && make)
(cd Switch/ext_snappy && mkdir -p build && cd build && cmake ../ && make)
(cd Switch/ext/streamvbyte && mkdir -p build && cd build && cmake ../ && make)
  1. Build Trinity
$> make

If nothing fails, this will produce the library libthe_trinity.a.

Using Trinity

You can start using Trinity in your applications by linking against that library and adding Trinity's directory in the list of directories to be searched for header files using -I, like so:

$> clang++ -std=c++1z -I ${TRINITY_BASEDIR} -L ${TRINITY_BASEDIR } \
-lthe_trinity \
-l Switch/ext/FastPFor/build/FastPFor \
-l Switch/ext_snappy/build/snappy   \
-l Switch/ext/streamvbyte/build/streamvbyte_static
google_search.cpp

This example assumes that environment variable TRINITY_BASEDIR is set to the Trinity codebase directory and that your application is implemented in google_search.cpp

Please note that Trinity requires C++17 support (hence the use of -std=c++1z option). If you need support for C++14 (C++11 won't be supported; it doesn't support generalised lambda capture semantics), you should be able to accomplish it easily by modifying the codebase accordingly.

Clone this wiki locally