The Spectrum Dispatch News

technology

Godot Game Engine Can Now Use C++ Libraries Through Conan Package Manager

Godot-cpp 10.0, now available in ConanCenter, simplifies integrating C++ libraries into Godot games by handling dependency management across platforms.

Godot Game Engine Can Now Use C++ Libraries Through Conan Package Manager

Godot, the free and open-source game engine, has traditionally made it difficult for developers to incorporate existing C++ libraries into their projects. While most Godot games are written in GDScript, the engine’s own scripting language, many projects eventually need access to C or C++ libraries for simulation, databases, networking, or machine learning capabilities.

Godot Game Engine Can Now Use C++ Libraries Through Conan Package Manager

According to a post on the Conan blog, the challenge has been that while Godot can load C++ extensions through GDExtension and godot-cpp (the official C++ bindings), managing builds across multiple platforms and ensuring version compatibility required significant manual work. Developers had to compile godot-cpp for each target platform and architecture, and any third-party library needed to be vendored and built with matching compiler flags.

The solution involves godot-cpp 10.0, now available in ConanCenter (Conan’s package repository). As a regular Conan package, godot-cpp eliminates the need for projects to build it individually. Since version 10.0, a single godot-cpp release works with any Godot version from 4.3 onwards, with developers selecting their target version through a build option.

Conan manages dependencies consistently across platforms. Instead of each project compiling its own versions, pre-built combinations are cached and reused. Developers can add any of the more than 1,900 libraries available in ConanCenter alongside godot-cpp, and Conan automatically builds all dependencies with matching flags for each target platform.

GDExtension itself works by loading a shared library (.dll, .so, .dylib, or .wasm) into an unmodified Godot build at runtime. Classes created with godot-cpp become regular engine classes that appear in the editor alongside built-in nodes and can be used by GDScript like any other engine component.

The blog post demonstrates the approach with a practical example: a Godot extension using flecs, an Entity Component System library, to simulate 100,000 particles fleeing from a mouse cursor and bouncing off window edges. The example code and a working Godot project are available in the Conan examples2 repository on GitHub, with the extension declared as a regular C++ project in a conanfile.py that specifies godot-cpp and flecs as dependencies.

Key facts

  • Godot-cpp 10.0 is now available in ConanCenter as a regular Conan package
  • A single godot-cpp 10.0 release works with Godot versions 4.3 onwards
  • GDExtensions load as shared libraries into unmodified Godot builds at runtime
  • Conan manages consistent builds across multiple platforms and architectures
  • ConanCenter contains over 1,900 libraries that can be integrated with Godot projects

Sources

← All posts