Skip to content

Commit f1ae608

Browse files
committed
chore: Remove all conan options and use purely CMake targets
1 parent 9edc26a commit f1ae608

File tree

4 files changed

+57
-57
lines changed

4 files changed

+57
-57
lines changed

.github/actions/conan/action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,4 @@ runs:
4040
-of build \
4141
-b "$CONAN_BUILD_OPTION" \
4242
-s "build_type=${{ inputs.build_type }}" \
43-
-o "&:tests=True" \
44-
-o "&:benchmark=${BUILD_BENCHMARK}" \
4543
--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 & 11 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':

docs/build-clio.md

Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -107,62 +107,73 @@ 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. Create build directory
116+
Navigate to Clio's root directory and run:
116117

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-
```
118+
```sh
119+
mkdir build && cd build
120+
```
125121

126-
> [!TIP]
127-
> You can omit the `-o '&:tests=True'` if you don't want to build `clio_tests`.
122+
2. Install dependencies through conan
128123

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).
124+
```sh
125+
# You can also specify profile explicitly by adding `--profile:all <PROFILE_NAME>`
126+
conan install .. --output-folder . --build missing --settings build_type=Release
127+
```
130128

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`.
129+
If successful, `conan install` will find the required packages and `cmake` will do the rest.
135130

136-
<!-- markdownlint-disable-line MD028 -->
131+
3. Configure and generate build files with CMake
137132

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.
133+
```sh
134+
# You can also add -GNinja to use Ninja build system instead of Make
135+
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
136+
```
140137

141-
### Generating API docs for Clio
138+
4. Now, you can build all targets or specific ones:
142139

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.
140+
```sh
141+
# builds all targets
142+
cmake --build . --parallel 8
143+
# builds only clio_server target
144+
cmake --build . --parallel 8 --target clio_server
145+
```
144146

145-
To generate the API docs:
147+
You should see `clio_server` and `clio_tests` in the `build` directory (the current directory).
146148

147-
1. First, include `-o '&:docs=True'` in the conan install command. For example:
149+
> [!NOTE]
150+
> 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.
148151
149-
```sh
150-
mkdir build && cd build
151-
conan install .. --output-folder . --build missing --settings build_type=Release -o '&:tests=True' -o '&:docs=True'
152-
```
152+
### CMake options
153153

154-
2. Once that has completed successfully, run the `cmake` command and add the `--target docs` option:
154+
There are several CMake options you can use to customize the build:
155155

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-
```
156+
| CMake Option | Default | CMake Target | Description |
157+
| --------------------- | ------- | ------------------------ | ------------------------------------- |
158+
| `-Dcoverage` | OFF | `clio_tests-ccov` | Enables code coverage generation |
159+
| `-Dtests` | OFF | `clio_tests` | Enables unit tests |
160+
| `-Dintegration_tests` | OFF | `clio_integration_tests` | Enables integration tests |
161+
| `-Dbenchmark` | OFF | `clio_benchmark` | Enables benchmark executable |
162+
| `-Ddocs` | OFF | `docs` | Enables API documentation generation |
163+
| `-Dlint` | OFF | See #clang-tidy | Enables `clang-tidy` static analysis |
164+
| `-Dsan` | N/A | N/A | Enables Sanitizer (asan, tsan, ubsan) |
165+
| `-Dpackage` | OFF | N/A | Creates a debian package |
160166

161-
3. Go to `build/docs/html` to view the generated files.
167+
### Generating API docs for Clio
162168

163-
Open the `index.html` file in your browser to see the documentation pages.
169+
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.
164170

165-
![API index page](./img/doxygen-docs-output.png "API index page")
171+
To generate the API docs, please use CMake option `-Ddocs=ON` as described above and build the `docs` target.
172+
173+
To view the generated files, go to `build/docs/html`.
174+
Open the `index.html` file in your browser to see the documentation pages.
175+
176+
![API index page](./img/doxygen-docs-output.png "API index page")
166177

167178
## Building Clio with Docker
168179

@@ -171,12 +182,11 @@ It is also possible to build Clio using [Docker](https://www.docker.com/) if you
171182
```sh
172183
docker run -it ghcr.io/xrplf/clio-ci:0e8896ad064a5290c4805318b549df16403ca2d7
173184
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
185+
cd clio
178186
```
179187

188+
And then follow the same steps as in [Building Clio](#building-clio), use `--profile:all gcc` or `--profile:all clang` with `conan install` command to choose the desired compiler.
189+
180190
## Developing against `rippled` in standalone mode
181191

182192
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:
@@ -226,13 +236,13 @@ Sometimes, during development, you need to build against a custom version of `li
226236

227237
See [Building Clio](#building-clio) for details.
228238

229-
## Using `clang-tidy` for static analysis
239+
## Using `clang-tidy` for static analysis {#clang-tidy}
230240

231241
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:
242+
To achieve this, you just need to provide the option `-Dlint=ON` when generating CMake files:
233243

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

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

0 commit comments

Comments
 (0)