Setup on Linux

This page walks you through getting Garvan installed and building your first executable on a Linux machine.

Requirements

  • A C++ compiler with C++20 support (GCC 11+ or Clang 12+).
  • CMake 3.20 or later.
  • Asio development headers (1.28 or later).
  • libpq, libmysqlcppconn, libmongoc, libsqlite3, libmonetdb-mapi
  • Optional: OpenSSL for HTTPS, zlib for compression.
Note

The bundled libgarvan.a in vendors/Garvan/ already links Crow internally, so you only need the system libraries listed above.

Installing libgarvan

The fastest path is to clone the starter repository, which ships libgarvan.a, the Crow headers, and a working CMakeLists.txt:

git clone https://github.com/nikiarsov777/garvan-starter.git my-app
cd my-app

On Debian/Ubuntu you can install the database drivers in one shot:

sudo apt update
sudo apt install -y \
    build-essential cmake \
    libasio-dev libssl-dev zlib1g-dev \
    libpqxx-dev libmysqlcppconn-dev libsqlite3-dev \
    libmongoc-dev libbson-dev

Building from source

If you want to build Garvan itself (rather than use the bundled archive), clone the source tree and run CMake:

git clone https://github.com/nikiarsov777/garvancpp-starter.git
cd garvan
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
sudo cmake --install build

Compiling your project

Add the following to your project's CMakeLists.txt:

cmake_minimum_required(VERSION 3.20)
project(MyApp CXX)
set(CMAKE_CXX_STANDARD 20)

add_executable(my_app main.cpp)

target_include_directories(my_app PRIVATE
    vendors/Garvan
    vendors/Garvan/include
)

target_link_libraries(my_app PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/vendors/Garvan/libgarvan.a
    pthread
)

Then build:

cmake -S . -B build
cmake --build build
./build/my_app

Alternative build:

bash ./make.sh