From 52662e129b450c0e17ee2952c21ae5809c64670d Mon Sep 17 00:00:00 2001 From: Rhys Tumelty Date: Sun, 23 Aug 2026 18:14:20 +0100 Subject: [PATCH] Remove SCons build files, becuase it is a terrible build system, and rename stuff --- .gitignore | 3 +++ CMakeLists.txt | 8 +++---- LICENSE.md | 30 +++++++---------------- README.md | 62 ++++++------------------------------------------ SConstruct | 64 -------------------------------------------------- flake.lock | 27 +++++++++++++++++++++ flake.nix | 25 ++++++++++++++++++++ 7 files changed, 75 insertions(+), 144 deletions(-) delete mode 100644 SConstruct create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 8257026..b35ce1a 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ compile_commands.json # Cmake cmake-build* CMakeUserPresets.json + +# stupid godot developers using SCons +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c8ddc7..f5ff069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.17) if(CMAKE_C_COMPILER) endif() -set(LIBNAME "EXTENSION-NAME") # "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 @@ -42,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 ) diff --git a/LICENSE.md b/LICENSE.md index fdddb29..7f9e837 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -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 + 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 + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/README.md b/README.md index 38872b5..7637d02 100644 --- a/README.md +++ b/README.md @@ -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` diff --git a/SConstruct b/SConstruct deleted file mode 100644 index 1ea6854..0000000 --- a/SConstruct +++ /dev/null @@ -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) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..562d251 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c613f29 --- /dev/null +++ b/flake.nix @@ -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; + }; +}