summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml4
-rw-r--r--include/godot_cpp/classes/wrapped.hpp198
-rw-r--r--tools/godotcpp.py22
3 files changed, 115 insertions, 109 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1f316ff..b1256f7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -171,8 +171,8 @@ jobs:
chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
./godot-artifacts/godot.linuxbsd.editor.x86_64.mono --headless --version
cd test
- # Need to run the editor so .godot is generated... but it crashes! Ignore that :-)
- (cd project && (../../godot-artifacts/godot.linuxbsd.editor.x86_64.mono --editor --headless --quit >/dev/null 2>&1 || true))
+ # Need to run the editor twice so .godot is generated... but it crashes! Ignore that :-)
+ (cd project && (../../godot-artifacts/godot.linuxbsd.editor.x86_64.mono --editor --headless --quit-after 100 >/dev/null 2>&1 || true))
GODOT=../godot-artifacts/godot.linuxbsd.editor.x86_64.mono ./run-tests.sh
- name: Upload artifact
diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp
index af2ce4c..75bd3b0 100644
--- a/include/godot_cpp/classes/wrapped.hpp
+++ b/include/godot_cpp/classes/wrapped.hpp
@@ -365,105 +365,109 @@ public:
_gde_binding_create_callback, \
_gde_binding_free_callback, \
_gde_binding_reference_callback, \
- };
+ }; \
+ \
+private:
// Don't use this for your classes, use GDCLASS() instead.
-#define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) \
-private: \
- inline static ::godot::internal::EngineClassRegistration<m_class> _gde_engine_class_registration_helper; \
- void operator=(const m_class &p_rval) {} \
- \
-protected: \
- virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
- return &_gde_binding_callbacks; \
- } \
- \
- m_class(const char *p_godot_class) : m_inherits(p_godot_class) {} \
- m_class(GodotObject *p_godot_object) : m_inherits(p_godot_object) {} \
- \
- static void (*_get_bind_methods())() { \
- return nullptr; \
- } \
- \
- static void (Wrapped::*_get_notification())(int) { \
- return nullptr; \
- } \
- \
- static bool (Wrapped::*_get_set())(const ::godot::StringName &p_name, const Variant &p_property) { \
- return nullptr; \
- } \
- \
- static bool (Wrapped::*_get_get())(const ::godot::StringName &p_name, Variant &r_ret) const { \
- return nullptr; \
- } \
- \
- static inline bool has_get_property_list() { \
- return false; \
- } \
- \
- static void (Wrapped::*_get_get_property_list())(List<PropertyInfo> * p_list) const { \
- return nullptr; \
- } \
- \
- static bool (Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
- return nullptr; \
- } \
- \
- static bool (Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, Variant &) const { \
- return nullptr; \
- } \
- \
- static void (Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
- return nullptr; \
- } \
- \
- static String (Wrapped::*_get_to_string())() const { \
- return nullptr; \
- } \
- \
-public: \
- typedef m_class self_type; \
- \
- static void initialize_class() {} \
- \
- static ::godot::StringName &get_class_static() { \
- static ::godot::StringName string_name = ::godot::StringName(#m_alias_for); \
- return string_name; \
- } \
- \
- static ::godot::StringName &get_parent_class_static() { \
- return m_inherits::get_class_static(); \
- } \
- \
- static GDExtensionObjectPtr create(void *data) { \
- return nullptr; \
- } \
- \
- static GDExtensionClassInstancePtr recreate(void *data, GDExtensionObjectPtr obj) { \
- return nullptr; \
- } \
- \
- static void free(void *data, GDExtensionClassInstancePtr ptr) { \
- } \
- \
- static void *_gde_binding_create_callback(void *p_token, void *p_instance) { \
- /* Do not call memnew here, we don't want the post-initializer to be called */ \
- return new ("") m_class((GodotObject *)p_instance); \
- } \
- static void _gde_binding_free_callback(void *p_token, void *p_instance, void *p_binding) { \
- /* Explicitly call the deconstructor to ensure proper lifecycle for non-trivial members */ \
- reinterpret_cast<m_class *>(p_binding)->~m_class(); \
- Memory::free_static(reinterpret_cast<m_class *>(p_binding)); \
- } \
- static GDExtensionBool _gde_binding_reference_callback(void *p_token, void *p_instance, GDExtensionBool p_reference) { \
- return true; \
- } \
- static constexpr GDExtensionInstanceBindingCallbacks _gde_binding_callbacks = { \
- _gde_binding_create_callback, \
- _gde_binding_free_callback, \
- _gde_binding_reference_callback, \
- }; \
- m_class() : m_class(#m_alias_for) {}
+#define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) /******************************************************************************************************************/ \
+private: \
+ inline static ::godot::internal::EngineClassRegistration<m_class> _gde_engine_class_registration_helper; \
+ void operator=(const m_class &p_rval) {} \
+ \
+protected: \
+ virtual const GDExtensionInstanceBindingCallbacks *_get_bindings_callbacks() const override { \
+ return &_gde_binding_callbacks; \
+ } \
+ \
+ m_class(const char *p_godot_class) : m_inherits(p_godot_class) {} \
+ m_class(GodotObject *p_godot_object) : m_inherits(p_godot_object) {} \
+ \
+ static void (*_get_bind_methods())() { \
+ return nullptr; \
+ } \
+ \
+ static void (Wrapped::*_get_notification())(int) { \
+ return nullptr; \
+ } \
+ \
+ static bool (Wrapped::*_get_set())(const ::godot::StringName &p_name, const Variant &p_property) { \
+ return nullptr; \
+ } \
+ \
+ static bool (Wrapped::*_get_get())(const ::godot::StringName &p_name, Variant &r_ret) const { \
+ return nullptr; \
+ } \
+ \
+ static inline bool has_get_property_list() { \
+ return false; \
+ } \
+ \
+ static void (Wrapped::*_get_get_property_list())(List<PropertyInfo> * p_list) const { \
+ return nullptr; \
+ } \
+ \
+ static bool (Wrapped::*_get_property_can_revert())(const ::godot::StringName &p_name) const { \
+ return nullptr; \
+ } \
+ \
+ static bool (Wrapped::*_get_property_get_revert())(const ::godot::StringName &p_name, Variant &) const { \
+ return nullptr; \
+ } \
+ \
+ static void (Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
+ return nullptr; \
+ } \
+ \
+ static String (Wrapped::*_get_to_string())() const { \
+ return nullptr; \
+ } \
+ \
+public: \
+ typedef m_class self_type; \
+ \
+ static void initialize_class() {} \
+ \
+ static ::godot::StringName &get_class_static() { \
+ static ::godot::StringName string_name = ::godot::StringName(#m_alias_for); \
+ return string_name; \
+ } \
+ \
+ static ::godot::StringName &get_parent_class_static() { \
+ return m_inherits::get_class_static(); \
+ } \
+ \
+ static GDExtensionObjectPtr create(void *data) { \
+ return nullptr; \
+ } \
+ \
+ static GDExtensionClassInstancePtr recreate(void *data, GDExtensionObjectPtr obj) { \
+ return nullptr; \
+ } \
+ \
+ static void free(void *data, GDExtensionClassInstancePtr ptr) { \
+ } \
+ \
+ static void *_gde_binding_create_callback(void *p_token, void *p_instance) { \
+ /* Do not call memnew here, we don't want the post-initializer to be called */ \
+ return new ("") m_class((GodotObject *)p_instance); \
+ } \
+ static void _gde_binding_free_callback(void *p_token, void *p_instance, void *p_binding) { \
+ /* Explicitly call the deconstructor to ensure proper lifecycle for non-trivial members */ \
+ reinterpret_cast<m_class *>(p_binding)->~m_class(); \
+ Memory::free_static(reinterpret_cast<m_class *>(p_binding)); \
+ } \
+ static GDExtensionBool _gde_binding_reference_callback(void *p_token, void *p_instance, GDExtensionBool p_reference) { \
+ return true; \
+ } \
+ static constexpr GDExtensionInstanceBindingCallbacks _gde_binding_callbacks = { \
+ _gde_binding_create_callback, \
+ _gde_binding_free_callback, \
+ _gde_binding_reference_callback, \
+ }; \
+ m_class() : m_class(#m_alias_for) {} \
+ \
+private:
// Don't use this for your classes, use GDCLASS() instead.
#define GDEXTENSION_CLASS(m_class, m_inherits) GDEXTENSION_CLASS_ALIAS(m_class, m_class, m_inherits)
diff --git a/tools/godotcpp.py b/tools/godotcpp.py
index 8e7e1c6..fcf4dd7 100644
--- a/tools/godotcpp.py
+++ b/tools/godotcpp.py
@@ -179,7 +179,7 @@ def options(opts, env):
BoolVariable(
key="use_hot_reload",
help="Enable the extra accounting required to support hot reload.",
- default=(env.get("target", "template_debug") != "template_release"),
+ default=env.get("use_hot_reload", None),
)
)
@@ -245,9 +245,20 @@ def generate(env):
print("Building for architecture " + env["arch"] + " on platform " + env["platform"])
+ if env.get("use_hot_reload") is None:
+ env["use_hot_reload"] = env["target"] != "template_release"
if env["use_hot_reload"]:
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"])
+ tool = Tool(env["platform"], toolpath=["tools"])
+
+ if tool is None or not tool.exists(env):
+ raise ValueError("Required toolchain not found for platform " + env["platform"])
+
+ tool.generate(env)
+ target_tool = Tool("targets", toolpath=["tools"])
+ target_tool.generate(env)
+
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time.
if env["disable_exceptions"]:
@@ -258,15 +269,6 @@ def generate(env):
elif env.get("is_msvc", False):
env.Append(CXXFLAGS=["/EHsc"])
- tool = Tool(env["platform"], toolpath=["tools"])
-
- if tool is None or not tool.exists(env):
- raise ValueError("Required toolchain not found for platform " + env["platform"])
-
- tool.generate(env)
- target_tool = Tool("targets", toolpath=["tools"])
- target_tool.generate(env)
-
# Require C++17
if env.get("is_msvc", False):
env.Append(CXXFLAGS=["/std:c++17"])