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++23 support (GCC 14+ or Clang 18+).
- CMake 3.20 or later.
- Asio development headers (1.28 or later).
libpq,libmysqlcppconn,libmongoc,libsqlite3,libmonetdb-mapilibcurl— SMTP transport forAppJobs::SendTestMail; also used bykalpasanruntime verbs.- Optional: OpenSSL for HTTPS, zlib for compression.
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 \
libcurl4-openssl-dev \
libpqxx-dev libmysqlcppconn-dev libsqlite3-dev \
libmongoc-dev libbson-dev
The starter's CMakeLists.txt picks libcurl up via
find_package(CURL REQUIRED) and links
CURL::libcurl into app_bin. No manual
configuration needed once the package is installed.
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 23)
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