Compare commits

...

3 Commits

Author SHA1 Message Date
8c4b5ddc62 Add section on git submodule 2026-03-14 18:57:26 -04:00
21ce54e1f8 Add readme and improve build script 2026-03-14 18:49:29 -04:00
ea6bb64c78 Add Unlicense license file 2026-03-14 18:22:32 -04:00
4 changed files with 96 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
demo/bin demo/bin
.idea .idea
# Godot auto generated files # Godot auto generated files
*.gen.* *.gen.*
.import/ .import/

View File

@@ -42,7 +42,7 @@ ios.release = {{
}} }}
""".format(PROJECT_NAME) """.format(PROJECT_NAME)
gdextension_file_path = "demo/template.gdextension" gdextension_file_path = f"demo/{PROJECT_NAME}.gdextension"
with open(gdextension_file_path, "w") as gdextension_file: with open(gdextension_file_path, "w") as gdextension_file:
gdextension_file.write(gdextension_file_content) gdextension_file.write(gdextension_file_content)

16
license.md Normal file
View File

@@ -0,0 +1,16 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or
as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright
interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the
detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of
all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to https://unlicense.org

78
readme.md Normal file
View File

@@ -0,0 +1,78 @@
# Redot GDExtension Template
This repository provides a template for create GDExtensions. This template provides a basic layout including a demo
project which can be used to test your extension. It also provides a small file (`build.py`) which can generate a
`template.gdextension` file for you. This file should automatically enable your extension within the editor.
This project uses Redot 26.1 as the basis for creating extensions. In the future, there will probably be branches
dedicated to future versions of Redot. This repository is based on the [official GDExtension tutorial][1].
## Using this template
To set up a repository using this template, simply click the "Use this template" button in the top right of this
repository. You will then be presented with a new repository wizard that will guide you through the remaining setup
steps.
### Cloning the repository
This template uses a [git submodule][3] to make it easier to use the correct version of the Redog GDExtension API. As a
result, you must use a slightly different process for cloning repositories generated with this template. If you haven't
cloned the repo yet, you can use the following command to get the submodules automatically:
```sh
git clone --recurse-submodules <YOUR_REPO_URL>
```
If you have already cloned the repo, you can initialize the submodules by running the following two commands:
```sh
git submodule init
git submodule update
```
Or by running the combined command:
```sh
git submodule update --init
```
## Building the extension.
To build projects created with this template, you will need to run `scons`. If you have not already setup your system
for developing Redot extensions or extending the core editor, you can find instructions for doing so
[here](https://docs.redotengine.org/contributing/development/compiling/). These steps are designed to help you build
the entire Redot project, but you will need an understanding of how to do that in order to build extensions.
I also strongly recommend that you read the [guide on C++ GDExtensions][2]
if you have not already done so to get the fullest picture of how GDExtensions are intended to work.
Once you have setup your repository and cloned it to your local machine, you can build the extension by running:
```sh
scons
```
If you would like to build your extension with the help of an IDE, you may want to have `scons` generate a
`build_commands.json` file by building your project with the `compiledb=yes` option as below:
```sh
scons compiledb=yes
```
## Customizing your build artifact name
By default, this project is configured to output a shared library titled `libgdextension_template`, however you can
easily change this by modifying the `PROJECT_NAME` property in the `build.py` file. `scons` will automatically
incorporate this variable into your compilation artifact.
## Generating a template.gdextension file
This repository comes with a simple Python script that will generate a `*.gdextension` file and place it
in the `demo` directory. Redot requires this file to load your GDExtension, so using this script will get you started
quickly.
```sh
python build.py
```
The script will also read the value of the `PROJECT_NAME` property so that the `*.gdextension` file will reflect the
name of your extension.
[1]: https://docs.redotengine.org/tutorials/scripting/gdextension/
[2]: https://docs.redotengine.org/tutorials/scripting/gdextension/