Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUILD.md: ensure build_type and CMAKE_BUILD_TYPE match #5274

Merged
merged 6 commits into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ It fixes some source files to add missing `#include`s.
the `install-folder` or `-if` option to every `conan install` command
in the next step.

2. Generate CMake files for every configuration you want to build.
2. Use conan to generate CMake files for every configuration you want to build:

```
conan install .. --output-folder . --build missing --settings build_type=Release
conan install .. --output-folder . --build missing --settings build_type=Debug
```

To build Debug, in the next step, be sure to set `-DCMAKE_BUILD_TYPE=Debug`

For a single-configuration generator, e.g. `Unix Makefiles` or `Ninja`,
you only need to run this command once.
For a multi-configuration generator, e.g. `Visual Studio`, you may want to
Expand Down Expand Up @@ -258,13 +260,16 @@ It fixes some source files to add missing `#include`s.

Single-config generators:

Pass the CMake variable [`CMAKE_BUILD_TYPE`][build_type]
and make sure it matches the one of the `build_type` settings
you chose in the previous step.

For example, to build Debug, in the next command, replace "Release" with "Debug"

```
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -Dxrpld=ON -Dtests=ON ..
```

Pass the CMake variable [`CMAKE_BUILD_TYPE`][build_type]
and make sure it matches the `build_type` setting you chose in the previous
step.

Multi-config generators:

Expand All @@ -274,7 +279,7 @@ It fixes some source files to add missing `#include`s.

**Note:** You can pass build options for `rippled` in this step.

4. Build `rippled`.
5. Build `rippled`.

For a single-configuration generator, it will build whatever configuration
you passed for `CMAKE_BUILD_TYPE`. For a multi-configuration generator,
Expand All @@ -293,7 +298,7 @@ It fixes some source files to add missing `#include`s.
cmake --build . --config Debug
```

5. Test rippled.
6. Test rippled.

Single-config generators:

Expand Down Expand Up @@ -403,6 +408,23 @@ After any updates or changes to dependencies, you may need to do the following:
4. Re-run [conan install](#build-and-test).


### 'protobuf/port_def.inc' file not found

If `cmake --build .` results in an error due to a missing a protobuf file, then you might have generated CMake files for a different `build_type` than the `CMAKE_BUILD_TYPE` you passed to conan.

```
/rippled/.build/pb-xrpl.libpb/xrpl/proto/ripple.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
10 | #include <google/protobuf/port_def.inc>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

For example, if you want to build Debug:

1. For conan install, pass `--settings build_type=Debug`
2. For cmake, pass `-DCMAKE_BUILD_TYPE=Debug`


### no std::result_of

If your compiler version is recent enough to have removed `std::result_of` as
Expand Down
Loading