Minimalistic template project to start with GDExtension development with godot-cppscript preinstalled.
- Install dependencies
- (Optional) use this template via GitHub
- Clone project
git clone https://github.com/IvanInventor/godot-cppscript-template --recurse-submodules godot-project
cd godot-project
NOTE: CMake config currently works only from my cmake rewrite of godot-cpp
If you want to use cmake for Godot before 4.4 dev branch, do 'For custom builds' step below
-
Checkout your version of godot
- For stable releases: checkout one of tags
cd external/godot-cpp/ git checkout <tag>
OR
- For custom builds (from guide):
# Generate custom bindings ./your_godot_executable --dump-extension-api
-
And then:
- Move file to default path
mv extension_api.json gdextension/extension_api.json
OR
- Specify custom path to file to either scons or cmake
scons custom_api_file=path/to/extension_api.json cmake -DGODOT_CUSTOM_API_FILE=path/to/extension_api.json```
-
Build project
- Scons
scons
- CMake
cmake -Bbuild cmake --build build
-
Open
project
directory from Godot -
Run scene
You should see line of text in the center of screen and message in console
- Project name
- Regenerate cpspcript files with name of your project
- Remove old
project/scripts.gdextension
file - Modify builder scripts
- Scons
# Customize this values depending on your project -library_name = 'scripts' +library_name = '<your_name>'
- Cmake
-project(scripts LANGUAGES CXX) +project(your_name LANGUAGES CXX)
- Scons
- Header name (why?)
- SCons
# Name of header to be included to enable cppscript # (Prefer name unique to your project) -'header_name' : 'cppscript.h', +'header_name' : 'your_name.h',
- Cmake
# Name of header to be included to enable cppscript # (Prefer name unique to your project) HEADER_NAME - cppscript.h + your_name.h
- SCons