Skip to content

Commit

Permalink
Patch Wasm headers to fix MinGW build
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtonmeuser committed May 5, 2023
1 parent e503da6 commit a41d27d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,7 @@ def download_wasmer(env, force=False, version=VERSION_DEFAULT):
elif env["platform"] == "windows":
if env.get("use_mingw"):
download_tarfile(BASE_URL.format(version, "windows-gnu64"), "wasmer")
# Temporary workaround for https://github.com/ashtonmeuser/godot-wasm/issues/26
os.system("patch -p1 < wasm-mingw.patch")
else:
download_tarfile(BASE_URL.format(version, "windows-amd64"), "wasmer")
26 changes: 26 additions & 0 deletions wasm-mingw.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/wasmer/include/wasm.h b/wasmer/include/wasm.h
index 0873193..54cee8f 100644
--- a/wasmer/include/wasm.h
+++ b/wasmer/include/wasm.h
@@ -10,7 +10,7 @@
#include <assert.h>

#ifndef WASM_API_EXTERN
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW32__)
#define WASM_API_EXTERN __declspec(dllimport)
#else
#define WASM_API_EXTERN
diff --git a/wasmer/include/wasm.hh b/wasmer/include/wasm.hh
index f0b3ee2..a344e24 100644
--- a/wasmer/include/wasm.hh
+++ b/wasmer/include/wasm.hh
@@ -12,7 +12,7 @@
#include <string>

#ifndef WASM_API_EXTERN
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW32__)
#define WASM_API_EXTERN __declspec(dllimport)
#else
#define WASM_API_EXTERN

0 comments on commit a41d27d

Please sign in to comment.