Long paths can be greater than 260 characters long, but each path component is still limited to 255 characters. The latter is also commonly the component length limit on Linux. Support for long paths requires Windows 10 1607 or later and a Registry value to be set[1], so to make the cause of test failures clearer when that isn't the case, there's one test that checks that Registry value is set, and long paths are not used in the other tests if it isn't set, so only that one test should failed if the system isn't configured as expected. GitHub Action's Windows runners do have the Registry value set[2]. This doesn't set the manifest for the Rust tests because it seems to be very difficult to set a manifest for only the tests, and it's not worth the effort when the only tests that fail are those that try to create a symlink, especially since those cases are also covered by the C++ tests. [1]: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later [2]: https://github.com/actions/runner-images/blob/releases/win22/20250921/images/windows/scripts/build/Configure-BaseImage.ps1#L73
libloot C++ wrapper
This is a wrapper around libloot that provides a C++ interface that's ABI-compatible with libloot v0.27.0.
The wrapper has two layers:
- 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 more idiomatic.
Build
The prerequisites for building libloot and its C++ wrapper are CMake, the Rust toolchain and a C++ toolchain. The CI builds currently use a recent version of CMake, the latest version of Rust, MSVC 2022 on Windows and GCC 13 on Linux, so alternatives such as other versions, Mingw-w64 or Clang may not work without modifications.
To build a release build with debug info on Windows:
cmake -B build .
cmake --build build --parallel --config RelWithDebInfo
To do the same on Linux:
cmake -B build . -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build --parallel
To build a debug build, pass Debug instead of RelWithDebInfo.
The following CMake variables can be used to configure the build:
| Parameter | Values | Default | Description |
|---|---|---|---|
LIBLOOT_BUILD_SHARED |
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 Visual Studio generator. |
An example of using libloot with CMake's FetchContent:
set(LIBLOOT_BUILD_TESTS OFF)
set(LIBLOOT_INSTALL_DOCS OFF)
FetchContent_Declare(libloot
GIT_REPOSITORY "https://github.com/loot/libloot.git"
GIT_TAG "master" # Better to use a specific commit hash.
SOURCE_SUBDIR "cpp")
FetchContent_MakeAvailable(libloot)
add_executable(myapp ${MYAPP_SOURCES})
target_link_libraries(myapp PRIVATE libloot::loot)
Documentation
Install Doxygen, Python and uv and make sure they're accessible from your PATH, then run:
uv run --directory ../docs -- sphinx-build -b html . build/html
Tests
If the tests are built they can be run using:
ctest --test-dir build --output-on-failure --parallel -V
Packaging
To package the build:
cpack --config build/CPackConfig.cmake -C RelWithDebInfo