|
LibMCP 0.6.1
API to control MCPnet
|
After installing all dependencies the next step is to build LibMCP. This is tested on both Linux and Windows.
Clone the GitLab repository.
The presets in CMakePresets.json configure a Ninja build with tests enabled:
| Preset | Build directory | Build type | Dependencies |
|---|---|---|---|
debug | build-debug/ | Debug | installed on the system |
release | build/ | Release | installed on the system |
windows-debug | build-debug/ | Debug | vcpkg, see Installing Poco C++ |
windows-release | build/ | Release | vcpkg, see Installing Poco C++ |
The windows-* presets are only available on Windows.
Configure, build and run the tests in one step:
Or step by step:
Executables (examples, tests) and MCP.dll are placed in build/bin/.
Ninja needs the MSVC environment (cl.exe, INCLUDE, LIB), so run the commands from a "Developer PowerShell for VS" (or "Developer Command Prompt for VS"):
Visual Studio, VS Code with the CMake Tools extension and CLion use the presets directly and set up the MSVC environment themselves.
You can also add additional CMake options or project options to the CMake call, e.g. cmake --preset release -DBUILD_PYTHON_BINDINGS=OFF. The defaults are:
MCP_BUILD_SHARED defaults to BUILD_SHARED_LIBS if that is set. LibMCP does not define BUILD_SHARED_LIBS itself, because as an option() it would switch every other library of a parent project to shared as well.
Install LibMCP to CMAKE_INSTALL_PREFIX:
To build the Python bindings, install the required development packages before running CMake.
Linux:
Windows (Python from python.org):
pybind11-stubgen is optional — without it, no .pyi type stub is generated, but the bindings still build.
To skip the Python bindings entirely, pass -DBUILD_PYTHON_BINDINGS=OFF to the CMake call.
When using a shared LibMCP without installing it globally, MCP.dll / libMCP.so has to be found by every executable that uses LibMCP. On Windows copy it next to the executable, e.g. with $<TARGET_RUNTIME_DLLS:...> or by putting all executables into one folder with CMAKE_RUNTIME_OUTPUT_DIRECTORY.
When building the doxygen documentation you might get some warnings like these:
This is due to doxygen bugs 5892 and 7032 which were fixed in version 1.8.16 and 1.8.19 respectively. So either you use a newer version of doxygen or access the documentation from GitLab pages.