This commit is contained in:
Tim Blume 2024-04-19 14:48:12 +02:00
commit fd1e24e442
6 changed files with 52 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
build
cmake-build-debug

6
.gitmodules vendored Normal file
View file

@ -0,0 +1,6 @@
[submodule "godot-cpp"]
path = godot-cpp
url = https://github.com/godotengine/godot-cpp
[submodule "recastnavigation"]
path = recastnavigation
url = https://github.com/recastnavigation/recastnavigation

13
CMakeLists.txt Normal file
View file

@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.22)
project(godot-recast-navigation)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_subdirectory(godot-cpp)
add_library(godot-recast-navigation SHARED src/registration.cpp)
target_include_directories(godot-recast-navigation PRIVATE src/)
target_link_libraries(godot-recast-navigation PUBLIC godot::cpp)

1
godot-cpp Submodule

@ -0,0 +1 @@
Subproject commit a62f633cebee4b36356dc903d00670733cd28fb1

1
recastnavigation Submodule

@ -0,0 +1 @@
Subproject commit 44ff936db57f27253814083bdcf74564a5c015f0

29
src/registration.cpp Normal file
View file

@ -0,0 +1,29 @@
#include <godot_cpp/godot.hpp>
#include <godot_cpp/core/class_db.hpp>
void register_gameplay_types(godot::ModuleInitializationLevel p_level) {
if (p_level != godot::ModuleInitializationLevel::MODULE_INITIALIZATION_LEVEL_SCENE) {
return;
}
// REGISTER CLASSES HERE LATER
}
void unregister_gameplay_types(godot::ModuleInitializationLevel p_level) {
// DO NOTHING
}
extern "C" {
GDExtensionBool GDE_EXPORT recastnavigation_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
init_obj.register_initializer(register_gameplay_types);
init_obj.register_terminator(unregister_gameplay_types);
init_obj.set_minimum_library_initialization_level(godot::MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init();
}
}