Open brendan-simon-indt opened 1 year ago
Please help !! I'm keen to get this going and move on to supporting rust generated code from wxGlade :)
Hello, Brendan,
I'm sorry for too late reply. As I recently dedicated whole my spare time to another project these days.
I have not been tried wxRust2 with MSYS2 environment generally. So my answer is not (yet) tested.
At first, non-vendored, non-MSVC build of wxwidgets is not supported yet.
I get errors about setting the
wxwin
environment variable.
The wxwin
environment variable used here for MSVC build. This function should support another configurations, but not supported yet. So, just setting wxwin
to any value should not work.
Surely the
wx-config --cflags
andwx-conig --libs
is all that is needed for thewxRust2
build system to find the headers and libraries. Yes/No?
Theoretically, YES.
It is rather compilcated as we have wxrust-config subcrate to integrate vendored binary.
Does
wx-core/build.rs
need to be modified to support native MSYS2 installations ofwxwidgets
?
May or may not. If you want simplify things to investigate in your source tree, change like this locally
wx-base/build.rs
// COMMENT OUT
// use wxrust_config::wx_config;
fn main() {
let mut cc_build = cc::Build::new();
// from `wx-config --cflags`
// CHANGE BELOW LINE
//let cflags = wx_config(&["--cflags"]);
let cflags = vec![
"PLACE YOUR".to_string(),
"wx-config --cflags".to_string(),
"OUTPUT, HERE.".to_string(),
];
for arg in cflags.iter() {
cc_build.flag(arg);
}
cc_build
.cpp(true)
.file("src/manual.cpp")
.file("src/generated/events.cpp")
.file("src/generated.cpp")
.include("include")
.flag_if_supported("-std=c++14")
// ignore too many warnings with wx3.0
.flag_if_supported("-Wno-deprecated-copy")
.flag_if_supported("-Wno-ignored-qualifiers")
.flag_if_supported("-Wno-unused-parameter")
.compile("wx");
// from `wx-config --libs`
// CHANGE BELOW LINE TOO
//let libs = wx_config(&["--libs"]);
let libs = vec![
"PLACE YOUR".to_string(),
"wx-config --libs".to_string(),
"OUTPUT, HERE.".to_string(),
];
println!("cargo:rustc-flags={}", libs.join(" "));
}
Change wx-core/build.rs too.
Additionally, rust projects (your application) which uses wxRust2 may need to specify RUSTFLAGS to -C link-arg=-lstdc++
or so. This is integrated our CI environment like this:
For more context, see https://github.com/kenz-gelsoft/wxRust2/pull/91.
If you successfully build with some modification on your environment, I'll try integrate your modifications.
Of course, a PR is welcome as a starting point.
Thanks for the info. I will take a closer look when I get a chance.
BTW, the install on Mac with brew worked easily and I was able to test the examples. Seems very promising - all the widgets seem to work and render ok. Seems like writing useful applications should be possible 😃
I'm new to rust and have installed rust and wxwidgets 3.2 using MSYS2 (for ucrt64, clang64, and mingw64 environments)
I get errors about setting the
wxwin
environment variable.I've tried setting them to many things in the MSYS2 environments, and even tried downloading the binary and development files from wxWidgets and pointing to them, but no luck.
Surely the
wx-config --cflags
andwx-conig --libs
is all that is needed for thewxRust2
build system to find the headers and libraries. Yes/No?Does
wx-core/build.rs
need to be modified to support native MSYS2 installations ofwxwidgets
?What should I set
wxwin
to - if anything at all?NOTE: I have
wxRust2
running ok on macOS with brew installations of rust and wxwidgets. i.e. I can build and run the samples. I want to be able to do the same thing on Windows using MSYS2 installations of rust and wxwidgets.--
Here is the output with
wxwin
undefined.Thanks :)