From 48c7535d28b1f77700156af4a4138388d1720402 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Thu, 1 Oct 2020 23:00:41 +0900 Subject: [PATCH] Fix build on mingw64 gcc compiler --- build.rs | 4 ++++ native/libwinbridge/bridge.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/build.rs b/build.rs index ca8571f..433fb3e 100644 --- a/build.rs +++ b/build.rs @@ -28,6 +28,10 @@ fn get_config() -> PathBuf { fn print_config() { println!("cargo:rustc-link-lib=static=winbridge"); println!("cargo:rustc-link-lib=dylib=user32"); + #[cfg(target_env = "gnu")] + println!("cargo:rustc-link-lib=dylib=gdiplus"); + #[cfg(target_env = "gnu")] + println!("cargo:rustc-link-lib=dylib=stdc++"); } #[cfg(target_os = "linux")] diff --git a/native/libwinbridge/bridge.cpp b/native/libwinbridge/bridge.cpp index ede2528..91ff5a4 100644 --- a/native/libwinbridge/bridge.cpp +++ b/native/libwinbridge/bridge.cpp @@ -27,7 +27,15 @@ #define UNICODE +#ifdef __MINGW32__ +# ifndef WINVER +# define WINVER 0x0606 +# endif +# define STRSAFE_NO_DEPRECATE +#endif + #include +#include #include #include