Skip to content

Commit 56f4dc5

Browse files
authored
chore: Remove all conan options and use purely CMake targets (#2538)
Closes: #2535
1 parent c40cd81 commit 56f4dc5

File tree

5 files changed

+56
-63
lines changed

5 files changed

+56
-63
lines changed

.github/actions/cmake/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ runs:
6464
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake \
6565
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
6666
"${SANITIZER_OPTION}" \
67+
-Dtests=ON \
6768
-Dintegration_tests="${INTEGRATION_TESTS}" \
6869
-Dbenchmark="${BENCHMARK}" \
6970
-Dcoverage="${COVERAGE}" \

.github/actions/conan/action.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ inputs:
1717
description: Build type for third-party libraries and clio. Could be 'Release', 'Debug'
1818
required: true
1919
default: "Release"
20-
build_benchmark:
21-
description: Whether to build benchmark tests
22-
required: true
23-
default: "true"
2420

2521
runs:
2622
using: composite
@@ -33,13 +29,10 @@ runs:
3329
shell: bash
3430
env:
3531
CONAN_BUILD_OPTION: "${{ inputs.force_conan_source_build == 'true' && '*' || 'missing' }}"
36-
BUILD_BENCHMARK: "${{ inputs.build_benchmark == 'true' && 'True' || 'False' }}"
3732
run: |
3833
conan \
3934
install . \
4035
-of build \
4136
-b "$CONAN_BUILD_OPTION" \
4237
-s "build_type=${{ inputs.build_type }}" \
43-
-o "&:tests=True" \
44-
-o "&:benchmark=${BUILD_BENCHMARK}" \
4538
--profile:all "${{ inputs.conan_profile }}"

.github/workflows/check_libxrpl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Update conan lockfile
3939
shell: bash
4040
run: |
41-
conan lock create . -o '&:tests=True' -o '&:benchmark=True' --profile:all ${{ env.CONAN_PROFILE }}
41+
conan lock create . --profile:all ${{ env.CONAN_PROFILE }}
4242
4343
- name: Run conan
4444
uses: ./.github/actions/conan

conanfile.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ class ClioConan(ConanFile):
99
url = 'https://github.com/xrplf/clio'
1010
description = 'Clio RPC server'
1111
settings = 'os', 'compiler', 'build_type', 'arch'
12-
options = {
13-
'tests': [True, False],
14-
'benchmark': [True, False],
15-
}
12+
options = {}
1613

1714
requires = [
1815
'boost/1.83.0',
@@ -28,9 +25,6 @@ class ClioConan(ConanFile):
2825
]
2926

3027
default_options = {
31-
'tests': False,
32-
'benchmark': False,
33-
3428
'xrpl/*:tests': False,
3529
'xrpl/*:rocksdb': False,
3630
'cassandra-cpp-driver/*:shared': False,
@@ -51,10 +45,8 @@ class ClioConan(ConanFile):
5145
)
5246

5347
def requirements(self):
54-
if self.options.tests or self.options.integration_tests:
55-
self.requires('gtest/1.14.0')
56-
if self.options.benchmark:
57-
self.requires('benchmark/1.9.4')
48+
self.requires('gtest/1.14.0')
49+
self.requires('benchmark/1.9.4')
5850

5951
def configure(self):
6052
if self.settings.compiler == 'apple-clang':
@@ -70,8 +62,6 @@ def layout(self):
7062

7163
def generate(self):
7264
tc = CMakeToolchain(self)
73-
for option_name, option_value in self.options.items():
74-
tc.variables[option_name] = option_value
7565
tc.generate()
7666

7767
def build(self):

docs/build-clio.md

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -107,62 +107,72 @@ You have to update this file every time you add a new dependency or change a rev
107107
To do that, run the following command in the repository root:
108108

109109
```bash
110-
conan lock create . -o '&:tests=True' -o '&:benchmark=True'
110+
conan lock create .
111111
```
112112

113113
## Building Clio
114114

115-
Navigate to Clio's root directory and run:
115+
1. Navigate to Clio's root directory and run:
116116

117-
```sh
118-
mkdir build && cd build
119-
# You can also specify profile explicitly by adding `--profile:all <PROFILE_NAME>`
120-
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True'
121-
# You can also add -GNinja to use Ninja build system instead of Make
122-
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
123-
cmake --build . --parallel 8 # or without the number if you feel extra adventurous
124-
```
125-
126-
> [!TIP]
127-
> You can omit the `-o '&:tests=True'` if you don't want to build `clio_tests`.
128-
129-
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).
117+
```sh
118+
mkdir build && cd build
119+
```
130120

