This explains how to use Conan to manage godot-cpp and any C++ library when writing Godot GDExtensions. godot-cpp now supports a single release working with Godot 4.3+ by selecting an api_version at build time, and it is built for one of three targets (template_debug, template_release, editor). Godot chooses which binary to load at runtime via feature tags in the .gdextension file that map debug/release to different library paths. Instead of vendoring godot-cpp and every third-party library per project and platform (the usual SCons/submodule workflow), Conan provides a godot-cpp recipe on ConanCenter so each option/target combination is built once and reused, and arbitrary libraries from ConanCenter can be added and cross-built consistently.
A concrete example builds a Swarm node that simulates 100,000 particles using flecs (an ECS). The conanfile requires godot-cpp/10.0.0 and flecs/4.1.6, sets package_type and CMake generators, and passes godot-cpp’s target option into the CMake toolchain as GODOTCPP_TARGET so the output name matches the runtime-loaded binary. The CMakeLists links godot-cpp and flecs::flecs_static and sets the shared library output name accordingly. The node creates one flecs entity per particle, updates them with world.progress(), and renders via a MultiMesh; runtime registration uses GDREGISTER_RUNTIME_CLASS. Building with Conan downloads prebuilt packages when available (note: godot-cpp needs C++17), and the resulting extension loads into Godot with Inspector-visible properties and easier cross-platform distribution.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.