Skip to content

Commit da26c17

Browse files
authored
Merge pull request #1891 from dsnopek/4.5-cherrypicks-2
Cherry-picks for the godot-cpp 4.5 branch - 2nd batch
2 parents abe9457 + 7284ac7 commit da26c17

File tree

10 files changed

+23
-22
lines changed

10 files changed

+23
-22
lines changed

.github/actions/setup-godot-cpp/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ inputs:
66
required: true
77
description: Target platform.
88
em-version:
9-
default: 3.1.62
9+
default: 4.0.11
1010
description: Emscripten version.
1111
windows-compiler:
1212
required: true

.github/workflows/ci-cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
name: ${{ matrix.name }}
2121
runs-on: ${{ matrix.os }}
2222
env:
23-
EM_VERSION: 3.1.39
23+
EM_VERSION: 4.0.11
2424
config-flags:
2525
-DCMAKE_C_COMPILER_LAUNCHER=sccache
2626
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache

.github/workflows/ci-scons.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787

8888
env:
8989
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
90-
EM_VERSION: 3.1.39
90+
EM_VERSION: 4.0.11
9191

9292
steps:
9393
- name: Checkout

binding_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def generate_virtual_version(argcount, const=False, returns=False, required=Fals
9797

9898
sproto = str(argcount)
9999
method_info = ""
100-
method_flags = "METHOD_FLAG_VIRTUAL"
100+
method_flags = "::godot::MethodFlags::METHOD_FLAG_VIRTUAL"
101101
if returns:
102102
sproto += "R"
103103
s = s.replace("$RET", "m_ret,")
@@ -110,14 +110,14 @@ def generate_virtual_version(argcount, const=False, returns=False, required=Fals
110110

111111
if const:
112112
sproto += "C"
113-
method_flags += " | METHOD_FLAG_CONST"
113+
method_flags += " | ::godot::MethodFlags::METHOD_FLAG_CONST"
114114
s = s.replace("$CONST", "const")
115115
else:
116116
s = s.replace("$CONST ", "")
117117

118118
if required:
119119
sproto += "_REQUIRED"
120-
method_flags += " | METHOD_FLAG_VIRTUAL_REQUIRED"
120+
method_flags += " | ::godot::MethodFlags::METHOD_FLAG_VIRTUAL_REQUIRED"
121121
s = s.replace(
122122
"$REQCHECK",
123123
'ERR_PRINT_ONCE("Required virtual method " + get_class() + "::" + #m_name + " must be overridden before calling.");',

cmake/common_compiler_flags.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ function(common_compiler_flags)
6666
# The public flag tells CMake that the following options are transient,
6767
# and will propagate to consumers.
6868
PUBLIC
69-
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
70-
# saves around 20% of binary size and very significant build time.
71-
$<${DISABLE_EXCEPTIONS}:$<${NOT_MSVC}:-fno-exceptions>>
7269

7370
# Enabling Debug Symbols
7471
$<${DEBUG_SYMBOLS}:
@@ -95,6 +92,9 @@ function(common_compiler_flags)
9592

9693
# Warnings below, these do not need to propagate to consumers.
9794
PRIVATE
95+
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
96+
# saves around 20% of binary size and very significant build time.
97+
$<${DISABLE_EXCEPTIONS}:$<${NOT_MSVC}:-fno-exceptions>>
9898
$<${IS_MSVC}:
9999
/W4 # Warning level 4 (informational) warnings that aren't off by default.
100100

cmake/linux.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function(linux_options)
1515
the docs (https://docs.godotengine.org/en/latest/tutorials/scripting/cpp/build_system/cmake.html)
1616
for examples.
1717
]]
18-
option(GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" ON)
18+
option(GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" OFF)
1919
endfunction()
2020

2121
#[===========================[ Target Generation ]===========================]

cmake/web.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function(web_generate)
2121
target_compile_options(
2222
godot-cpp
2323
PUBLIC #
24-
-sSIDE_MODULE
24+
-sSIDE_MODULE=1
2525
-sSUPPORT_LONGJMP=wasm
2626
$<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
2727
)
@@ -33,6 +33,7 @@ function(web_generate)
3333
-sSUPPORT_LONGJMP=wasm
3434
-fvisibility=hidden
3535
-shared
36+
$<${THREADS_ENABLED}:-sUSE_PTHREADS=1>
3637
)
3738

3839
common_compiler_flags()

include/godot_cpp/core/class_db.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class ClassDB {
9696

9797
private:
9898
// This may only contain custom classes, not Godot classes
99-
static AHashMap<StringName, ClassInfo> classes;
99+
static HashMap<StringName, ClassInfo> classes;
100100
static AHashMap<StringName, const GDExtensionInstanceBindingCallbacks *> instance_binding_callbacks;
101101
// Used to remember the custom class registration order.
102102
static LocalVector<StringName> class_register_order;
@@ -233,7 +233,7 @@ void ClassDB::_register_class(bool p_virtual, bool p_exposed, bool p_runtime) {
233233
cl.name = T::get_class_static();
234234
cl.parent_name = T::get_parent_class_static();
235235
cl.level = current_level;
236-
AHashMap<StringName, ClassInfo>::Iterator parent_it = classes.find(cl.parent_name);
236+
HashMap<StringName, ClassInfo>::Iterator parent_it = classes.find(cl.parent_name);
237237
if (parent_it != classes.end()) {
238238
// Assign parent if it is also a custom class
239239
cl.parent_ptr = &parent_it->value;
@@ -330,7 +330,7 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p
330330

331331
StringName instance_type = bind->get_instance_class();
332332

333-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
333+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
334334
if (type_it == classes.end()) {
335335
memdelete(bind);
336336
ERR_FAIL_V_MSG(nullptr, String("Class '{0}' doesn't exist.").format(Array::make(instance_type)));

src/core/class_db.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
namespace godot {
4040

41-
AHashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
41+
HashMap<StringName, ClassDB::ClassInfo> ClassDB::classes;
4242
AHashMap<StringName, const GDExtensionInstanceBindingCallbacks *> ClassDB::instance_binding_callbacks;
4343
LocalVector<StringName> ClassDB::class_register_order;
4444
AHashMap<StringName, Object *> ClassDB::engine_singletons;
@@ -128,7 +128,7 @@ MethodBind *ClassDB::get_method(const StringName &p_class, const StringName &p_m
128128
MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const MethodDefinition &method_name, const void **p_defs, int p_defcount) {
129129
StringName instance_type = p_bind->get_instance_class();
130130

131-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
131+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(instance_type);
132132
if (type_it == classes.end()) {
133133
memdelete(p_bind);
134134
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
233233
}
234234

235235
void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) {
236-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
236+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
237237

238238
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
239239

@@ -268,7 +268,7 @@ void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal)
268268
}
269269

270270
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) {
271-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class_name);
271+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class_name);
272272

273273
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class_name)));
274274

@@ -290,7 +290,7 @@ GDExtensionClassCallVirtual ClassDB::get_virtual_func(void *p_userdata, GDExtens
290290
const StringName *class_name = reinterpret_cast<const StringName *>(p_userdata);
291291
const StringName *name = reinterpret_cast<const StringName *>(p_name);
292292

293-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(*class_name);
293+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(*class_name);
294294
ERR_FAIL_COND_V_MSG(type_it == classes.end(), nullptr, String("Class '{0}' doesn't exist.").format(Array::make(*class_name)));
295295

296296
const ClassInfo *type = &type_it->value;
@@ -327,7 +327,7 @@ const GDExtensionInstanceBindingCallbacks *ClassDB::get_instance_binding_callbac
327327
}
328328

329329
void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p_method, GDExtensionClassCallVirtual p_call, uint32_t p_hash) {
330-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
330+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
331331
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
332332

333333
ClassInfo &type = type_it->value;
@@ -342,7 +342,7 @@ void ClassDB::bind_virtual_method(const StringName &p_class, const StringName &p
342342
}
343343

344344
void ClassDB::add_virtual_method(const StringName &p_class, const MethodInfo &p_method, const Vector<StringName> &p_arg_names) {
345-
AHashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
345+
HashMap<StringName, ClassInfo>::Iterator type_it = classes.find(p_class);
346346
ERR_FAIL_COND_MSG(type_it == classes.end(), String("Class '{0}' doesn't exist.").format(Array::make(p_class)));
347347

348348
GDExtensionClassVirtualMethodInfo mi;

tools/linux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
def options(opts):
77
opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux", False))
8-
opts.Add(BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True))
8+
opts.Add(BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", False))
99

1010

1111
def exists(env):

0 commit comments

Comments
 (0)