Godot Version
4.2
Question
I know C++, but not the impenetrable web of Scons, Python, the terminal, batch files, git, and all the rest of it that seem to be assumed, easy, knowledge for GDExtension users. Like, usually, you ask about GDExtension and you get a very typical engineer-type reply like “Build with Scons. Follow the example.” I mean… I’m using Godot because I’m NOT an engine developer - I kind of need more than what’s in the doc. I remember getting it working once, and it was smooth sailing once I was writing C++, but everything up to that point was painful. I’m trying again from scratch.
I have a project folder. It has a folder for “scons-local-4.7.0” and a folder for "godot-cpp-4.2"zip, and finally, a “src” folder with the actual extension source code, and my godot project folder “test”…
What am I missing? How do I make it GO? I tried writing a .bat file but that didn’t work too well.
If you don’t want the impenetrable web of Scons, Python, the terminal, batch files, and git you don’t need any of it! I don’t know how else you are programming in C++ but all you need is a compiler and godot; though the pre-setup godot-cpp bindings are very helpful. Check out the Godot C++ Template repository, give it some time to soak in, for the most part all you need is to type scons
into your terminal after downloading the zip from github.
If you want the way hard way check out this link for how to set up GDExtension with just godot and a C compiler, I really doubt it will be easier for you if the terminal and/or batch files is a point of conflict though.
My usual workflow is just C++ in Visual Studio - I’ve really never understood or cared what’s going on under the IDE. I tried downloading the Godot C++ template Repositiory, and godot-cpp… Then I downloaded the local version of scons (4.7.0) and put it in the same folder. And tried running scons. The local version comes with two scons.bat files.
Neither works. I’ve tried uninstalling and reinstalling Python and scons. I’ve tried running scons locally. But I keep getting inscrutable errors. I really wish this stuff just worked like the rest of Godot.
As already mentioned, you don’t have to use scons. You can build your GDExtension with any build system you like. Just compile it into a shared library and copy it into your Godot project where defined in your .gdextension file. (or symlink it, I’m not sure if that works on Windows as it does on Linux though, so copy after build is the foolproof alternative)
I’m not familiar with Visual Studio (CLion ftw), but I assume it has proper CMake support, so you might want to take a look at this: GitHub - asmaloney/GDExtensionTemplate: 📜 A template project for building Godot 4 GDExtensions using CMake
The most important first step is to read the documentation and understand how GDExtension and godot-cpp work though: GDExtension — Godot Engine (stable) documentation in English
1 Like