Skip to content

Commit f315912

Browse files
committed
[Windows] Fix windows build with mingw.
Forces ".dll" extension for library when building with mingw. Override GDN_EXPORT which is incorrectly defined in the upstream gdnative headers (3.x) and godot-cpp include (4.0) when building for windows with mingw.
1 parent 62ab2e5 commit f315912

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

SConstruct

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ else:
6767
})
6868
env = env.Clone()
6969

70+
# Patch mingw SHLIBSUFFIX.
71+
if env["platform"] == "windows" and env["use_mingw"]:
72+
env["SHLIBSUFFIX"] = ".dll"
73+
7074
opts.Update(env)
7175

7276
target = env["target"]

src/init_gdextension.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
#include "WebRTCLibDataChannel.hpp"
3838
#include "WebRTCLibPeerConnection.hpp"
3939

40+
#ifdef _WIN32
41+
// See upstream godot-cpp GH-771.
42+
#undef GDN_EXPORT
43+
#define GDN_EXPORT __declspec(dllexport)
44+
#endif
45+
4046
using namespace godot;
4147
using namespace godot_webrtc;
4248

src/init_gdnative.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
#include <gdnative_api_struct.gen.h>
3535
#include <net/godot_net.h>
3636

37+
#ifdef _WIN32
38+
// See upstream godot GH-62173.
39+
#undef GDN_EXPORT
40+
#define GDN_EXPORT __declspec(dllexport)
41+
#endif
42+
3743
/* Singleton */
3844
static bool _singleton = false;
3945
static const godot_object *_singleton_lib = NULL;

0 commit comments

Comments
 (0)