Merge branch 'feature/afw-os-bundle' into release-next-stage
verify / verify (pull_request) Skipped
source / check (pull_request) Failing after 20s
verify / verify (pull_request) Skipped
source / check (pull_request) Failing after 20s
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
Subject: [PATCH 0011] Build on wxWidgets 3.2: version-guard the 3.3 appearance API and link GTK libs
|
||||
|
||||
diff -ruN a/build.rs b/build.rs
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -309,6 +309,25 @@
|
||||
for f in gtk_cflags.split_whitespace() {
|
||||
build.flag(f);
|
||||
}
|
||||
+ // ...and GTK's own shared libraries at link time. `wx-config --libs`
|
||||
+ // lists only the wx libraries, not the GTK libraries the widget bridge
|
||||
+ // calls directly (gtk_*, g_*), so without this the final link fails with
|
||||
+ // undefined GTK symbols. Best-effort: empty if pkg-config/gtk3-dev is
|
||||
+ // missing, in which case the GTK-only bridge code was also compiled out.
|
||||
+ let gtk_libs = Command::new("pkg-config")
|
||||
+ .args(["--libs", "gtk+-3.0"])
|
||||
+ .output()
|
||||
+ .ok()
|
||||
+ .filter(|o| o.status.success())
|
||||
+ .and_then(|o| String::from_utf8(o.stdout).ok())
|
||||
+ .unwrap_or_default();
|
||||
+ for f in gtk_libs.split_whitespace() {
|
||||
+ if let Some(lib) = f.strip_prefix("-l") {
|
||||
+ println!("cargo:rustc-link-lib={}", lib);
|
||||
+ } else if let Some(path) = f.strip_prefix("-L") {
|
||||
+ println!("cargo:rustc-link-search=native={}", path);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
if is_windows() {
|
||||
// Ship one self-contained .exe: link the C++ runtime statically rather
|
||||
diff -ruN a/cpp_src/wxbridge.cpp b/cpp_src/wxbridge.cpp
|
||||
--- a/cpp_src/wxbridge.cpp
|
||||
+++ b/cpp_src/wxbridge.cpp
|
||||
@@ -375,6 +375,10 @@
|
||||
// then returns CannotChange). System follows the desktop: the GTK theme's
|
||||
// colour scheme, or the Windows 10/11 "app mode" setting, which wxMSW
|
||||
// otherwise ignores and stays light. ALKANE_APPEARANCE=light|dark forces one.
|
||||
+ // The explicit appearance API (wxApp::Appearance / SetAppearance /
|
||||
+ // MSWEnableDarkMode) only exists in wxWidgets >= 3.3. On 3.2.x the GTK/Win
|
||||
+ // system theme is still followed; we just cannot force it via ALKANE_APPEARANCE.
|
||||
+#if wxCHECK_VERSION(3, 3, 0)
|
||||
{
|
||||
wxString pref;
|
||||
wxGetEnv("ALKANE_APPEARANCE", &pref);
|
||||
@@ -394,6 +398,7 @@
|
||||
wxTheApp->SetAppearance(appearance);
|
||||
#endif
|
||||
}
|
||||
+#endif
|
||||
wxTheApp->OnInit();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
+19
@@ -309,6 +309,25 @@ fn build_with_wx_config() -> Result<(), Box<dyn Error>> {
|
||||
for f in gtk_cflags.split_whitespace() {
|
||||
build.flag(f);
|
||||
}
|
||||
// ...and GTK's own shared libraries at link time. `wx-config --libs`
|
||||
// lists only the wx libraries, not the GTK libraries the widget bridge
|
||||
// calls directly (gtk_*, g_*), so without this the final link fails with
|
||||
// undefined GTK symbols. Best-effort: empty if pkg-config/gtk3-dev is
|
||||
// missing, in which case the GTK-only bridge code was also compiled out.
|
||||
let gtk_libs = Command::new("pkg-config")
|
||||
.args(["--libs", "gtk+-3.0"])
|
||||
.output()
|
||||
.ok()
|
||||
.filter(|o| o.status.success())
|
||||
.and_then(|o| String::from_utf8(o.stdout).ok())
|
||||
.unwrap_or_default();
|
||||
for f in gtk_libs.split_whitespace() {
|
||||
if let Some(lib) = f.strip_prefix("-l") {
|
||||
println!("cargo:rustc-link-lib={}", lib);
|
||||
} else if let Some(path) = f.strip_prefix("-L") {
|
||||
println!("cargo:rustc-link-search=native={}", path);
|
||||
}
|
||||
}
|
||||
}
|
||||
if is_windows() {
|
||||
// Ship one self-contained .exe: link the C++ runtime statically rather
|
||||
|
||||
@@ -375,6 +375,10 @@ extern "C" {
|
||||
// then returns CannotChange). System follows the desktop: the GTK theme's
|
||||
// colour scheme, or the Windows 10/11 "app mode" setting, which wxMSW
|
||||
// otherwise ignores and stays light. ALKANE_APPEARANCE=light|dark forces one.
|
||||
// The explicit appearance API (wxApp::Appearance / SetAppearance /
|
||||
// MSWEnableDarkMode) only exists in wxWidgets >= 3.3. On 3.2.x the GTK/Win
|
||||
// system theme is still followed; we just cannot force it via ALKANE_APPEARANCE.
|
||||
#if wxCHECK_VERSION(3, 3, 0)
|
||||
{
|
||||
wxString pref;
|
||||
wxGetEnv("ALKANE_APPEARANCE", &pref);
|
||||
@@ -394,6 +398,7 @@ extern "C" {
|
||||
wxTheApp->SetAppearance(appearance);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
wxTheApp->OnInit();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
Reference in New Issue
Block a user