Allow unicode class names

pull/1574/head
David Snopek 2024-09-06 17:24:07 -05:00
parent d477589104
commit 536ea8561e
7 changed files with 34 additions and 7 deletions

View File

@ -6,6 +6,9 @@ env:
GODOT_BASE_BRANCH: master GODOT_BASE_BRANCH: master
# Used to select the version of Godot to run the tests with. # Used to select the version of Godot to run the tests with.
GODOT_TEST_VERSION: master GODOT_TEST_VERSION: master
# Use UTF-8 on Linux.
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
concurrency: concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}} group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
@ -20,7 +23,7 @@ jobs:
matrix: matrix:
include: include:
- name: 🐧 Linux (GCC) - name: 🐧 Linux (GCC)
os: ubuntu-20.04 os: ubuntu-22.04
platform: linux platform: linux
artifact-name: godot-cpp-linux-glibc2.27-x86_64-release artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a
@ -28,7 +31,7 @@ jobs:
cache-name: linux-x86_64 cache-name: linux-x86_64
- name: 🐧 Linux (GCC, Double Precision) - name: 🐧 Linux (GCC, Double Precision)
os: ubuntu-20.04 os: ubuntu-22.04
platform: linux platform: linux
artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
@ -63,7 +66,7 @@ jobs:
cache-name: macos-universal cache-name: macos-universal
- name: 🤖 Android (arm64) - name: 🤖 Android (arm64)
os: ubuntu-20.04 os: ubuntu-22.04
platform: android platform: android
artifact-name: godot-cpp-android-arm64-release artifact-name: godot-cpp-android-arm64-release
artifact-path: bin/libgodot-cpp.android.template_release.arm64.a artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
@ -81,7 +84,7 @@ jobs:
cache-name: ios-arm64 cache-name: ios-arm64
- name: 🌐 Web (wasm32) - name: 🌐 Web (wasm32)
os: ubuntu-20.04 os: ubuntu-22.04
platform: web platform: web
artifact-name: godot-cpp-web-wasm32-release artifact-name: godot-cpp-web-wasm32-release
artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
@ -206,7 +209,7 @@ jobs:
linux-cmake: linux-cmake:
name: 🐧 Build (Linux, GCC, CMake) name: 🐧 Build (Linux, GCC, CMake)
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -230,7 +233,7 @@ jobs:
linux-cmake-ninja: linux-cmake-ninja:
name: 🐧 Build (Linux, GCC, CMake Ninja) name: 🐧 Build (Linux, GCC, CMake Ninja)
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -250,7 +250,7 @@ public:
} \ } \
\ \
static const ::godot::StringName &get_class_static() { \ static const ::godot::StringName &get_class_static() { \
static const ::godot::StringName string_name = ::godot::StringName(#m_class); \ static const ::godot::StringName string_name = ::godot::StringName(U## #m_class); \
return string_name; \ return string_name; \
} \ } \
\ \

View File

@ -38,6 +38,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# using Visual Studio C++ # using Visual Studio C++
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /WX") # /GF /MP set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /WX") # /GF /MP
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /DTYPED_METHOD_BIND") set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /DTYPED_METHOD_BIND")
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /utf-8")
if(CMAKE_BUILD_TYPE MATCHES Debug) if(CMAKE_BUILD_TYPE MATCHES Debug)
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi

View File

@ -276,6 +276,10 @@ func _ready():
assert_equal(library_path, ProjectSettings.globalize_path(library_path)) assert_equal(library_path, ProjectSettings.globalize_path(library_path))
assert_equal(FileAccess.file_exists(library_path), true) assert_equal(FileAccess.file_exists(library_path), true)
# Test a class with a unicode name.
var przykład = ExamplePrzykład.new()
assert_equal(przykład.get_the_word(), "słowo to przykład")
exit_with_status() exit_with_status()
func _on_Example_custom_signal(signal_name, value): func _on_Example_custom_signal(signal_name, value):

View File

@ -736,3 +736,11 @@ ExampleRuntime::ExampleRuntime() {
ExampleRuntime::~ExampleRuntime() { ExampleRuntime::~ExampleRuntime() {
} }
void ExamplePrzykład::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word);
}
String ExamplePrzykład::get_the_word() const {
return U"słowo to przykład";
}

View File

@ -273,4 +273,14 @@ public:
~ExampleRuntime(); ~ExampleRuntime();
}; };
class ExamplePrzykład : public RefCounted {
GDCLASS(ExamplePrzykład, RefCounted);
protected:
static void _bind_methods();
public:
String get_the_word() const;
};
#endif // EXAMPLE_CLASS_H #endif // EXAMPLE_CLASS_H

View File

@ -30,6 +30,7 @@ void initialize_example_module(ModuleInitializationLevel p_level) {
GDREGISTER_CLASS(ExampleBase); GDREGISTER_CLASS(ExampleBase);
GDREGISTER_CLASS(ExampleChild); GDREGISTER_CLASS(ExampleChild);
GDREGISTER_RUNTIME_CLASS(ExampleRuntime); GDREGISTER_RUNTIME_CLASS(ExampleRuntime);
GDREGISTER_CLASS(ExamplePrzykład);
} }
void uninitialize_example_module(ModuleInitializationLevel p_level) { void uninitialize_example_module(ModuleInitializationLevel p_level) {