Use gdnative api to get constants only for javascript platform

When trying to load the library in a non-Mono Godot editor v3.3.2
an error is printed about godot_get_global_constants(). Furthermore,
the issue with using the GlobalConstants header to get constants is only
present on the javascript platform, so we can revert all other platforms
to the old way of getting constants.
This commit is contained in:
Leroy Hopson 2021-06-19 19:39:20 +07:00
parent 302bdf0714
commit 0743f2a97a
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA

View file

@ -8,7 +8,7 @@
#include <xkbcommon/xkbcommon-keysyms.h>
// For _populate_key_list(), see below.
#if defined(__WIN32)
#if !defined(__EMSCRIPTEN__)
#include <GlobalConstants.hpp>
#endif
@ -21,12 +21,11 @@ void Terminal::_populate_key_list() {
if (!_key_list.empty())
return;
// GitHub action for Windows throws the error:
// `error LNK2019: unresolved external symbol godot_get_global_constants
// referenced in function "private: static void __cdecl
// godot::Terminal::_populate_key_list(void)"` so use the old technique of
// getting KeyList values from GlobalConstants header for now.
#if defined(__WIN32)
// The following error is thrown on the javascript platform when using
// GlobalConstants from the header: abort(Assertion failed: bad export type for
// `_ZN5godot15GlobalConstants8KEY_KP_0E`: undefined). Build with -s
// ASSERTIONS=1 for more info.
#if !defined(__EMSCRIPTEN__)
#define GLOBAL_CONSTANT(VAR) GlobalConstants::VAR
#else
#define GLOBAL_CONSTANT(VAR) get_constant(#VAR)