From ccb3e11d9329d17583a3d30b1849b9675d11f995 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Fri, 21 May 2021 21:59:29 +0200 Subject: [PATCH] feat(clipboard): add feature to avoid double linking gdiplus --- espanso-clipboard/Cargo.toml | 4 ++++ espanso-clipboard/build.rs | 5 +++++ espanso-clipboard/src/win32/native.cpp | 1 - 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/espanso-clipboard/Cargo.toml b/espanso-clipboard/Cargo.toml index 507b1a0..b389613 100644 --- a/espanso-clipboard/Cargo.toml +++ b/espanso-clipboard/Cargo.toml @@ -10,6 +10,10 @@ build="build.rs" # and wayland support will be enabled wayland = ["wait-timeout"] +# If enabled, avoid linking with the gdiplus library on Windows, which +# might conflict with wxWidgets +avoid-gdi = [] + [dependencies] log = "0.4.14" lazycell = "1.3.0" diff --git a/espanso-clipboard/build.rs b/espanso-clipboard/build.rs index 6efb07a..90c0bfc 100644 --- a/espanso-clipboard/build.rs +++ b/espanso-clipboard/build.rs @@ -30,6 +30,11 @@ fn cc_config() { println!("cargo:rustc-link-lib=static=espansoclipboard"); println!("cargo:rustc-link-lib=dylib=user32"); println!("cargo:rustc-link-lib=dylib=gdi32"); + + if cfg!(not(feature = "avoid-gdi")) { + println!("cargo:rustc-link-lib=dylib=gdiplus"); + } + #[cfg(target_env = "gnu")] println!("cargo:rustc-link-lib=dylib=stdc++"); } diff --git a/espanso-clipboard/src/win32/native.cpp b/espanso-clipboard/src/win32/native.cpp index 1727eaf..af8d1d8 100644 --- a/espanso-clipboard/src/win32/native.cpp +++ b/espanso-clipboard/src/win32/native.cpp @@ -38,7 +38,6 @@ #include #include -#pragma comment(lib, "gdiplus.lib") #include #include