diff --git a/.github/actions/setup-godot-cpp/action.yml b/.github/actions/setup-godot-cpp/action.yml index d67bb999f..33f0927fb 100644 --- a/.github/actions/setup-godot-cpp/action.yml +++ b/.github/actions/setup-godot-cpp/action.yml @@ -6,7 +6,7 @@ inputs: required: true description: Target platform. em-version: - default: 3.1.62 + default: 4.0.11 description: Emscripten version. windows-compiler: required: true diff --git a/.github/workflows/ci-cmake.yml b/.github/workflows/ci-cmake.yml index cc7ae6b07..6b64a1ddd 100644 --- a/.github/workflows/ci-cmake.yml +++ b/.github/workflows/ci-cmake.yml @@ -20,7 +20,7 @@ jobs: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} env: - EM_VERSION: 3.1.39 + EM_VERSION: 4.0.11 config-flags: -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache diff --git a/.github/workflows/ci-scons.yml b/.github/workflows/ci-scons.yml index 37b4ce395..aeaff4319 100644 --- a/.github/workflows/ci-scons.yml +++ b/.github/workflows/ci-scons.yml @@ -87,7 +87,7 @@ jobs: env: SCONS_CACHE: ${{ github.workspace }}/.scons-cache/ - EM_VERSION: 3.1.39 + EM_VERSION: 4.0.11 steps: - name: Checkout diff --git a/binding_generator.py b/binding_generator.py index 80f1d7aaa..4da069967 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -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.");', diff --git a/cmake/common_compiler_flags.cmake b/cmake/common_compiler_flags.cmake index 8a9a41ccb..50bccb9d8 100644 --- a/cmake/common_compiler_flags.cmake +++ b/cmake/common_compiler_flags.cmake @@ -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. diff --git a/cmake/linux.cmake b/cmake/linux.cmake index 1fe163836..644f0814c 100644 --- a/cmake/linux.cmake +++ b/cmake/linux.cmake @@ -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 ]===========================] diff --git a/cmake/web.cmake b/cmake/web.cmake index 819aa89af..65283b60c 100644 --- a/cmake/web.cmake +++ b/cmake/web.cmake @@ -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() diff --git a/include/godot_cpp/core/class_db.hpp b/include/godot_cpp/core/class_db.hpp index b14f597a2..96025b903 100644 --- a/include/godot_cpp/core/class_db.hpp +++ b/include/godot_cpp/core/class_db.hpp @@ -96,7 +96,7 @@ class ClassDB { private: // This may only contain custom classes, not Godot classes - static AHashMap classes; + static HashMap classes; static AHashMap instance_binding_callbacks; // Used to remember the custom class registration order. static LocalVector class_register_order; @@ -233,7 +233,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::Iterator parent_it = classes.find(cl.parent_name); + HashMap::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; @@ -330,7 +330,7 @@ MethodBind *ClassDB::bind_vararg_method(uint32_t p_flags, StringName p_name, M p StringName instance_type = bind->get_instance_class(); - AHashMap::Iterator type_it = classes.find(instance_type); + HashMap::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))); diff --git a/src/core/class_db.cpp b/src/core/class_db.cpp index 11f7b0778..b03e9f477 100644 --- a/src/core/class_db.cpp +++ b/src/core/class_db.cpp @@ -38,7 +38,7 @@ namespace godot { -AHashMap ClassDB::classes; +HashMap ClassDB::classes; AHashMap ClassDB::instance_binding_callbacks; LocalVector ClassDB::class_register_order; AHashMap 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::Iterator type_it = classes.find(instance_type); + HashMap::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::Iterator type_it = classes.find(p_class); + HashMap::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::Iterator type_it = classes.find(p_class_name); + HashMap::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(p_userdata); const StringName *name = reinterpret_cast(p_name); - AHashMap::Iterator type_it = classes.find(*class_name); + HashMap::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::Iterator type_it = classes.find(p_class); + HashMap::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 &p_arg_names) { - AHashMap::Iterator type_it = classes.find(p_class); + HashMap::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; diff --git a/tools/linux.py b/tools/linux.py index ae8019877..8aae02c15 100644 --- a/tools/linux.py +++ b/tools/linux.py @@ -5,7 +5,7 @@ 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):