Add initial Conan integration (#712)

Fixes #645
This commit is contained in:
Alex Kremer
2023-07-24 18:43:02 +01:00
committed by GitHub
parent 2336148d0d
commit c6ca650767
76 changed files with 626 additions and 572 deletions

View File

@@ -1,3 +1,78 @@
# Temporary build instructions
## Prerequisites
1. Make sure you have conan 1.x installed and active (use brew on mac). Conan may have been upgraded to v2 and that may not work.
2. You should already have a Conan profile after building rippled. Example:
```
[settings]
os=Macos
os_build=Macos
arch=armv8
arch_build=armv8
compiler=apple-clang
compiler.version=14
compiler.libcxx=libc++
build_type=Release
compiler.cppstd=20
[options]
boost:extra_b2_flags=define=BOOST_ASIO_HAS_STD_INVOKE_RESULT
[build_requires]
[env]
CFLAGS=-DBOOST_ASIO_HAS_STD_INVOKE_RESULT
CXXFLAGS=-DBOOST_ASIO_HAS_STD_INVOKE_RESULT
[conf]
tools.build:cxxflags=['-DBOOST_ASIO_HAS_STD_INVOKE_RESULT']
tools.build:cflags=['-DBOOST_ASIO_HAS_STD_INVOKE_RESULT']
```
## Using artifactory (temporary packages)
```sh
conan remote add conan-non-prod http://18.143.149.228:8081/artifactory/api/conan/conan-non-prod
```
Now you should be able to download prebuilt `xrpl` package on some platforms. At the very least you should be able to skip the local package step for `rippled` (as described below) and conan should be able to fetch it from artifactory instead.
## Preparing local packages (alternative to artifactory)
1. Get rippled from [this branch](https://github.com/thejohnfreeman/clio/tree/conan)
2. Remove old packages you may have cached:
```sh
conan remove -f xrpl/1.12.0-b2
conan remove -f cassandra-cpp-driver/2.16.2
```
3. In a clone of rippled from step 1, build rippled as per their instructions. pay attention to these commands:
```sh
conan export external/snappy snappy/1.1.9@
conan export external/soci soci/4.0.3@
mkdir build && cd build
conan install .. --output-folder . --build missing --settings build_type=Release
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel 8 # or without the number if you feel extra adventurous
cd - # to go back to root of rippled
```
4. Perform this command at the root directory of rippled
```sh
conan export .
```
this will export a local package `xrpl/1.12.0-b2`.
5. Navigate to clio's root directory and perform
```sh
conan export external/cassandra # export our "custom" cassandra driver package
mkdir build && cd build
conan install .. --output-folder . --build missing --settings build_type=Release -o tests=True
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --parallel 8 # or without the number if you feel extra adventurous
```
If all goes well, `conan install` will find required packages and `cmake` will do the rest. you should end up with `clio_server` and `clio_unittests` in the `build` directory (the current directory).
Please note that a few unittests are currently failing. See below.
## Things to fix
1. Figure out what to do with `ripple::Fees` that is now missing the `units` member. It was used in a few places and couple unittests are broken because of it.
2. Fix build on CI (currently using old CMake. need to use conan instead).
3. Fix code coverage support (see 'coverage' option in conanfile).
4. See if we can contribute/push our cassandra-cpp-driver to conan center so we don't need to export it before we able to use it.
5. Try to improve the new asio code that is using `async_compose` and potentially the `FutureWithCallback` way of accepting the callback.
# Clio
Clio is an XRP Ledger API server. Clio is optimized for RPC calls, over WebSocket or JSON-RPC. Validated
historical ledger and transaction data are stored in a more space-efficient format,