diff --git a/espanso-ui/Cargo.toml b/espanso-ui/Cargo.toml index 3f99bfe..ff27dd4 100644 --- a/espanso-ui/Cargo.toml +++ b/espanso-ui/Cargo.toml @@ -5,6 +5,11 @@ authors = ["Federico Terzi "] edition = "2018" build="build.rs" +[features] +# If enabled, avoid linking with the gdiplus library on Windows, which +# might conflict with wxWidgets +avoid-gdi = [] + [dependencies] log = "0.4.14" serde_json = "1.0.61" diff --git a/espanso-ui/build.rs b/espanso-ui/build.rs index 1b36617..30870f1 100644 --- a/espanso-ui/build.rs +++ b/espanso-ui/build.rs @@ -34,8 +34,10 @@ fn cc_config() { println!("cargo:rustc-link-lib=dylib=user32"); #[cfg(target_env = "gnu")] println!("cargo:rustc-link-lib=dylib=stdc++"); - #[cfg(target_env = "gnu")] - println!("cargo:rustc-link-lib=dylib=gdiplus"); + + if cfg!(not(feature = "avoid-gdi")) { + println!("cargo:rustc-link-lib=dylib=gdiplus"); + } } #[cfg(target_os = "linux")] diff --git a/espanso-ui/src/win32/native.cpp b/espanso-ui/src/win32/native.cpp index 9d6ea4f..6610087 100644 --- a/espanso-ui/src/win32/native.cpp +++ b/espanso-ui/src/win32/native.cpp @@ -41,7 +41,6 @@ #pragma comment(lib, "Shell32.lib") #include -#pragma comment(lib, "Gdi32.lib") #include #include "WinToast/wintoastlib.h"