131-
> [!TIP]
132-
> To generate a Code Coverage report, include `-o '&:coverage=True'` in the `conan install` command above, along with `-o '&:tests=True'` to enable tests.
133-
> After running the `cmake` commands, execute `make clio_tests-ccov`.
134-
> The coverage report will be found at `clio_tests-llvm-cov/index.html`.
121+
2. Install dependencies through conan.
135122

136-
<!-- markdownlint-disable-line MD028 -->
123+
```sh
124+
conan install .. --output-folder . --build missing --settings build_type=Release
125+
```
137126

138-
> [!NOTE]
139-
> 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.
127+
> You can add `--profile:all <PROFILE_NAME>` to choose a specific conan profile.
140128
141-
### Generating API docs for Clio
129+
3. Configure and generate build files with CMake.
142130

143-
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.
131+
```sh
132+
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
133+
```
144134

145-
To generate the API docs:
135+
> You can add `-GNinja` to use the Ninja build system (instead of Make).
146136
147-
1. First, include `-o '&:docs=True'` in the conan install command. For example:
137+
4. Now, you can build all targets or specific ones:
148138

149139
```sh
150-
mkdir build && cd build
151-
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:docs=True'
140+
# builds all targets
141+
cmake --build . --parallel 8
142+
# builds only clio_server target
143+
cmake --build . --parallel 8 --target clio_server
152144
```
153145

154-
2. Once that has completed successfully, run the `cmake` command and add the `--target docs` option:
146+
You should see `clio_server` and `clio_tests` in the current directory.
155147

156-
```sh
157-
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
158-
cmake --build . --parallel 8 --target docs
159-
```
148+
> [!NOTE]
149+
> 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.
160150
161-
3. Go to `build/docs/html` to view the generated files.
151+
### CMake options
162152

163-
Open the `index.html` file in your browser to see the documentation pages.
153+
There are several CMake options you can use to customize the build:
164154

165-
![API index page](./img/doxygen-docs-output.png "API index page")
155+
| CMake Option | Default | CMake Target | Description |
156+
| --------------------- | ------- | -------------------------------------------------------- | ------------------------------------- |
157+
| `-Dcoverage` | OFF | `clio_tests-ccov` | Enables code coverage generation |
158+
| `-Dtests` | OFF | `clio_tests` | Enables unit tests |
159+
| `-Dintegration_tests` | OFF | `clio_integration_tests` | Enables integration tests |
160+
| `-Dbenchmark` | OFF | `clio_benchmark` | Enables benchmark executable |
161+
| `-Ddocs` | OFF | `docs` | Enables API documentation generation |
162+
| `-Dlint` | OFF | See [#clang-tidy](#using-clang-tidy-for-static-analysis) | Enables `clang-tidy` static analysis |
163+
| `-Dsan` | N/A | N/A | Enables Sanitizer (asan, tsan, ubsan) |
164+
| `-Dpackage` | OFF | N/A | Creates a debian package |
165+
166+
### Generating API docs for Clio
167+
168+
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.
169+
170+
To generate the API docs, please use CMake option `-Ddocs=ON` as described above and build the `docs` target.
171+
172+
To view the generated files, go to `build/docs/html`.
173+
Open the `index.html` file in your browser to see the documentation pages.
174+
175+
![API index page](./img/doxygen-docs-output.png "API index page")
166176

167177
## Building Clio with Docker
168178

@@ -171,12 +181,11 @@ It is also possible to build Clio using [Docker](https://www.docker.com/) if you
171181
```sh
172182
docker run -it ghcr.io/xrplf/clio-ci:384e79cd32f5f6c0ab9be3a1122ead41c5a7e67d
173183
git clone https://github.com/XRPLF/clio
174-
mkdir build && cd build
175-
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True'
176-
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
177-
cmake --build . --parallel 8 # or without the number if you feel extra adventurous
184+
cd clio
178185
```
179186

187+
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.
188+
180189
## Developing against `rippled` in standalone mode
181190

182191
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
229238
## Using `clang-tidy` for static analysis
230239

231240
Clang-tidy can be run by CMake when building the project.
232-
To achieve this, you just need to provide the option `-o '&:lint=True'` for the `conan install` command:
241+
To achieve this, you just need to provide the option `-Dlint=ON` when generating CMake files:
233242

234243
```sh
235-
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:lint=True' --profile:all clang
244+
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -Dlint=ON ..
236245
```
237246

238247
By default CMake will try to find `clang-tidy` automatically in your system.

0 commit comments

Comments
 (0)