Cppgres allows you to build Postgres extensions using C++: a high-performance, feature-rich language already supported by the same compiler toolchains used to develop for Postgres, like GCC and Clang.
- Header-only library
- Compile and runtime safety checks
- Automatic type mapping
- Ergonomic executor API
- Modern C++20 interface & implementation
- Direct integration with C
You don't really need to build this library as it is headers-only. You can,
however, use cppgres target from the included CMake file.
If copying the entire src directory is not convenient, it is quite easy to
get an amalgamated single-file header.
For example, using cpp-amalgamate:
cpp-amalgamate src/cppgres.hpp > cppgres.hppThis file can be used just as before:
#include <cppgres.h># prepare
cmake -S . -B build
# run tests
CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target all testIf you want to run tests on a specific version (or major version) of Postgres, specify the PGVER variable:
cmake -S . -B build -DPGVER=16By default, our build process will set up its own copy of Postgres. If you'd like to use your own build,
specify the PG_CONFIG variable:
cmake -S . -B build -DPG_CONFIG=/path/to/pg_config