A project showing example usage for muzero-cpp with vcpkg dependencies.
All dependencies are managed through vcpkg, except for libtorch (pytorch's C++ frontend).
The easiest way to get libtorch is through the python package.
First, create a virtual environment and install pytorch:
conda create -n muzero python=3.12
conda activate muzero
pip3 install torch torchvisionNext, the following environment variables are required for the toolchain packages to be found:
CC: The path to your C compilerCXX: The path to your C++23 compliant compilerLIBTORCH_ROOT: The path to the libtorch package, which we will point towards the just installed python package
For example:
export CC=gcc-15.2
export CXX=g++-15.2
# Ensure you activated the muzero virtual environment
export LIBTORCH_ROOT=`python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'`Finally, we use CMakePresets.json which sets all the required CMake variables.
cmake --preset=release-linux
cmake --build --preset=release-linux -- -j8Important
If you see a CMake warning about an RPATH cycle involving libtorch/libc10
(often caused by vcpkg reusing an older cached build of a dependency which references a different virtual environment),
delete the build folder, and request to not reuse cached artifacts when configuring:
VCPKG_BINARY_SOURCES=clear cmake --preset=release-linux
See muzero-cpp for usage.