mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-16 01:35:52 +00:00
chore: Remove all conan options and use purely CMake targets (#2538)
Closes: https://github.com/XRPLF/clio/pull/2535
This commit is contained in:
1
.github/actions/cmake/action.yml
vendored
1
.github/actions/cmake/action.yml
vendored
@@ -64,6 +64,7 @@ runs:
|
|||||||
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
|
||||||
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
|
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
|
||||||
"${SANITIZER_OPTION}" \
|
"${SANITIZER_OPTION}" \
|
||||||
|
-Dtests=ON \
|
||||||
-Dintegration_tests="${INTEGRATION_TESTS}" \
|
-Dintegration_tests="${INTEGRATION_TESTS}" \
|
||||||
-Dbenchmark="${BENCHMARK}" \
|
-Dbenchmark="${BENCHMARK}" \
|
||||||
-Dcoverage="${COVERAGE}" \
|
-Dcoverage="${COVERAGE}" \
|
||||||
|
|||||||
7
.github/actions/conan/action.yml
vendored
7
.github/actions/conan/action.yml
vendored
@@ -17,10 +17,6 @@ inputs:
|
|||||||
description: Build type for third-party libraries and clio. Could be 'Release', 'Debug'
|
description: Build type for third-party libraries and clio. Could be 'Release', 'Debug'
|
||||||
required: true
|
required: true
|
||||||
default: "Release"
|
default: "Release"
|
||||||
build_benchmark:
|
|
||||||
description: Whether to build benchmark tests
|
|
||||||
required: true
|
|
||||||
default: "true"
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
@@ -33,13 +29,10 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CONAN_BUILD_OPTION: "${{ inputs.force_conan_source_build == 'true' && '*' || 'missing' }}"
|
CONAN_BUILD_OPTION: "${{ inputs.force_conan_source_build == 'true' && '*' || 'missing' }}"
|
||||||
BUILD_BENCHMARK: "${{ inputs.build_benchmark == 'true' && 'True' || 'False' }}"
|
|
||||||
run: |
|
run: |
|
||||||
conan \
|
conan \
|
||||||
install . \
|
install . \
|
||||||
-of build \
|
-of build \
|
||||||
-b "$CONAN_BUILD_OPTION" \
|
-b "$CONAN_BUILD_OPTION" \
|
||||||
-s "build_type=${{ inputs.build_type }}" \
|
-s "build_type=${{ inputs.build_type }}" \
|
||||||
-o "&:tests=True" \
|
|
||||||
-o "&:benchmark=${BUILD_BENCHMARK}" \
|
|
||||||
--profile:all "${{ inputs.conan_profile }}"
|
--profile:all "${{ inputs.conan_profile }}"
|
||||||
|
|||||||
2
.github/workflows/check_libxrpl.yml
vendored
2
.github/workflows/check_libxrpl.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
- name: Update conan lockfile
|
- name: Update conan lockfile
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
conan lock create . -o '&:tests=True' -o '&:benchmark=True' --profile:all ${{ env.CONAN_PROFILE }}
|
conan lock create . --profile:all ${{ env.CONAN_PROFILE }}
|
||||||
|
|
||||||
- name: Run conan
|
- name: Run conan
|
||||||
uses: ./.github/actions/conan
|
uses: ./.github/actions/conan
|
||||||
|
|||||||
16
conanfile.py
16
conanfile.py
@@ -9,10 +9,7 @@ class ClioConan(ConanFile):
|
|||||||
url = 'https://github.com/xrplf/clio'
|
url = 'https://github.com/xrplf/clio'
|
||||||
description = 'Clio RPC server'
|
description = 'Clio RPC server'
|
||||||
settings = 'os', 'compiler', 'build_type', 'arch'
|
settings = 'os', 'compiler', 'build_type', 'arch'
|
||||||
options = {
|
options = {}
|
||||||
'tests': [True, False],
|
|
||||||
'benchmark': [True, False],
|
|
||||||
}
|
|
||||||
|
|
||||||
requires = [
|
requires = [
|
||||||
'boost/1.83.0',
|
'boost/1.83.0',
|
||||||
@@ -28,9 +25,6 @@ class ClioConan(ConanFile):
|
|||||||
]
|
]
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
'tests': False,
|
|
||||||
'benchmark': False,
|
|
||||||
|
|
||||||
'xrpl/*:tests': False,
|
'xrpl/*:tests': False,
|
||||||
'xrpl/*:rocksdb': False,
|
'xrpl/*:rocksdb': False,
|
||||||
'cassandra-cpp-driver/*:shared': False,
|
'cassandra-cpp-driver/*:shared': False,
|
||||||
@@ -51,10 +45,8 @@ class ClioConan(ConanFile):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def requirements(self):
|
def requirements(self):
|
||||||
if self.options.tests or self.options.integration_tests:
|
self.requires('gtest/1.14.0')
|
||||||
self.requires('gtest/1.14.0')
|
self.requires('benchmark/1.9.4')
|
||||||
if self.options.benchmark:
|
|
||||||
self.requires('benchmark/1.9.4')
|
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
if self.settings.compiler == 'apple-clang':
|
if self.settings.compiler == 'apple-clang':
|
||||||
@@ -70,8 +62,6 @@ class ClioConan(ConanFile):
|
|||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
tc = CMakeToolchain(self)
|
tc = CMakeToolchain(self)
|
||||||
for option_name, option_value in self.options.items():
|
|
||||||
tc.variables[option_name] = option_value
|
|
||||||
tc.generate()
|
tc.generate()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|||||||
@@ -107,62 +107,72 @@ You have to update this file every time you add a new dependency or change a rev
|
|||||||
To do that, run the following command in the repository root:
|
To do that, run the following command in the repository root:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
conan lock create . -o '&:tests=True' -o '&:benchmark=True'
|
conan lock create .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building Clio
|
## Building Clio
|
||||||
|
|
||||||
Navigate to Clio's root directory and run:
|
1. Navigate to Clio's root directory and run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
# You can also specify profile explicitly by adding `--profile:all <PROFILE_NAME>`
|
```
|
||||||
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True'
|
|
||||||
# You can also add -GNinja to use Ninja build system instead of Make
|
|
||||||
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
|
|
||||||
```
|
|
||||||
|
|
||||||
> [!TIP]
|
2. Install dependencies through conan.
|
||||||
> You can omit the `-o '&:tests=True'` if you don't want to build `clio_tests`.
|
|
||||||
|
|
||||||
If successful, `conan install` will find the required packages and `cmake` will do the rest. You should see `clio_server` and `clio_tests` in the `build` directory (the current directory).
|
```sh
|
||||||
|
conan install .. --output-folder . --build missing --settings build_type=Release
|
||||||
|
```
|
||||||
|
|
||||||
> [!TIP]
|
> You can add `--profile:all <PROFILE_NAME>` to choose a specific conan profile.
|
||||||
> To generate a Code Coverage report, include `-o '&:coverage=True'` in the `conan install` command above, along with `-o '&:tests=True'` to enable tests.
|
|
||||||
> After running the `cmake` commands, execute `make clio_tests-ccov`.
|
|
||||||
> The coverage report will be found at `clio_tests-llvm-cov/index.html`.
|
|
||||||
|
|
||||||
<!-- markdownlint-disable-line MD028 -->
|
3. Configure and generate build files with CMake.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||||
|
```
|
||||||
|
|
||||||
|
> You can add `-GNinja` to use the Ninja build system (instead of Make).
|
||||||
|
|
||||||
|
4. Now, you can build all targets or specific ones:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# builds all targets
|
||||||
|
cmake --build . --parallel 8
|
||||||
|
# builds only clio_server target
|
||||||
|
cmake --build . --parallel 8 --target clio_server
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see `clio_server` and `clio_tests` in the current directory.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> If you've built Clio before and the build is now failing, it's likely due to updated dependencies. Try deleting the build folder and then rerunning the Conan and CMake commands mentioned above.
|
> If you've built Clio before and the build is now failing, it's likely due to updated dependencies. Try deleting the build folder and then rerunning the Conan and CMake commands mentioned above.
|
||||||
|
|
||||||
|
### CMake options
|
||||||
|
|
||||||
|
There are several CMake options you can use to customize the build:
|
||||||
|
|
||||||
|
| CMake Option | Default | CMake Target | Description |
|
||||||
|
| --------------------- | ------- | -------------------------------------------------------- | ------------------------------------- |
|
||||||
|
| `-Dcoverage` | OFF | `clio_tests-ccov` | Enables code coverage generation |
|
||||||
|
| `-Dtests` | OFF | `clio_tests` | Enables unit tests |
|
||||||
|
| `-Dintegration_tests` | OFF | `clio_integration_tests` | Enables integration tests |
|
||||||
|
| `-Dbenchmark` | OFF | `clio_benchmark` | Enables benchmark executable |
|
||||||
|
| `-Ddocs` | OFF | `docs` | Enables API documentation generation |
|
||||||
|
| `-Dlint` | OFF | See [#clang-tidy](#using-clang-tidy-for-static-analysis) | Enables `clang-tidy` static analysis |
|
||||||
|
| `-Dsan` | N/A | N/A | Enables Sanitizer (asan, tsan, ubsan) |
|
||||||
|
| `-Dpackage` | OFF | N/A | Creates a debian package |
|
||||||
|
|
||||||
### Generating API docs for Clio
|
### Generating API docs for Clio
|
||||||
|
|
||||||
The API documentation for Clio is generated by [Doxygen](https://www.doxygen.nl/index.html). If you want to generate the API documentation when building Clio, make sure to install Doxygen 1.12.0 on your system.
|
The API documentation for Clio is generated by [Doxygen](https://www.doxygen.nl/index.html). If you want to generate the API documentation when building Clio, make sure to install Doxygen 1.12.0 on your system.
|
||||||
|
|
||||||
To generate the API docs:
|
To generate the API docs, please use CMake option `-Ddocs=ON` as described above and build the `docs` target.
|
||||||
|
|
||||||
1. First, include `-o '&:docs=True'` in the conan install command. For example:
|
To view the generated files, go to `build/docs/html`.
|
||||||
|
Open the `index.html` file in your browser to see the documentation pages.
|
||||||
|
|
||||||
```sh
|

|
||||||
mkdir build && cd build
|
|
||||||
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:docs=True'
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Once that has completed successfully, run the `cmake` command and add the `--target docs` option:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
cmake --build . --parallel 8 --target docs
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Go to `build/docs/html` to view the generated files.
|
|
||||||
|
|
||||||
Open the `index.html` file in your browser to see the documentation pages.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Building Clio with Docker
|
## Building Clio with Docker
|
||||||
|
|
||||||
@@ -171,12 +181,11 @@ It is also possible to build Clio using [Docker](https://www.docker.com/) if you
|
|||||||
```sh
|
```sh
|
||||||
docker run -it ghcr.io/xrplf/clio-ci:384e79cd32f5f6c0ab9be3a1122ead41c5a7e67d
|
docker run -it ghcr.io/xrplf/clio-ci:384e79cd32f5f6c0ab9be3a1122ead41c5a7e67d
|
||||||
git clone https://github.com/XRPLF/clio
|
git clone https://github.com/XRPLF/clio
|
||||||
mkdir build && cd build
|
cd clio
|
||||||
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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Follow the same steps in the [Building Clio](#building-clio) section. You can use `--profile:all gcc` or `--profile:all clang` with the `conan install` command to choose the desired compiler.
|
||||||
|
|
||||||
## Developing against `rippled` in standalone mode
|
## Developing against `rippled` in standalone mode
|
||||||
|
|
||||||
If you wish to develop against a `rippled` instance running in standalone mode there are a few quirks of both Clio and `rippled` that you need to keep in mind. You must:
|
If you wish to develop against a `rippled` instance running in standalone mode there are a few quirks of both Clio and `rippled` that you need to keep in mind. You must:
|
||||||
@@ -229,10 +238,10 @@ Sometimes, during development, you need to build against a custom version of `li
|
|||||||
## Using `clang-tidy` for static analysis
|
## Using `clang-tidy` for static analysis
|
||||||
|
|
||||||
Clang-tidy can be run by CMake when building the project.
|
Clang-tidy can be run by CMake when building the project.
|
||||||
To achieve this, you just need to provide the option `-o '&:lint=True'` for the `conan install` command:
|
To achieve this, you just need to provide the option `-Dlint=ON` when generating CMake files:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:lint=True' --profile:all clang
|
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -Dlint=ON ..
|
||||||
```
|
```
|
||||||
|
|
||||||
By default CMake will try to find `clang-tidy` automatically in your system.
|
By default CMake will try to find `clang-tidy` automatically in your system.
|
||||||
|
|||||||
Reference in New Issue
Block a user