Relm4 / Relm4

Build truly native applications with ease!
https://relm4.org
Apache License 2.0
1.48k stars 70 forks source link

relm4 fails to compile on Windows because of Linux-only elements #8

Closed jmmk closed 3 years ago

jmmk commented 3 years ago

If you take a look at https://github.com/gtk-rs/gtk4-rs/blob/master/gtk4/Gir.toml, you will see some elements are generated with cfg_condition = "target_os = \"linux\""

Those elements are:

PageSetupUnixDialog
PrintJob
PrintUnixDialog
Printer

These widgets are exported in https://github.com/AaronErhardt/relm4/blob/main/src/util/default_widgets.rs, which causes relm4 compilation to fail on Windows (and likely other platforms, but I am running into this on Windows)

AaronErhardt commented 3 years ago

Thanks for pointing this out. I guess they should use feature flags for this because I wasn't aware of Linux specific features. Anyway, I hope this commit fixes the issue: https://github.com/AaronErhardt/relm4/commit/e568f312c9b0c9e8646a41a1e0b66ba6f67d3eba

I'll also release an updated version on crates.io soon.

jmmk commented 3 years ago

@AaronErhardt that seems to work.

Is there an advantage to creating the linux feature instead of using #[cfg(target_os = "linux")]?

AaronErhardt commented 3 years ago

@jmmk I think in this case, probably no. I will change that use #[cfg(target_os = "linux")] because gtk4-rs does it as well.

AaronErhardt commented 3 years ago

I've released a new version with the fix included