Creating GDExtension utilizing C++ dll

Godot Version

4.2.2

Question

I’m a little bit confused on how to integrate a gdextension with an outside DLL. I want to build an extension that uses methods from OpenCV. From what I understand the dll should be listed in the dependencies section of of the .gdextension file so that it will be packaged during export, but what about the include files? Do I need a CMake file to link everything together? Currently my project directory looks something like this:

project/
|
+--game/               
|   |
|   +--main.tscn
|   |
|   +--bin/
|       |
|       +--gdexample.gdextension
|       +-opencv.dll
|
+--godot-cpp/        
|
+--src/                   # source code of the extension we are building
|   |
|   +--register_types.cpp
|   +--register_types.h
|   +--gdexample.cpp
|   +--gdexample.h
|
+-include/
|   |
|   +-all of the include files for opencv

I apologize if this is all common sense but I don’t have a ton of experience building C++ projects and am a little stumped.

2 Likes

No, Godot uses Scons, a python based build system.

See this for detailed integration guide.

Btw look for OpenCV questions in Godot forum for people who have done this before.

I have seen this question before.

https://forum.godotengine.org/search?context=topic&context_id=72257&q=Opencv&skip_context=true

1 Like