commit fd1e24e442b42b6c68ed7c94333a42fbf32b3c23 Author: Tim Blume Date: Fri Apr 19 14:48:12 2024 +0200 intial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6be3b8f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +cmake-build-debug diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..95b181e --- /dev/null +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..519b12f --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/godot-cpp b/godot-cpp new file mode 160000 index 0000000..a62f633 --- /dev/null +++ b/godot-cpp @@ -0,0 +1 @@ +Subproject commit a62f633cebee4b36356dc903d00670733cd28fb1 diff --git a/recastnavigation b/recastnavigation new file mode 160000 index 0000000..44ff936 --- /dev/null +++ b/recastnavigation @@ -0,0 +1 @@ +Subproject commit 44ff936db57f27253814083bdcf74564a5c015f0 diff --git a/src/registration.cpp b/src/registration.cpp new file mode 100644 index 0000000..b627431 --- /dev/null +++ b/src/registration.cpp @@ -0,0 +1,29 @@ +#include +#include + +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(); +} + +} +