Merge pull request #1890 from dsnopek/4.4-cherrypicks-5

Cherry-picks for the godot-cpp 4.4 branch - 5th batch
This commit is contained in:
David Snopek
2025-12-01 05:23:45 -06:00
committed by GitHub
7 changed files with 20 additions and 19 deletions

View File

@@ -97,7 +97,7 @@ def generate_virtual_version(argcount, const=False, returns=False, required=Fals
sproto = str(argcount)
method_info = ""
method_flags = "METHOD_FLAG_VIRTUAL"
method_flags = "::godot::MethodFlags::METHOD_FLAG_VIRTUAL"
if returns:
sproto += "R"
s = s.replace("$RET", "m_ret,")
@@ -110,14 +110,14 @@ def generate_virtual_version(argcount, const=False, returns=False, required=Fals
if const:
sproto += "C"
method_flags += " | METHOD_FLAG_CONST"
method_flags += " | ::godot::MethodFlags::METHOD_FLAG_CONST"
s = s.replace("$CONST", "const")
else:
s = s.replace("$CONST ", "")
if required:
sproto += "_REQUIRED"
method_flags += " | METHOD_FLAG_VIRTUAL_REQUIRED"
method_flags += " | ::godot::MethodFlags::METHOD_FLAG_VIRTUAL_REQUIRED"
s = s.replace(
"$REQCHECK",
'ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");',

View File

@@ -66,9 +66,6 @@ function(common_compiler_flags)
# The public flag tells CMake that the following options are transient,
# and will propagate to consumers.
PUBLIC
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time.
$<${DISABLE_EXCEPTIONS}:$<${NOT_MSVC}:-fno-exceptions>>
# Enabling Debug Symbols
$<${DEBUG_SYMBOLS}:
@@ -95,6 +92,9 @@ function(common_compiler_flags)
# Warnings below, these do not need to propagate to consumers.
PRIVATE
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time.
$<${DISABLE_EXCEPTIONS}:$<${NOT_MSVC}:-fno-exceptions>>
$<${IS_MSVC}:
/W4 # Warning level 4 (informational) warnings that aren't off by default.

View File

@@ -15,7 +15,7 @@ function(linux_options)
the docs (https://docs.godotengine.org/en/latest/tutorials/scripting/cpp/build_system/cmake.html)
for examples.
]]
option(GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" ON)
option(GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" OFF)
endfunction()
#[===========================[ Target Generation ]===========================]

View File

@@ -21,7 +21,7 @@ function(web_generate)
target_compile_options(
godot-cpp
PUBLIC #
-sSIDE_MODULE
-sSIDE_MODULE=1
-sSUPPORT_LONGJMP=wasm
$<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
)
@@ -33,6 +33,7 @@ function(web_generate)
-sSUPPORT_LONGJMP=wasm
-fvisibility=hidden
-shared
$<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
)
common_compiler_flags()

View File

@@ -96,7 +96,7 @@ public:
private:
// This may only contain custom classes, not Godot classes
static AHashMap<StringName, ClassInfo> classes;
static HashMap<StringName, ClassInfo> classes;
static AHashMap<StringName, const GDExtensionInstanceBindingCallbacks *> instance_binding_callbacks;
// Used to remember the custom class registration order.
static LocalVector<StringName> class_register_order;
@@ -231,7 +231,7 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) {
cl.name = T::get_class_static();
cl.parent_name = T::get_parent_class_static();
cl.level = current_level;
AHashMap<StringName, ClassInfo>::Iterator parent_it = classes.find(cl.parent_name);
HashMap<StringName, ClassInfo>::Iterator parent_it = classes.find(cl.parent_name);
if (parent_it != classes.end()) {
// Assign parent if it is also a custom class
cl.parent_ptr = &parent_it->value;
@@ -328,7 +328,7 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p
StringName instance_type = bind->get_instance_class();
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
if (type_it == classes.end()) {
memdelete(bind);
ERR_FAIL_V_MSG(nullptr, String("Class '{0}' doesn't exist.").format(Array::make(instance_type)));

View File

@@ -38,7 +38,7 @@
namespace godot {
AHashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
HashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
AHashMap<StringName, const GDExtensionInstanceBindingCallbacks *> ClassDB::instance_binding_callbacks;
LocalVector<StringName> ClassDB::class_register_order;
AHashMap<StringName, Object *> ClassDB::engine_singletons;
@@ -128,7 +128,7 @@ MethodBind *ClassDB::get_method(const StringName &p_class, const StringName &p_m
MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const MethodDefinition &method_name, const void **p_defs, int p_defcount) {
StringName instance_type = p_bind->get_instance_class();
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
if (type_it == classes.end()) {
memdelete(p_bind);
ERR_FAIL_V_MSG(nullptr, String("Class '{0}' doesn't exist.").format(Array::make(instance_type)));
@@ -233,7 +233,7 @@ void ClassDB::bind_method_godot(const StringName &p_class_name, MethodBind *p_me
}
void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) {
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
@@ -268,7 +268,7 @@ void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal)
}
void ClassDB::bind_integer_constant(const StringName &p_class_name, const StringName &p_enum_name, const StringName &p_constant_name, GDExtensionInt p_constant_value, bool p_is_bitfield) {
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class_name);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class_name);
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class_name)));
@@ -290,7 +290,7 @@ GDExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDExtens
const StringName *class_name = reinterpret_cast<const StringName *>(p_userdata);
const StringName *name = reinterpret_cast<const StringName *>(p_name);
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(*class_name);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(*class_name);
ERR_FAIL_COND_V_MSG(type_it == classes.end(), nullptr, String("Class '{0}' doesn't exist.").format(Array::make(*class_name)));
const ClassInfo *type = &type_it->value;
@@ -327,7 +327,7 @@ const GDExtensionInstanceBindingCallbacks *ClassDB::get_instance_binding_callbac
}
void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p_method, GDExtensionClassCallVirtual p_call, uint32_t p_hash) {
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
ClassInfo &type = type_it->value;
@@ -342,7 +342,7 @@ void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p
}
void ClassDB::add_virtual_method(const StringName &p_class, const MethodInfo &p_method, const Vector<StringName> &p_arg_names) {
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
GDExtensionClassVirtualMethodInfo mi;

View File

@@ -5,7 +5,7 @@ from SCons.Variables import BoolVariable
def options(opts):
opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux", False))
opts.Add(BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True))
opts.Add(BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", False))
def exists(env):