| 1 | mtxclient |
| 2 | --- |
| 3 | [](https://travis-ci.org/Nheko-Reborn/mtxclient) |
| 4 | [](https://ci.appveyor.com/project/redsky17/mtxclient/branch/master) |
| 5 | [](https://codecov.io/gh/Nheko-Reborn/mtxclient) |
| 6 | [](http://github.com/badges/stability-badges) |
| 7 | [](https://nheko-reborn.pages.nheko.im/mtxclient/index.html) |
| 8 | |
| 9 | Client API library for the Matrix protocol. |
| 10 | |
| 11 | ## Build instructions |
| 12 | |
| 13 | ### Dependencies |
| 14 | |
| 15 | - Coeurl (A C++ wrapper around curl.) |
| 16 | - OpenSSL |
| 17 | - C++ 20 compiler |
| 18 | - CMake 3.15 or greater (lower versions can work, but not all build system options may work.) |
| 19 | - Google Test (for testing) |
| 20 | - spdlog (for logging) |
| 21 | |
| 22 | 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. |
| 23 | |
| 24 | | cmake flag | description | |
| 25 | |---------------------|-------------| |
| 26 | | USE_BUNDLED_COEURL | Use the bundled version of coeurl. | |
| 27 | | USE_BUNDLED_LIBEVENT| Use the bundled version of libevent (coeurl dependency). | |
| 28 | | USE_BUNDLED_LIBCURL | Use the bundled version of curl (coeurl dependency). | |
| 29 | | USE_BUNDLED_COEURL | Use the bundled version of coeurl. | |
| 30 | | USE_BUNDLED_SPDLOG | Use the bundled version of spdlog. | |
| 31 | | USE_BUNDLED_OLM | Use the bundled version of libolm. | |
| 32 | | USE_BUNDLED_GTEST | Use the bundled version of Google Test. | |
| 33 | | USE_BUNDLED_JSON | Use the bundled version of nlohmann json. | |
| 34 | | USE_BUNDLED_OPENSSL | Use the bundled version of OpenSSL. | |
| 35 | | USE_BUNDLED_RE2 | Use the bundled version of re2. | |
| 36 | |
| 37 | Below is an example which will build the library along with the tests & examples. |
| 38 | |
| 39 | #### Linux |
| 40 | |
| 41 | ```bash |
| 42 | cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug |
| 43 | cmake --build build |
| 44 | ``` |
| 45 | |
| 46 | #### macOS |
| 47 | |
| 48 | You will need to pass as argument (`-DOPENSSL_ROOT_DIR`) the installation root of openssl. |
| 49 | |
| 50 | ```bash |
| 51 | cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl |
| 52 | cmake --build build |
| 53 | ``` |
| 54 | |
| 55 | You can toggle off the tests & examples by passing `-DBUILD_LIB_TESTS=OFF` & |
| 56 | `-DBUILD_LIB_EXAMPLES=OFF` respectively. |
| 57 | |
| 58 | ## Running the tests |
| 59 | |
| 60 | In order to run the integration tests you'll need a local synapse instance. You |
| 61 | can start an instance with docker by running the following |
| 62 | |
| 63 | ```bash |
| 64 | make synapse |
| 65 | ``` |
| 66 | then run the test suite |
| 67 | |
| 68 | ```bash |
| 69 | make test |
| 70 | ``` |