Files

80 lines
2.0 KiB
Markdown
Raw Permalink Normal View History

2025-03-06 22:24:39 +00:00
# libloot-rs C++ wrapper
2025-06-08 17:14:38 +01:00
This is a wrapper around libloot that provides a C++ interface that's ABI-compatible with libloot v0.27.0.
2025-03-06 22:24:39 +00:00
2025-03-14 17:05:34 +00:00
The wrapper has two layers:
2025-03-12 20:29:41 +00:00
- a static library built using Cargo, which provides a C++ interface
- a shared library built using CMake, which wraps that C++ interface to provide another that is ABI-compatible with C++ libloot.
2025-03-26 17:56:36 +00:00
## Building
2025-05-08 16:57:00 +01:00
libloot uses the following CMake variables to set build parameters:
Parameter | Values | Default |Description
----------|--------|---------|-----------
`BUILD_SHARED_LIBS` | `ON`, `OFF` | `ON` | Whether or not to build a shared libloot binary.
`LIBLOOT_BUILD_TESTS` | `ON`, `OFF` | `ON` | Whether or not to build libloot's tests.
`LIBLOOT_INSTALL_DOCS` | `ON`, `OFF` | `ON` | Whether or not to install libloot's docs (which need to be built separately).
`RUN_CLANG_TIDY` | `ON`, `OFF` | `OFF` | Whether or not to run clang-tidy during build. Has no effect when using CMake's MSVC generator.
2025-03-26 17:56:36 +00:00
### Windows
To build a release build with debug info:
2025-03-06 22:24:39 +00:00
```
cmake -B build .
2025-03-26 17:56:36 +00:00
cmake --build build --parallel --config RelWithDebInfo
2025-03-12 20:29:41 +00:00
```
2025-04-26 16:41:33 +01:00
To build a debug build:
2025-03-25 19:33:53 +00:00
```
cmake -B build .
2025-03-26 17:56:36 +00:00
cmake --build build --parallel --config Debug
2025-03-25 19:33:53 +00:00
```
2025-03-26 17:56:36 +00:00
### Linux
To build a release build with debug info:
2025-03-12 20:29:41 +00:00
```
2025-03-26 17:56:36 +00:00
cmake -B build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --parallel
```
to build a debug build:
```
cargo build
cmake -B build . -DCMAKE_BUILD_TYPE=Debug
cmake --build build --parallel
```
2025-05-08 16:32:33 +01:00
### Tests
2025-03-26 17:56:36 +00:00
2025-05-08 16:57:00 +01:00
The build process also builds the test suite by default. To skip building the tests, pass `-DLIBLOOT_BUILD_TESTS=OFF` when first running CMake.
2025-03-26 17:56:36 +00:00
If built, the tests can be run using:
```
ctest --test-dir build --output-on-failure --parallel -V
2025-03-06 22:24:39 +00:00
```
2025-05-08 16:32:33 +01:00
### Documentation
2025-05-11 20:37:54 +01:00
Install [Doxygen](https://www.doxygen.nl/), Python and [uv](https://docs.astral.sh/uv/getting-started/installation/) and make sure they're accessible from your `PATH`, then run:
2025-05-08 16:32:33 +01:00
```
2025-06-11 17:58:02 +01:00
cd ../docs
uv run -- sphinx-build -b html . build/html
2025-05-08 16:32:33 +01:00
```
### Packaging
2025-03-06 22:24:39 +00:00
To package the build:
```
2025-03-26 17:56:36 +00:00
cpack --config build/CPackConfig.cmake -C RelWithDebInfo
2025-03-06 22:24:39 +00:00
```