Mirror of godotengine/godot-cpp-template
Find a file
2025-11-26 13:17:04 +01:00
.github Split CI from build actions, since they're for pretty different use-cases. 2025-11-17 17:41:54 +01:00
.vscode Add vscode extension suggestions and ignore the rest 2023-08-17 08:31:03 -04:00
bin Remove .framework folders and code signing for macOS and iOS 2025-04-06 17:25:09 +02:00
demo Fix macos.double.release and web.wasm32.double.debug paths 2025-11-26 12:38:35 +01:00
doc_classes Add an example class and some demo code to the project. 2025-05-15 18:53:44 +02:00
godot-cpp@6388e26dd8 CMake solution 2025-03-20 14:21:02 +10:30
src Add an example class and some demo code to the project. 2025-05-15 18:53:44 +02:00
.clang-format Add Godot project .clang-format file 2023-10-08 13:50:37 -04:00
.editorconfig CMake solution 2025-03-20 14:21:02 +10:30
.gdignore Add .gdignore file to prevent editor from importing resources 2024-02-07 23:29:43 +01:00
.gitattributes Initial commit 2023-08-08 01:43:32 +02:00
.gitignore CMake solution 2025-03-20 14:21:02 +10:30
.gitmodules GitHub Workflow: Use new setup-godot-cpp github action from godot-cpp submodule. 2025-02-03 12:53:01 +01:00
build_profile.json Add an example for using a build profile 2025-04-07 15:00:07 +02:00
CMakeLists.txt fix cmake compilation of the example project 2025-09-24 11:22:13 +02:00
LICENSE.md Initial commit 2023-08-08 01:43:32 +02:00
methods.py Print an error if the godot-cpp submodule hasn't been initialized 2024-08-09 17:43:39 +02:00
README.md Merge pull request #101 from Ivorforce/ci-cd-builds 2025-11-17 20:47:44 +01:00
SConstruct Revert "Add subdirectories to source file collection logic in SConstruct up to 3 layers of depth" 2025-11-08 09:38:06 +01:00

godot-cpp template

This repository serves as a quickstart template for GDExtension development with Godot 4.0+.

Contents

  • Preconfigured source files for C++ development of the GDExtension (src/)
  • An empty Godot project in demo/, to test the GDExtension
  • godot-cpp as a submodule (godot-cpp/)
  • GitHub Issues template (.github/ISSUE_TEMPLATE.yml)
  • GitHub CI/CD workflows to publish your library packages when creating a release (.github/workflows/builds.yml)
  • An SConstruct file with various functions, such as boilerplate for Adding documentation

Usage - Template

To use this template, log in to GitHub and click the green "Use this template" button at the top of the repository page. This will let you create a copy of this repository with a clean git history.

To get started with your new GDExtension, do the following:

  • clone your repository to your local computer
  • initialize the godot-cpp git submodule via git submodule update --init
  • change the name of the compiled library file inside the SConstruct file by modifying the libname string.
    • change the paths of the to be loaded library name inside the demo/bin/example.gdextension file, by replacing EXTENSION-NAME with the name you chose for libname.
  • change the entry_symbol string inside demo/bin/example.gdextension file.
    • rename the example_library_init function in src/register_types.cpp to the same name you chose for entry_symbol.
  • change the name of the demo/bin/example.gdextension file

Now, you can build the project with the following command:

scons

If the build command worked, you can test it with the demo project. Import it into Godot, open it, and launch the main scene. You should see it print the following line in the console:

Type: 24

Configuring an IDE

You can develop your own extension with any text editor and by invoking scons on the command line, but if you want to work with an IDE (Integrated Development Environment), you can use a compilation database file called compile_commands.json. Most IDEs should automatically identify this file, and self-configure appropriately. To generate the database file, you can run one of the following commands in the project root directory:

# Generate compile_commands.json while compiling
scons compiledb=yes

# Generate compile_commands.json without compiling
scons compiledb=yes compile_commands.json

Usage - Actions

This repository comes with continuous integration (CI) through a GitHub action that tests building the GDExtension. It triggers automatically for each pushed change. You can find and edit it in builds.yml.

There is also a workflow (make_build.yml) that builds the GDExtension for all supported platforms that you can use to create releases. You can trigger this workflow manually from the Actions tab on GitHub. After it is complete, you can find the file godot-cpp-template.zip in the Artifacts section of the workflow run.