Selaa lähdekoodia

Fix GDN_EXPORT define with mingw.

This commit changes the platform detection order to detect mingw
compiling for windows (which defines `__GNUC__`).

This commit also wraps the definition around a guard so it can be
overridden via a define at build-time.
Fabio Alessandrelli 3 vuotta sitten
vanhempi
commit
5bbcd42378
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5 3
      include/godot_cpp/core/defs.hpp

+ 5 - 3
include/godot_cpp/core/defs.hpp

@@ -34,13 +34,15 @@
 #include <cstddef>
 #include <cstdint>
 
-#ifdef __GNUC__
-#define GDN_EXPORT __attribute__((visibility("default")))
-#elif defined(_WIN32)
+#if !defined(GDN_EXPORT)
+#if defined(_WIN32)
 #define GDN_EXPORT __declspec(dllexport)
+#elif defined(__GNUC__)
+#define GDN_EXPORT __attribute__((visibility("default")))
 #else
 #define GDN_EXPORT
 #endif
+#endif
 
 // Turn argument to string constant:
 // https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing