mtxclient

Image Image Image Image Image

Client API library for the Matrix protocol.

Build instructions

Dependencies

  • Coeurl (A C++ wrapper around curl.)
  • OpenSSL
  • C++ 20 compiler
  • CMake 3.15 or greater (lower versions can work, but not all build system options may work.)
  • Google Test (for testing)
  • spdlog (for logging)

If you are missing some or all of those above dependencies, you can add -DHUNTER_ENABLED=ON to the cmake configure command to use bundled dependencies. You can finetune them with the following variables. They default to ON, if Hunter is enabled and to OFF otherwise.

cmake flagdescription
USE_BUNDLED_COEURLUse the bundled version of coeurl.
USE_BUNDLED_LIBEVENTUse the bundled version of libevent (coeurl dependency).
USE_BUNDLED_LIBCURLUse the bundled version of curl (coeurl dependency).
USE_BUNDLED_COEURLUse the bundled version of coeurl.
USE_BUNDLED_SPDLOGUse the bundled version of spdlog.
USE_BUNDLED_OLMUse the bundled version of libolm.
USE_BUNDLED_GTESTUse the bundled version of Google Test.
USE_BUNDLED_JSONUse the bundled version of nlohmann json.
USE_BUNDLED_OPENSSLUse the bundled version of OpenSSL.
USE_BUNDLED_RE2Use the bundled version of re2.

Below is an example which will build the library along with the tests & examples.

Linux

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug
cmake --build build

macOS

You will need to pass as argument (-DOPENSSL_ROOT_DIR) the installation root of openssl.

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl
cmake --build build

You can toggle off the tests & examples by passing -DBUILD_LIB_TESTS=OFF & -DBUILD_LIB_EXAMPLES=OFF respectively.

Running the tests

In order to run the integration tests you'll need a local synapse instance. You can start an instance with docker by running the following

make synapse then run the test suite

make test