diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-07-20 19:05:49 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-08-08 19:30:34 +0200 |
commit | 27a072c8845c3919b49426d161f83c360c0bfe6f (patch) | |
tree | 4d07aa3b0de32633f47666f6547d8148d42e5c97 /core/config | |
parent | 862dedcefee5d22449eca711aa9af33c4377d31a (diff) |
Print expected `os.arch` tuple for current platform in GDExtension error
This also adds `Engine.get_architecture_name()` to get the name of the
CPU architecture the Godot binary was built for.
Diffstat (limited to 'core/config')
-rw-r--r-- | core/config/engine.cpp | 36 | ||||
-rw-r--r-- | core/config/engine.h | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/core/config/engine.cpp b/core/config/engine.cpp index 1a6093869f..e1da9eb44e 100644 --- a/core/config/engine.cpp +++ b/core/config/engine.cpp @@ -181,6 +181,42 @@ String Engine::get_license_text() const { return String(GODOT_LICENSE_TEXT); } +String Engine::get_architecture_name() const { +#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64__) || defined(_M_X64) + return "x86_64"; + +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) + return "x86_32"; + +#elif defined(__aarch64__) || defined(_M_ARM64) + return "arm64"; + +#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__) + return "armv7"; + +#elif defined(__riscv) +#if __riscv_xlen == 8 + return "rv64"; +#else + return "riscv"; +#endif + +#elif defined(__powerpc__) +#if defined(__powerpc64__) + return "ppc64"; +#else + return "ppc"; +#endif + +#elif defined(__wasm__) +#if defined(__wasm64__) + return "wasm64"; +#elif defined(__wasm32__) + return "wasm32"; +#endif +#endif +} + bool Engine::is_abort_on_gpu_errors_enabled() const { return abort_on_gpu_errors; } diff --git a/core/config/engine.h b/core/config/engine.h index 68562643e7..649be23717 100644 --- a/core/config/engine.h +++ b/core/config/engine.h @@ -142,6 +142,8 @@ public: void set_write_movie_path(const String &p_path); String get_write_movie_path() const; + String get_architecture_name() const; + void set_shader_cache_path(const String &p_path); String get_shader_cache_path() const; |