Compare commits

..

11 Commits

Author SHA1 Message Date
Rhys Tumelty
52662e129b Remove SCons build files, becuase it is a terrible build system, and rename stuff
Some checks failed
Continuous Integration / build (double, map[arch:wasm32 os:ubuntu-22.04 platform:web], template_release) (push) Has been cancelled
Continuous Integration / build (double, map[arch:x86_64 os:ubuntu-22.04 platform:linux], template_debug) (push) Has been cancelled
Continuous Integration / build (single, map[arch:arm64 os:ubuntu-22.04 platform:android], template_debug) (push) Has been cancelled
Continuous Integration / build (single, map[arch:universal os:macos-latest platform:macos], template_debug) (push) Has been cancelled
Continuous Integration / build (single, map[arch:x86_64 os:windows-latest platform:windows], template_release) (push) Has been cancelled
2026-08-23 18:14:20 +01:00
Patrick Exner (FlameLizard)
8283d9632c Merge pull request #125 from paddy-exe/add-gitignore-section-before-copy
Add gitignore section for library binaries before copy
2026-06-04 15:27:04 +02:00
paddy-exe
c4641182e3 Add gitignore section for library binaries before copy
adds gitignore section to ignore library binaries before they are copied
from bin/<platform>/* to project/bin/<platform>/*
2026-06-04 15:26:41 +02:00
Patrick Exner (FlameLizard)
e33d564844 Merge pull request #122 from enetheru/github/issue-99 2026-05-30 18:06:14 +02:00
Lukas Tenbrink
b90dcde305 Merge pull request #121 from enetheru/github/issue-1987
CMake: Small fix for doc source consumption missing quotes
2026-05-29 12:56:31 +02:00
Samuel Nicholas
2ec0c4b742 CMake - emscripten hack
Add a commented out line for the emscripten hack to indicate what to do when compiling for the platform.
resolves #99
2026-05-28 11:20:39 +09:30
Samuel Nicholas
bb3b897c16 Issue reported to godot-cpp 1987
Missing quotes only processes the first doc source xml file.
2026-05-28 10:22:38 +09:30
Lukas Tenbrink
7747217b36 Merge pull request #118 from van800/main
Help IDEs resolve gen/include immediately
2026-05-11 12:54:04 +02:00
Ivan Shakhov
5f9cc1e42e Create the godot-cpp/gen/include directory at configure time so IDEs can see generated headers immediately after generate_bindings target produces them 2026-05-06 07:15:21 +03:00
Lukas Tenbrink
c5d45ad8ab Merge pull request #113 from van800/libname
remove caching of the LIBNAME in CMake configuration
2026-03-18 14:26:43 +01:00
Ivan Shakhov
5f5a14f69f remove caching of the LIBNAME in CMake configuration to let the generated run configuration in Rider/CLion to updated as soon as the library name is changed, fixes https://youtrack.jetbrains.com/issue/RIDER-136871 2026-03-17 12:45:37 +01:00
15 changed files with 85 additions and 158 deletions

19
.gitignore vendored
View File

@@ -3,20 +3,10 @@
.godot/
# Ignore library files but not the gdextension file
project/bin/*
!project/bin/android
project/bin/android/*
!project/bin/android/.gitkeep
!project/bin/linux
project/bin/linux/*
!project/bin/linux/.gitkeep
!project/bin/macos
project/bin/macos/*
!project/bin/macos/.gitkeep
!project/bin/windows
project/bin/windows/*
!project/bin/windows/.gitkeep
/bin/**
!project/bin/*.gdextension
# Ignore scons database
.sconsign*.dblite
# Ignore custom.py
@@ -60,3 +50,6 @@ compile_commands.json
# Cmake
cmake-build*
CMakeUserPresets.json
# stupid godot developers using SCons
build/

View File

@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.17)
if(CMAKE_C_COMPILER)
endif()
set(LIBNAME "EXTENSION-NAME" CACHE STRING "The name of the library")
set(LIBNAME "gdvapi") # "The name of the library"
set(GODOT_PROJECT_DIR "project" CACHE STRING "The directory of a Godot project folder")
# Make sure all the dependencies are satisfied
@@ -26,6 +26,12 @@ if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/godot-cpp/src")
endif()
add_subdirectory(godot-cpp SYSTEM)
# When compiling for emscripten, this toolchainhack needs to be included.
# set(CMAKE_PROJECT_<project-name>_INCLUDE ${godot-cpp_SOURCE_DIR}/cmake/emsdkHack.cmake)
# Create the gen directory at configure time so IDEs can see generated headers immediately after generate_bindings
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/godot-cpp/gen/include")
# Add godot-cpp's module path and include the exported functions.
# This is made available for documentation generation
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${godot-cpp_SOURCE_DIR}/cmake")
@@ -36,10 +42,10 @@ get_target_property(GODOTCPP_SUFFIX godot::cpp GODOTCPP_SUFFIX)
get_target_property(GODOTCPP_PLATFORM godot::cpp GODOTCPP_PLATFORM)
# Now we can specify our own project which will inherit any global cmake properties or variables that have been defined.
project(godot-cpp-template
project(gdvapi
VERSION 1.0
DESCRIPTION "This repository serves as a quickstart template for GDExtension development with Godot 4.0+."
HOMEPAGE_URL "https://github.com/enetheru/godot-cpp-template/tree/main"
DESCRIPTION "Godot extension to recieve streams"
HOMEPAGE_URL "https://git.epsncl.uk/rhys/gdvapi"
LANGUAGES CXX
)
@@ -59,7 +65,7 @@ file(GLOB_RECURSE DOC_XML LIST_DIRECTORIES NO CONFIGURE_DEPENDS "${PROJECT_SOURC
# conditionally add doc data to compile output
if(DOC_XML)
if(GODOTCPP_TARGET MATCHES "editor|template_debug")
target_doc_sources(${LIBNAME} ${DOC_XML})
target_doc_sources(${LIBNAME} "${DOC_XML}")
endif()
endif()

View File

@@ -1,24 +1,12 @@
This is free and unencumbered software released into the public domain.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
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.
Copyright (C) 2026 Rhys Tumelty <rhys@tumelty.co.uk>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
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.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
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>
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@@ -1,56 +1,8 @@
# godot-cpp template
This repository serves as a quickstart template for GDExtension development with Godot 4.0+.
# GDVAPI
A godot extension to recieve video steams over UDP and render them
## Contents
* Preconfigured source files for C++ development of the GDExtension ([src/](./src/))
* An empty Godot project in [project/](./project), to test the GDExtension
* godot-cpp as a submodule (`godot-cpp/`)
* GitHub Issues template ([.github/ISSUE_TEMPLATE.yml](./.github/ISSUE_TEMPLATE.yml))
* GitHub CI/CD workflows to publish your library packages when creating a release ([.github/workflows/builds.yml](./.github/workflows/builds.yml))
* An SConstruct file with various functions, such as boilerplate for [Adding documentation](https://docs.godotengine.org/en/stable/tutorials/scripting/cpp/gdextension_docs_system.html)
## 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](./SConstruct) file by modifying the `libname` string.
* change the paths of the to be loaded library name inside the [project/bin/example.gdextension](./project/bin/example.gdextension) file, by replacing `EXTENSION-NAME` with the name you chose for `libname`.
* change the `entry_symbol` string inside [project/bin/example.gdextension](./project/bin/example.gdextension) file.
* rename the `example_library_init` function in [src/register_types.cpp](./src/register_types.cpp) to the same name you chose for `entry_symbol`.
* change the name of the `project/bin/example.gdextension` file
Now, you can build the project with the following command:
```shell
scons
```
If the build command worked, you can test it with the [project](./project) 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:
```shell
# 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](.github/workflows/ci.yml).
There is also a workflow ([make_build.yml](.github/workflows/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.
# Building
`nix develop`
`cmake -B build`
`make -C build -j$(nproc)`
`# package coming later`

View File

@@ -1,64 +0,0 @@
#!/usr/bin/env python
import os
import sys
from methods import print_error
libname = "EXTENSION-NAME"
projectdir = "project"
localEnv = Environment(tools=["default"], PLATFORM="")
# Build profiles can be used to decrease compile times.
# You can either specify "disabled_classes", OR
# explicitly specify "enabled_classes" which disables all other classes.
# Modify the example file as needed and uncomment the line below or
# manually specify the build_profile parameter when running SCons.
# localEnv["build_profile"] = "build_profile.json"
customs = ["custom.py"]
customs = [os.path.abspath(path) for path in customs]
opts = Variables(customs, ARGUMENTS)
opts.Update(localEnv)
Help(opts.GenerateHelpText(localEnv))
env = localEnv.Clone()
if not (os.path.isdir("godot-cpp") and os.listdir("godot-cpp")):
print_error("""godot-cpp is not available within this folder, as Git submodules haven't been initialized.
Run the following command to download godot-cpp:
git submodule update --init --recursive""")
sys.exit(1)
env = SConscript("godot-cpp/SConstruct", {"env": env, "customs": customs})
env.Append(CPPPATH=["src/"])
sources = Glob("src/*.cpp")
if env["target"] in ["editor", "template_debug"]:
try:
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
sources.append(doc_data)
except AttributeError:
print("Not including class reference as we're targeting a pre-4.3 baseline.")
# .dev doesn't inhibit compatibility, so we don't need to key it.
# .universal just means "compatible with all relevant arches" so we don't need to key it.
suffix = env['suffix'].replace(".dev", "").replace(".universal", "")
lib_filename = "{}{}{}{}".format(env.subst('$SHLIBPREFIX'), libname, suffix, env.subst('$SHLIBSUFFIX'))
library = env.SharedLibrary(
"bin/{}/{}".format(env['platform'], lib_filename),
source=sources,
)
copy = env.Install("{}/bin/{}/".format(projectdir, env["platform"]), library)
default_args = [library, copy]
Default(*default_args)

View File

View File

View File

View File

27
flake.lock generated Normal file
View File

@@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1787360063,
"narHash": "sha256-dt4WdcvsA8/RCe+VZZwqU0X+XMM3wBbGCWA0/sFWzGo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2c423e03bbafcff28bfadc6781a4a8257f205cb5",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

25
flake.nix Normal file
View File

@@ -0,0 +1,25 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = inputs: {
devShells = builtins.mapAttrs (system: pkgs: {
default = (pkgs.mkShell.override { stdenv = pkgs.llvmPackages.stdenv; }) {
nativeBuildInputs = with pkgs; [
cmake
ninja
clang
python3
godot
];
shellHook = ''
export PS1="''${PS1//\\n/}"
export PS1="\[\033[1;31m\][gdvapi]\[\033[0m\] $PS1"
'';
};
}) inputs.nixpkgs.legacyPackages;
};
}