Replaced godot-cpp with submodule

This commit is contained in:
douwe
2025-08-28 19:28:19 +02:00
parent c3c846fb22
commit 7c24dd92b0
222 changed files with 316 additions and 366341 deletions

Binary file not shown.

View File

@@ -0,0 +1,15 @@
{
"configurations": [
{
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/../godot-cpp/**"
],
"intelliSenseMode": "linux-gcc-x64",
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17"
}
],
"version": 4
}

View File

@@ -0,0 +1,61 @@
{
"files.associations": {
"*.inc": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"cerrno": "cpp",
"climits": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"initializer_list": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp"
}
}

View File

@@ -0,0 +1,65 @@
#!/usr/bin/env python
import os
import sys
from methods import print_error
libname = "cobor_terrain_extension"
projectdir = "."
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=["cobor_terrain/include/"])
env.Append(CPPPATH=["cobor_terrain/src/"])
sources = Glob("cobor_terrain/src/*.cpp")
if env["target"] in ["editor", "template_debug"]:
try:
doc_data = env.GodotCPPDocData("cobor_terrain/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]
Default(*default_args)

View File

@@ -0,0 +1,10 @@
[configuration]
entry_symbol = "cobor_terrain_library_init"
compatibility_minimum = "4.1"
[libraries]
; Relative paths ensure that our GDExtension can be placed anywhere in the project directory.
linux.x86_64.debug = "./bin/linux/libcobor_terrain_extension.linux.template_debug.x86_64.so"
linux.x86_64.release = "./bin/linux/libcobor_terrain_extension.linux.template_release.x86_64.so"

View File

@@ -0,0 +1 @@
uid://dskh86iu7g6lk

View File

@@ -0,0 +1,18 @@
#pragma once
#include "godot_cpp/classes/ref_counted.hpp"
namespace CoborTerrain
{
class CoborTerrainEngine : public godot::RefCounted
{
GDCLASS(CoborTerrainEngine, godot::RefCounted)
protected:
static void _bind_methods();
public:
CoborTerrainEngine() = default;
~CoborTerrainEngine() override = default;
};
}

View File

@@ -0,0 +1,7 @@
#ifndef COBOR_TERRAIN_REGISTER_TYPES_H
#define COBOR_TERRAIN_REGISTER_TYPES_H
void initialize_gdextension_types();
void uninitialize_gdextension_types();
#endif // COBOR_TERRAIN_REGISTER_TYPES_H

View File

@@ -0,0 +1,8 @@
#include "cobor_terrain_engine.hpp"
using namespace CoborTerrain;
void CoborTerrain::CoborTerrainEngine::_bind_methods()
{
// godot::ClassDB::bind_method(godot::D_METHOD("parse_source_code", "source_code"), &CoborVirtualMachine::parse_source_code);
}

View File

@@ -0,0 +1,20 @@
/* THIS FILE IS GENERATED DO NOT EDIT */
#include <godot_cpp/godot.hpp>
static const char *_doc_data_hash = "-4005597214191675931";
static const int _doc_data_uncompressed_size = 0;
static const int _doc_data_compressed_size = 8;
static const unsigned char _doc_data_compressed[] = {
120,
218,
3,
0,
0,
0,
0,
1,
};
static godot::internal::DocDataRegistration _doc_data_registration(_doc_data_hash, _doc_data_uncompressed_size, _doc_data_compressed_size, _doc_data_compressed);

View File

@@ -0,0 +1,38 @@
#include "register_types.h"
#include <gdextension_interface.h>
#include <godot_cpp/core/class_db.hpp>
#include <godot_cpp/core/defs.hpp>
#include <godot_cpp/godot.hpp>
#include "cobor_terrain_engine.hpp"
using namespace godot;
void initialize_gdextension_types(ModuleInitializationLevel p_level)
{
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
GDREGISTER_CLASS(CoborTerrain::CoborTerrainEngine);
}
void uninitialize_gdextension_types(ModuleInitializationLevel p_level) {
if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
}
extern "C"
{
// Initialization
GDExtensionBool GDE_EXPORT cobor_terrain_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization)
{
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
init_obj.register_initializer(initialize_gdextension_types);
init_obj.register_terminator(uninitialize_gdextension_types);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}
}

View File

@@ -0,0 +1,52 @@
import os
import sys
from enum import Enum
# Colors are disabled in non-TTY environments such as pipes. This means
# that if output is redirected to a file, it won't contain color codes.
# Colors are always enabled on continuous integration.
_colorize = bool(sys.stdout.isatty() or os.environ.get("CI"))
class ANSI(Enum):
"""
Enum class for adding ansi colorcodes directly into strings.
Automatically converts values to strings representing their
internal value, or an empty string in a non-colorized scope.
"""
RESET = "\x1b[0m"
BOLD = "\x1b[1m"
ITALIC = "\x1b[3m"
UNDERLINE = "\x1b[4m"
STRIKETHROUGH = "\x1b[9m"
REGULAR = "\x1b[22;23;24;29m"
BLACK = "\x1b[30m"
RED = "\x1b[31m"
GREEN = "\x1b[32m"
YELLOW = "\x1b[33m"
BLUE = "\x1b[34m"
MAGENTA = "\x1b[35m"
CYAN = "\x1b[36m"
WHITE = "\x1b[37m"
PURPLE = "\x1b[38;5;93m"
PINK = "\x1b[38;5;206m"
ORANGE = "\x1b[38;5;214m"
GRAY = "\x1b[38;5;244m"
def __str__(self) -> str:
global _colorize
return str(self.value) if _colorize else ""
def print_warning(*values: object) -> None:
"""Prints a warning message with formatting."""
print(f"{ANSI.YELLOW}{ANSI.BOLD}WARNING:{ANSI.REGULAR}", *values, ANSI.RESET, file=sys.stderr)
def print_error(*values: object) -> None:
"""Prints an error message with formatting."""
print(f"{ANSI.RED}{ANSI.BOLD}ERROR:{ANSI.REGULAR}", *values, ANSI.RESET, file=sys.stderr)