fix(modulo): check for 'wx-config-gtk3' command as well on Linux. Fix #840

This commit is contained in:
Federico Terzi 2021-11-06 10:02:47 +01:00
parent 80ed98c506
commit ac208ecf02

View File

@ -420,15 +420,26 @@ fn macos_link_search_path() -> Option<String> {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
fn build_native() { fn build_native() {
// Make sure wxWidgets is installed // Make sure wxWidgets is installed
if std::process::Command::new("wx-config") // Depending on the installation package, the 'wx-config' command might also be available as 'wx-config-gtk3',
// so we need to check for both.
// See also: https://github.com/federico-terzi/espanso/issues/840
let wx_config_command = if std::process::Command::new("wx-config")
.arg("--version") .arg("--version")
.output() .output()
.is_err() .is_ok()
{ {
panic!("wxWidgets is not installed, as `wx-config` cannot be exectued") "wx-config"
} } else if std::process::Command::new("wx-config-gtk3")
.arg("--version")
.output()
.is_ok()
{
"wx-config-gtk3"
} else {
panic!("wxWidgets is not installed, as `wx-config` cannot be executed")
};
let config_path = PathBuf::from("wx-config"); let config_path = PathBuf::from(wx_config_command);
let cpp_flags = get_cpp_flags(&config_path); let cpp_flags = get_cpp_flags(&config_path);
let mut build = cc::Build::new(); let mut build = cc::Build::new();