Compare commits

...

2 commits

Author SHA1 Message Date
17680c2288 Format sources with clangd 2025-01-28 13:55:31 +01:00
ea634491de Setup clangd 2025-01-28 13:55:10 +01:00
7 changed files with 53 additions and 323529 deletions

7
.gitignore vendored
View file

@ -1,6 +1,13 @@
# Compiled Object files from SCons
*.os
# Generated by tooling
extension_api.json
compile_commands.json
# clangd cache
.cache/
# Created by https://www.toptal.com/developers/gitignore/api/c++,godot,scons
# Edit at https://www.toptal.com/developers/gitignore?templates=c++,godot,scons

View file

@ -7,6 +7,15 @@ Named in this order so not everything starts with the same word
Using Godot v4.4.beta1.official [d33da79d3].
Install SCons with `pipx install scons`.
To generate files for build tooling, run the following:
```sh
godot --dump-extension-api
scons compile_commands
```
### Build
To build the extension run SCons in the repository root, the default arguments have been added to the file.
```sh

View file

@ -19,6 +19,12 @@ sources = Glob("src/*.cpp")
# Generated with local Godot installation
env["custom_api_file"] = "extension_api.json"
# Information for Clang tooling, including clangd language server
# To create the compile_database
env.Tool('compilation_db')
cdb = env.CompilationDatabase('compile_commands.json')
Alias('compile_commands', cdb)
if env["platform"] == "macos":
library = env.SharedLibrary(
"project/bin/libmarshconnector.{}.{}.framework/libmarshconnector.{}.{}".format(

File diff suppressed because it is too large Load diff

View file

@ -3,8 +3,7 @@
using namespace godot;
void MarshConnector::_bind_methods() {
}
void MarshConnector::_bind_methods() {}
MarshConnector::MarshConnector() {
// Initialize any variables here.
@ -15,6 +14,4 @@ MarshConnector::~MarshConnector() {
// Add your cleanup here.
}
void MarshConnector::_process(double delta) {
time_passed += delta;
}
void MarshConnector::_process(double delta) { time_passed += delta; }

View file

@ -5,7 +5,7 @@
namespace godot {
class MarshConnector : public Node{
class MarshConnector : public Node {
GDCLASS(MarshConnector, Node)
private:
@ -21,6 +21,6 @@ public:
void _process(double delta) override;
};
}
} // namespace godot
#endif // MARSHCONNECTOR_H

View file

@ -24,12 +24,17 @@ void uninitialize_marsh_module(ModuleInitializationLevel p_level) {
extern "C" {
// Initialization.
GDExtensionBool GDE_EXPORT marsh_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, const GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
GDExtensionBool GDE_EXPORT
marsh_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address,
const GDExtensionClassLibraryPtr p_library,
GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library,
r_initialization);
init_obj.register_initializer(initialize_marsh_module);
init_obj.register_terminator(uninitialize_marsh_module);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
init_obj.set_minimum_library_initialization_level(
MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}