From 302512d70c4da766a4943b5782cb64b89ffa369e Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Sun, 21 Jan 2024 16:50:13 -0700 Subject: [PATCH] Massive Reorganize * Plan change: Gemify and install to installed Ruby * no longer builds since dac4675 --- .gitignore | 5 ++- .gitmodules | 2 +- Gemfile | 6 ++-- .../Godot.rb.gdextension | 0 docs/{dev => }/Building.md | 0 docs/{dev => }/GDExtension Init Levels.md | 0 .../GDExtension Interface functions pool.h | 33 ------------------- {include => ext}/.gdignore | 0 {src => ext/godot_rb}/cleanup.c | 0 {src => ext/godot_rb}/cleanup.h | 0 ext/godot_rb/extconf.rb | 2 ++ {src => ext/godot_rb}/godot_rb.c | 0 {src => ext/godot_rb}/ruby/mixins.c | 0 {src => ext/godot_rb}/ruby/object.c | 0 {src => ext/godot_rb}/ruby/objects.c | 0 {src => ext/godot_rb}/ruby/ruby_script.c | 0 {src => ext/godot_rb}/ruby/ruby_script.h | 0 .../ruby/ruby_script_inst_get_virtual.c | 0 {src => ext/godot_rb}/ruby/string.c | 0 {src => ext/godot_rb}/ruby/string_name.c | 0 {src => ext/godot_rb}/ruby/variant.c | 0 {src => ext/godot_rb}/ruby/variants.h | 0 {src => ext/godot_rb}/setup.c | 0 {src => ext/godot_rb}/setup.h | 0 {src => ext/include}/.gdignore | 0 ext/include/godot | 1 + {include => ext/include}/godot_rb.h | 2 +- include/godot | 1 - lib/{godot => godot_rb}/enumerable.rb | 0 lib/{godot => godot_rb}/object.rb | 0 lib/{godot => godot_rb}/objects.rb | 0 lib/{godot => godot_rb}/ruby_language.rb | 0 lib/{godot => godot_rb}/ruby_script.rb | 0 lib/{godot => godot_rb}/variant.rb | 0 lib/{godot => godot_rb}/version.rb | 0 src/CMakeLists.txt | 15 --------- 36 files changed, 10 insertions(+), 57 deletions(-) rename Godot.rb.gdextension => addons/Godot.rb.gdextension (100%) rename docs/{dev => }/Building.md (100%) rename docs/{dev => }/GDExtension Init Levels.md (100%) delete mode 100644 docs/dev/GDExtension Interface functions pool.h rename {include => ext}/.gdignore (100%) rename {src => ext/godot_rb}/cleanup.c (100%) rename {src => ext/godot_rb}/cleanup.h (100%) create mode 100644 ext/godot_rb/extconf.rb rename {src => ext/godot_rb}/godot_rb.c (100%) rename {src => ext/godot_rb}/ruby/mixins.c (100%) rename {src => ext/godot_rb}/ruby/object.c (100%) rename {src => ext/godot_rb}/ruby/objects.c (100%) rename {src => ext/godot_rb}/ruby/ruby_script.c (100%) rename {src => ext/godot_rb}/ruby/ruby_script.h (100%) rename {src => ext/godot_rb}/ruby/ruby_script_inst_get_virtual.c (100%) rename {src => ext/godot_rb}/ruby/string.c (100%) rename {src => ext/godot_rb}/ruby/string_name.c (100%) rename {src => ext/godot_rb}/ruby/variant.c (100%) rename {src => ext/godot_rb}/ruby/variants.h (100%) rename {src => ext/godot_rb}/setup.c (100%) rename {src => ext/godot_rb}/setup.h (100%) rename {src => ext/include}/.gdignore (100%) create mode 160000 ext/include/godot rename {include => ext/include}/godot_rb.h (99%) delete mode 160000 include/godot rename lib/{godot => godot_rb}/enumerable.rb (100%) rename lib/{godot => godot_rb}/object.rb (100%) rename lib/{godot => godot_rb}/objects.rb (100%) rename lib/{godot => godot_rb}/ruby_language.rb (100%) rename lib/{godot => godot_rb}/ruby_script.rb (100%) rename lib/{godot => godot_rb}/variant.rb (100%) rename lib/{godot => godot_rb}/version.rb (100%) delete mode 100644 src/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 4e03685..85c367a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,9 @@ -/build/ - # JetBrains /**/.idea/ # Ruby -/.bundle/ /.gem_rbs_collection/ /Gemfile.lock /rbs_collection.lock.yaml +/lib/*.so +/tmp/ diff --git a/.gitmodules b/.gitmodules index a9832b7..22641a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "godot"] - path = include/godot + path = ext/include/godot url = https://github.com/ParadoxV5/godot-headers diff --git a/Gemfile b/Gemfile index ea720e0..42376e4 100644 --- a/Gemfile +++ b/Gemfile @@ -2,13 +2,13 @@ source 'https://rubygems.org' ruby '~> 3.3', engine: 'ruby', engine_version: '~> 3.3' -gem 'rake', '~> 13.1.0' -gem 'json', '~> 2.6' +gem 'rake-compiler', '~> 1.2.0' +gem 'json', '~> 2.7' # Development Apps group :development do group :type_check do - gem 'rbs', '~> 3.4.1', require: false + gem 'rbs', '~> 3.4.2', require: false gem 'steep', '~> 1.6.0', require: false end group :documentation do diff --git a/Godot.rb.gdextension b/addons/Godot.rb.gdextension similarity index 100% rename from Godot.rb.gdextension rename to addons/Godot.rb.gdextension diff --git a/docs/dev/Building.md b/docs/Building.md similarity index 100% rename from docs/dev/Building.md rename to docs/Building.md diff --git a/docs/dev/GDExtension Init Levels.md b/docs/GDExtension Init Levels.md similarity index 100% rename from docs/dev/GDExtension Init Levels.md rename to docs/GDExtension Init Levels.md diff --git a/docs/dev/GDExtension Interface functions pool.h b/docs/dev/GDExtension Interface functions pool.h deleted file mode 100644 index 4db76c2..0000000 --- a/docs/dev/GDExtension Interface functions pool.h +++ /dev/null @@ -1,33 +0,0 @@ -// List of GDExtension Interface functions neither yet utilized nor found unnecessary // - -// Based on [`gdextension_interface.h`](include/godot/gdextension_interface.h): -// Copyright (c) 2014-present Godot Engine contributors. https://godotengine.org/license/ - -#include "../../include/godot/godot/gdextension_interface.h" - -/* INTERFACE */ -GDExtensionInterfaceGetGodotVersion get_godot_version; - -/* INTERFACE: Memory */ -GDExtensionInterfaceMemRealloc mem_realloc; - -/* INTERFACE: Variant */ -GDExtensionInterfaceVariantCallStatic variant_call_static; -GDExtensionInterfaceVariantEvaluate variant_evaluate; -GDExtensionInterfaceVariantIterInit variant_iter_init; -GDExtensionInterfaceVariantIterNext variant_iter_next; -GDExtensionInterfaceVariantIterGet variant_iter_get; -GDExtensionInterfaceVariantGetConstantValue variant_get_constant_value; -GDExtensionInterfaceVariantGetPtrUtilityFunction variant_get_ptr_utility_function; - -/* INTERFACE: FileAccess Utilities */ -GDExtensionInterfaceFileAccessStoreBuffer file_access_store_buffer; -GDExtensionInterfaceFileAccessGetBuffer file_access_get_buffer; - -/* INTERFACE: WorkerThreadPool Utilities */ -GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask worker_thread_pool_add_native_group_task; -GDExtensionInterfaceWorkerThreadPoolAddNativeTask worker_thread_pool_add_native_task; - -/* INTERFACE: Object */ -GDExtensionInterfaceObjectCastTo object_cast_to; -GDExtensionInterfaceObjectGetInstanceId object_get_instance_id; diff --git a/include/.gdignore b/ext/.gdignore similarity index 100% rename from include/.gdignore rename to ext/.gdignore diff --git a/src/cleanup.c b/ext/godot_rb/cleanup.c similarity index 100% rename from src/cleanup.c rename to ext/godot_rb/cleanup.c diff --git a/src/cleanup.h b/ext/godot_rb/cleanup.h similarity index 100% rename from src/cleanup.h rename to ext/godot_rb/cleanup.h diff --git a/ext/godot_rb/extconf.rb b/ext/godot_rb/extconf.rb new file mode 100644 index 0000000..70c1882 --- /dev/null +++ b/ext/godot_rb/extconf.rb @@ -0,0 +1,2 @@ +require 'mkmf' +create_makefile 'godot_rb' diff --git a/src/godot_rb.c b/ext/godot_rb/godot_rb.c similarity index 100% rename from src/godot_rb.c rename to ext/godot_rb/godot_rb.c diff --git a/src/ruby/mixins.c b/ext/godot_rb/ruby/mixins.c similarity index 100% rename from src/ruby/mixins.c rename to ext/godot_rb/ruby/mixins.c diff --git a/src/ruby/object.c b/ext/godot_rb/ruby/object.c similarity index 100% rename from src/ruby/object.c rename to ext/godot_rb/ruby/object.c diff --git a/src/ruby/objects.c b/ext/godot_rb/ruby/objects.c similarity index 100% rename from src/ruby/objects.c rename to ext/godot_rb/ruby/objects.c diff --git a/src/ruby/ruby_script.c b/ext/godot_rb/ruby/ruby_script.c similarity index 100% rename from src/ruby/ruby_script.c rename to ext/godot_rb/ruby/ruby_script.c diff --git a/src/ruby/ruby_script.h b/ext/godot_rb/ruby/ruby_script.h similarity index 100% rename from src/ruby/ruby_script.h rename to ext/godot_rb/ruby/ruby_script.h diff --git a/src/ruby/ruby_script_inst_get_virtual.c b/ext/godot_rb/ruby/ruby_script_inst_get_virtual.c similarity index 100% rename from src/ruby/ruby_script_inst_get_virtual.c rename to ext/godot_rb/ruby/ruby_script_inst_get_virtual.c diff --git a/src/ruby/string.c b/ext/godot_rb/ruby/string.c similarity index 100% rename from src/ruby/string.c rename to ext/godot_rb/ruby/string.c diff --git a/src/ruby/string_name.c b/ext/godot_rb/ruby/string_name.c similarity index 100% rename from src/ruby/string_name.c rename to ext/godot_rb/ruby/string_name.c diff --git a/src/ruby/variant.c b/ext/godot_rb/ruby/variant.c similarity index 100% rename from src/ruby/variant.c rename to ext/godot_rb/ruby/variant.c diff --git a/src/ruby/variants.h b/ext/godot_rb/ruby/variants.h similarity index 100% rename from src/ruby/variants.h rename to ext/godot_rb/ruby/variants.h diff --git a/src/setup.c b/ext/godot_rb/setup.c similarity index 100% rename from src/setup.c rename to ext/godot_rb/setup.c diff --git a/src/setup.h b/ext/godot_rb/setup.h similarity index 100% rename from src/setup.h rename to ext/godot_rb/setup.h diff --git a/src/.gdignore b/ext/include/.gdignore similarity index 100% rename from src/.gdignore rename to ext/include/.gdignore diff --git a/ext/include/godot b/ext/include/godot new file mode 160000 index 0000000..a7e2031 --- /dev/null +++ b/ext/include/godot @@ -0,0 +1 @@ +Subproject commit a7e2031b66c32b1c6f2d0f7305ee7222e342c5cc diff --git a/include/godot_rb.h b/ext/include/godot_rb.h similarity index 99% rename from include/godot_rb.h rename to ext/include/godot_rb.h index a94f746..089371b 100644 --- a/include/godot_rb.h +++ b/ext/include/godot_rb.h @@ -2,7 +2,7 @@ #define GODOT_RB_H #include -#include +#include // GDExtension (initialized by entry function) // diff --git a/include/godot b/include/godot deleted file mode 160000 index f22b80f..0000000 --- a/include/godot +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f22b80f495f87afd564eef142fd3b97579c00e3d diff --git a/lib/godot/enumerable.rb b/lib/godot_rb/enumerable.rb similarity index 100% rename from lib/godot/enumerable.rb rename to lib/godot_rb/enumerable.rb diff --git a/lib/godot/object.rb b/lib/godot_rb/object.rb similarity index 100% rename from lib/godot/object.rb rename to lib/godot_rb/object.rb diff --git a/lib/godot/objects.rb b/lib/godot_rb/objects.rb similarity index 100% rename from lib/godot/objects.rb rename to lib/godot_rb/objects.rb diff --git a/lib/godot/ruby_language.rb b/lib/godot_rb/ruby_language.rb similarity index 100% rename from lib/godot/ruby_language.rb rename to lib/godot_rb/ruby_language.rb diff --git a/lib/godot/ruby_script.rb b/lib/godot_rb/ruby_script.rb similarity index 100% rename from lib/godot/ruby_script.rb rename to lib/godot_rb/ruby_script.rb diff --git a/lib/godot/variant.rb b/lib/godot_rb/variant.rb similarity index 100% rename from lib/godot/variant.rb rename to lib/godot_rb/variant.rb diff --git a/lib/godot/version.rb b/lib/godot_rb/version.rb similarity index 100% rename from lib/godot/version.rb rename to lib/godot_rb/version.rb diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index cbf1e44..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -# This list is only to guide IDE setups. -# CMake may or may not be able to (only) build the library -# with these configs depending on your platform setup. - -project(Godot.rb C) -set(CMAKE_C_STANDARD 17) - -find_package(Ruby 3.2 EXACT REQUIRED) -include_directories(../include ${Ruby_INCLUDE_DIRS}) -link_libraries(${Ruby_LIBRARY}) - -file(GLOB_RECURSE SOURCES *.c) -add_library("Godot.rb" SHARED ${SOURCES})