From 88a8211310174c0bc68cb9a2e61736e62b698e06 Mon Sep 17 00:00:00 2001 From: KENZ Date: Tue, 21 Jun 2022 10:21:47 +0900 Subject: [PATCH 01/21] WIP: doesn't link --- Cargo.lock | 11 +++ doxybindgen.toml | 17 ++++ samples/hello/Cargo.toml | 1 + samples/minimal/Cargo.toml | 2 +- samples/widgets/Cargo.toml | 2 +- samples/wrapsizer/Cargo.toml | 1 + wx-base/Cargo.toml | 3 + wx-core/Cargo.toml | 1 + wx-core/include/generated.h | 9 -- wx-core/src/generated.cpp | 27 ------ wx-core/src/generated/ffi.rs | 18 ++-- wx-core/src/generated/methods.rs | 40 ++------ wxrust-config/src/lib.rs | 159 +++++++++++++++++-------------- 13 files changed, 143 insertions(+), 148 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4073fff8..79b5026c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,6 +14,7 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", + "wx-universal-apple-darwin", ] [[package]] @@ -22,6 +23,7 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", + "wx-universal-apple-darwin", ] [[package]] @@ -30,6 +32,7 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", + "wx-universal-apple-darwin", ] [[package]] @@ -38,6 +41,7 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", + "wx-universal-apple-darwin", ] [[package]] @@ -46,6 +50,7 @@ version = "0.1.0" dependencies = [ "cc", "wx-base", + "wx-universal-apple-darwin", "wxrust-config", ] @@ -54,9 +59,15 @@ name = "wx-base" version = "0.1.0" dependencies = [ "cc", + "wx-universal-apple-darwin", "wxrust-config", ] +[[package]] +name = "wx-universal-apple-darwin" +version = "3.1.6" +source = "git+https://github.com/ancwrd1/wx-universal-apple-darwin#4e512d2c125436007a7ee1331a48d8b5de430fb4" + [[package]] name = "wxrust-config" version = "0.1.0" diff --git a/doxybindgen.toml b/doxybindgen.toml index 482d0a2d..5d3dc6f0 100644 --- a/doxybindgen.toml +++ b/doxybindgen.toml @@ -77,6 +77,8 @@ library = 'core' [types.wxArtProvider] blocklist = [ 'Insert', + # Doc isn't up-to-date in wx3.1.6 + 'GetSizeHint', ] [types.wxBitmapButton] wx31 = [ @@ -88,6 +90,10 @@ wx31 = [ blocklist = [ # doesn't support returning wxList 'GetHandlers', + # Doc isn't up-to-date in wx3.1.6 + 'SetDepth', + 'SetHeight', + 'SetWidth', ] wx31 = [ 'wxBitmap8', @@ -187,6 +193,10 @@ blocklist = [ [types.wxIcon] blocklist = [ 'operator=', + # Doc isn't up-to-date in wx3.1.6 + 'SetDepth', + 'SetHeight', + 'SetWidth', ] [types.wxItemContainer] blocklist = [ @@ -293,6 +303,11 @@ blocklist = [ 'operator/=', 'operator*=', ] +[types.wxRadioBox] +blocklist = [ + # Doc isn't up-to-date in wx3.1.6 + 'GetItemHelpText', +] [types.wxRect] blocklist = [ 'operator==', @@ -410,6 +425,8 @@ blocklist = [ 'GetChildren', 'GetCursor', 'GetUpdateRegion', + # Doc isn't up-to-date in wx3.1.6 + 'GetHelpText', ] not_gtk = [ 'RegisterHotKey', diff --git a/samples/hello/Cargo.toml b/samples/hello/Cargo.toml index feafaaf3..33c92f99 100644 --- a/samples/hello/Cargo.toml +++ b/samples/hello/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } diff --git a/samples/minimal/Cargo.toml b/samples/minimal/Cargo.toml index 1279a053..5d1fa707 100644 --- a/samples/minimal/Cargo.toml +++ b/samples/minimal/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } - diff --git a/samples/widgets/Cargo.toml b/samples/widgets/Cargo.toml index 7985d845..0dba2390 100644 --- a/samples/widgets/Cargo.toml +++ b/samples/widgets/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } - diff --git a/samples/wrapsizer/Cargo.toml b/samples/wrapsizer/Cargo.toml index b3fbd503..01360458 100644 --- a/samples/wrapsizer/Cargo.toml +++ b/samples/wrapsizer/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index 7d6143b2..1cd28170 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[dependencies] +wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } + [build-dependencies] cc = "1.0.72" wxrust-config = { path = "../wxrust-config" } diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 5c300b7d..17174538 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../wx-base" } [build-dependencies] diff --git a/wx-core/include/generated.h b/wx-core/include/generated.h index 0047aa44..eb3d73ef 100644 --- a/wx-core/include/generated.h +++ b/wx-core/include/generated.h @@ -33,7 +33,6 @@ bool wxArtProvider_Delete(wxArtProvider * provider); wxBitmap *wxArtProvider_GetBitmap(const wxArtID * id, const wxArtClient * client, const wxSize * size); wxIcon *wxArtProvider_GetIcon(const wxArtID * id, const wxArtClient * client, const wxSize * size); wxSize *wxArtProvider_GetNativeSizeHint(const wxArtClient * client); -wxSize *wxArtProvider_GetSizeHint(const wxArtClient * client, bool platform_default); bool wxArtProvider_HasNativeProvider(); bool wxArtProvider_Pop(); void wxArtProvider_Push(wxArtProvider * provider); @@ -65,11 +64,8 @@ wxBitmap *wxBitmap_GetSubBitmap(const wxBitmap * self, const wxRect * rect); wxSize *wxBitmap_GetSize(const wxBitmap * self); int wxBitmap_GetWidth(const wxBitmap * self); bool wxBitmap_IsOk(const wxBitmap * self); -void wxBitmap_SetDepth(wxBitmap * self, int depth); -void wxBitmap_SetHeight(wxBitmap * self, int height); void wxBitmap_SetMask(wxBitmap * self, wxMask * mask); void wxBitmap_SetPalette(wxBitmap * self, const wxPalette * palette); -void wxBitmap_SetWidth(wxBitmap * self, int width); void wxBitmap_AddHandler(wxBitmapHandler * handler); void wxBitmap_CleanUpHandlers(); #ifndef __WXMSW__ @@ -278,9 +274,6 @@ int wxIcon_GetDepth(const wxIcon * self); int wxIcon_GetHeight(const wxIcon * self); int wxIcon_GetWidth(const wxIcon * self); bool wxIcon_IsOk(const wxIcon * self); -void wxIcon_SetDepth(wxIcon * self, int depth); -void wxIcon_SetHeight(wxIcon * self, int height); -void wxIcon_SetWidth(wxIcon * self, int width); // CLASS: wxItemContainer void wxItemContainer_delete(wxItemContainer *self); @@ -550,7 +543,6 @@ bool wxRadioBox_Create1(wxRadioBox * self, wxWindow * parent, wxWindowID id, con bool wxRadioBox_Enable(wxRadioBox * self, unsigned int n, bool enable); unsigned int wxRadioBox_GetColumnCount(const wxRadioBox * self); int wxRadioBox_GetItemFromPoint(const wxRadioBox * self, const wxPoint * pt); -wxString *wxRadioBox_GetItemHelpText(const wxRadioBox * self, unsigned int item); wxToolTip * wxRadioBox_GetItemToolTip(const wxRadioBox * self, unsigned int item); unsigned int wxRadioBox_GetRowCount(const wxRadioBox * self); bool wxRadioBox_IsItemEnabled(const wxRadioBox * self, unsigned int n); @@ -1264,7 +1256,6 @@ bool wxWindow_IsShownOnScreen(const wxWindow * self); bool wxWindow_Disable(wxWindow * self); bool wxWindow_Enable(wxWindow * self, bool enable); bool wxWindow_Show(wxWindow * self, bool show); -wxString *wxWindow_GetHelpText(const wxWindow * self); void wxWindow_SetHelpText(wxWindow * self, const wxString * help_text); wxToolTip * wxWindow_GetToolTip(const wxWindow * self); wxString *wxWindow_GetToolTipText(const wxWindow * self); diff --git a/wx-core/src/generated.cpp b/wx-core/src/generated.cpp index a2e60dd2..e5376b13 100644 --- a/wx-core/src/generated.cpp +++ b/wx-core/src/generated.cpp @@ -68,9 +68,6 @@ wxIcon *wxArtProvider_GetIcon(const wxArtID * id, const wxArtClient * client, co wxSize *wxArtProvider_GetNativeSizeHint(const wxArtClient * client) { return new wxSize(wxArtProvider::GetNativeSizeHint(*client)); } -wxSize *wxArtProvider_GetSizeHint(const wxArtClient * client, bool platform_default) { - return new wxSize(wxArtProvider::GetSizeHint(*client, platform_default)); -} bool wxArtProvider_HasNativeProvider() { return wxArtProvider::HasNativeProvider(); } @@ -156,21 +153,12 @@ int wxBitmap_GetWidth(const wxBitmap * self) { bool wxBitmap_IsOk(const wxBitmap * self) { return self->IsOk(); } -void wxBitmap_SetDepth(wxBitmap * self, int depth) { - return self->SetDepth(depth); -} -void wxBitmap_SetHeight(wxBitmap * self, int height) { - return self->SetHeight(height); -} void wxBitmap_SetMask(wxBitmap * self, wxMask * mask) { return self->SetMask(mask); } void wxBitmap_SetPalette(wxBitmap * self, const wxPalette * palette) { return self->SetPalette(*palette); } -void wxBitmap_SetWidth(wxBitmap * self, int width) { - return self->SetWidth(width); -} void wxBitmap_AddHandler(wxBitmapHandler * handler) { return wxBitmap::AddHandler(handler); } @@ -695,15 +683,6 @@ int wxIcon_GetWidth(const wxIcon * self) { bool wxIcon_IsOk(const wxIcon * self) { return self->IsOk(); } -void wxIcon_SetDepth(wxIcon * self, int depth) { - return self->SetDepth(depth); -} -void wxIcon_SetHeight(wxIcon * self, int height) { - return self->SetHeight(height); -} -void wxIcon_SetWidth(wxIcon * self, int width) { - return self->SetWidth(width); -} // CLASS: wxItemContainer void wxItemContainer_delete(wxItemContainer *self) { @@ -1425,9 +1404,6 @@ unsigned int wxRadioBox_GetColumnCount(const wxRadioBox * self) { int wxRadioBox_GetItemFromPoint(const wxRadioBox * self, const wxPoint * pt) { return self->GetItemFromPoint(*pt); } -wxString *wxRadioBox_GetItemHelpText(const wxRadioBox * self, unsigned int item) { - return new wxString(self->GetItemHelpText(item)); -} wxToolTip * wxRadioBox_GetItemToolTip(const wxRadioBox * self, unsigned int item) { return self->GetItemToolTip(item); } @@ -3443,9 +3419,6 @@ bool wxWindow_Enable(wxWindow * self, bool enable) { bool wxWindow_Show(wxWindow * self, bool show) { return self->Show(show); } -wxString *wxWindow_GetHelpText(const wxWindow * self) { - return new wxString(self->GetHelpText()); -} void wxWindow_SetHelpText(wxWindow * self, const wxString * help_text) { return self->SetHelpText(*help_text); } diff --git a/wx-core/src/generated/ffi.rs b/wx-core/src/generated/ffi.rs index 29c9d38e..caeb9e12 100644 --- a/wx-core/src/generated/ffi.rs +++ b/wx-core/src/generated/ffi.rs @@ -38,7 +38,7 @@ extern "C" { size: *const c_void, ) -> *mut c_void; pub fn wxArtProvider_GetNativeSizeHint(client: *const c_void) -> *mut c_void; - pub fn wxArtProvider_GetSizeHint(client: *const c_void, platform_default: bool) -> *mut c_void; + // BLOCKED: pub fn wxArtProvider_GetSizeHint(client: *const c_void, platform_default: bool) -> wxSize; // NOT_SUPPORTED: pub fn wxArtProvider_GetIconBundle(id: *const c_void, client: *const c_void) -> wxIconBundle; pub fn wxArtProvider_HasNativeProvider() -> bool; // BLOCKED: pub fn wxArtProvider_Insert(provider: *mut c_void); @@ -88,11 +88,11 @@ extern "C" { pub fn wxBitmap_IsOk(self_: *const c_void) -> bool; // NOT_SUPPORTED: pub fn wxBitmap_LoadFile(self_: *mut c_void, name: *const c_void, type_: wxBitmapType) -> bool; // NOT_SUPPORTED: pub fn wxBitmap_SaveFile(self_: *const c_void, name: *const c_void, type_: wxBitmapType, palette: *const c_void) -> bool; - pub fn wxBitmap_SetDepth(self_: *mut c_void, depth: c_int); - pub fn wxBitmap_SetHeight(self_: *mut c_void, height: c_int); + // BLOCKED: pub fn wxBitmap_SetDepth(self_: *mut c_void, depth: c_int); + // BLOCKED: pub fn wxBitmap_SetHeight(self_: *mut c_void, height: c_int); pub fn wxBitmap_SetMask(self_: *mut c_void, mask: *mut c_void); pub fn wxBitmap_SetPalette(self_: *mut c_void, palette: *const c_void); - pub fn wxBitmap_SetWidth(self_: *mut c_void, width: c_int); + // BLOCKED: pub fn wxBitmap_SetWidth(self_: *mut c_void, width: c_int); pub fn wxBitmap_AddHandler(handler: *mut c_void); pub fn wxBitmap_CleanUpHandlers(); pub fn wxBitmap_FindHandler(name: *const c_void) -> *mut c_void; @@ -578,9 +578,9 @@ extern "C" { pub fn wxIcon_GetWidth(self_: *const c_void) -> c_int; pub fn wxIcon_IsOk(self_: *const c_void) -> bool; // NOT_SUPPORTED: pub fn wxIcon_LoadFile(self_: *mut c_void, name: *const c_void, type_: wxBitmapType, desired_width: c_int, desired_height: c_int) -> bool; - pub fn wxIcon_SetDepth(self_: *mut c_void, depth: c_int); - pub fn wxIcon_SetHeight(self_: *mut c_void, height: c_int); - pub fn wxIcon_SetWidth(self_: *mut c_void, width: c_int); + // BLOCKED: pub fn wxIcon_SetDepth(self_: *mut c_void, depth: c_int); + // BLOCKED: pub fn wxIcon_SetHeight(self_: *mut c_void, height: c_int); + // BLOCKED: pub fn wxIcon_SetWidth(self_: *mut c_void, width: c_int); // BLOCKED: pub fn wxIcon_operator=(self_: *mut c_void, icon: *const c_void) -> *mut c_void; // wxItemContainer @@ -1148,7 +1148,7 @@ extern "C" { pub fn wxRadioBox_Enable(self_: *mut c_void, n: c_uint, enable: bool) -> bool; pub fn wxRadioBox_GetColumnCount(self_: *const c_void) -> c_uint; pub fn wxRadioBox_GetItemFromPoint(self_: *const c_void, pt: *const c_void) -> c_int; - pub fn wxRadioBox_GetItemHelpText(self_: *const c_void, item: c_uint) -> *mut c_void; + // BLOCKED: pub fn wxRadioBox_GetItemHelpText(self_: *const c_void, item: c_uint) -> wxString; pub fn wxRadioBox_GetItemToolTip(self_: *const c_void, item: c_uint) -> *mut c_void; pub fn wxRadioBox_GetRowCount(self_: *const c_void) -> c_uint; pub fn wxRadioBox_IsItemEnabled(self_: *const c_void, n: c_uint) -> bool; @@ -2345,7 +2345,7 @@ extern "C" { pub fn wxWindow_Enable(self_: *mut c_void, enable: bool) -> bool; pub fn wxWindow_Show(self_: *mut c_void, show: bool) -> bool; // NOT_SUPPORTED: pub fn wxWindow_ShowWithEffect(self_: *mut c_void, effect: wxShowEffect, timeout: c_uint) -> bool; - pub fn wxWindow_GetHelpText(self_: *const c_void) -> *mut c_void; + // BLOCKED: pub fn wxWindow_GetHelpText(self_: *const c_void) -> wxString; pub fn wxWindow_SetHelpText(self_: *mut c_void, help_text: *const c_void); // NOT_SUPPORTED: pub fn wxWindow_GetHelpTextAtPoint(self_: *const c_void, point: *const c_void, origin: wxHelpEvent::Origin) -> *mut c_void; pub fn wxWindow_GetToolTip(self_: *const c_void) -> *mut c_void; diff --git a/wx-core/src/generated/methods.rs b/wx-core/src/generated/methods.rs index 6cdf5a63..17e77de4 100644 --- a/wx-core/src/generated/methods.rs +++ b/wx-core/src/generated/methods.rs @@ -118,13 +118,7 @@ pub trait ArtProviderMethods: ObjectMethods { Size::from_ptr(ffi::wxArtProvider_GetNativeSizeHint(client)) } } - fn get_size_hint(client: &str, platform_default: bool) -> Size { - unsafe { - let client = WxString::from(client); - let client = client.as_ptr(); - Size::from_ptr(ffi::wxArtProvider_GetSizeHint(client, platform_default)) - } - } + // BLOCKED: fn GetSizeHint() // NOT_SUPPORTED: fn GetIconBundle() fn has_native_provider() -> bool { unsafe { ffi::wxArtProvider_HasNativeProvider() } @@ -229,21 +223,15 @@ pub trait BitmapMethods: GDIObjectMethods { } // NOT_SUPPORTED: fn LoadFile() // NOT_SUPPORTED: fn SaveFile() - fn set_depth(&self, depth: c_int) { - unsafe { ffi::wxBitmap_SetDepth(self.as_ptr(), depth) } - } - fn set_height(&self, height: c_int) { - unsafe { ffi::wxBitmap_SetHeight(self.as_ptr(), height) } - } + // BLOCKED: fn SetDepth() + // BLOCKED: fn SetHeight() fn set_mask(&self, mask: *mut c_void) { unsafe { ffi::wxBitmap_SetMask(self.as_ptr(), mask) } } fn set_palette(&self, palette: *const c_void) { unsafe { ffi::wxBitmap_SetPalette(self.as_ptr(), palette) } } - fn set_width(&self, width: c_int) { - unsafe { ffi::wxBitmap_SetWidth(self.as_ptr(), width) } - } + // BLOCKED: fn SetWidth() fn add_handler(handler: *mut c_void) { unsafe { ffi::wxBitmap_AddHandler(handler) } } @@ -1219,15 +1207,9 @@ pub trait IconMethods: GDIObjectMethods { unsafe { ffi::wxIcon_IsOk(self.as_ptr()) } } // NOT_SUPPORTED: fn LoadFile() - fn set_depth(&self, depth: c_int) { - unsafe { ffi::wxIcon_SetDepth(self.as_ptr(), depth) } - } - fn set_height(&self, height: c_int) { - unsafe { ffi::wxIcon_SetHeight(self.as_ptr(), height) } - } - fn set_width(&self, width: c_int) { - unsafe { ffi::wxIcon_SetWidth(self.as_ptr(), width) } - } + // BLOCKED: fn SetDepth() + // BLOCKED: fn SetHeight() + // BLOCKED: fn SetWidth() // BLOCKED: fn operator=() } @@ -2659,9 +2641,7 @@ pub trait RadioBoxMethods: ControlMethods { ffi::wxRadioBox_GetItemFromPoint(self.as_ptr(), pt) } } - fn get_item_help_text(&self, item: c_uint) -> String { - unsafe { WxString::from_ptr(ffi::wxRadioBox_GetItemHelpText(self.as_ptr(), item)).into() } - } + // BLOCKED: fn GetItemHelpText() fn get_item_tool_tip(&self, item: c_uint) -> *mut c_void { unsafe { ffi::wxRadioBox_GetItemToolTip(self.as_ptr(), item) } } @@ -6076,9 +6056,7 @@ pub trait WindowMethods: EvtHandlerMethods { unsafe { ffi::wxWindow_Show(self.as_ptr(), show) } } // NOT_SUPPORTED: fn ShowWithEffect() - fn get_help_text(&self) -> String { - unsafe { WxString::from_ptr(ffi::wxWindow_GetHelpText(self.as_ptr())).into() } - } + // BLOCKED: fn GetHelpText() fn set_help_text(&self, help_text: &str) { unsafe { let help_text = WxString::from(help_text); diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index 0a82008e..7858aa79 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -6,87 +6,106 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { let cflags = wx_config(&["--cflags"]); // ignore too many warnings with wx3.0 cc_build - .flag_if_supported("-Wno-deprecated-copy") - .flag_if_supported("-Wno-ignored-qualifiers") - .flag_if_supported("-Wno-unused-parameter"); + .flag("-DNDEBUG") + .flag("-std=c++14") + .cpp(true); + // .flag_if_supported("-Wno-deprecated-copy") + // .flag_if_supported("-Wno-ignored-qualifiers") + // .flag_if_supported("-Wno-unused-parameter"); for arg in cflags.split_whitespace() { - if arg.starts_with("-I") { - cc_build.include(&arg[2..]); - } else if arg.starts_with("-D") { - let split = &mut arg[2..].split('='); - cc_build.define(split.next().unwrap(), split.next().unwrap_or("")); - } else if arg.starts_with("-pthread") { - cc_build.flag(arg); - } else { - panic!("unsupported argument '{}'. please file a bug.", arg) - } - } - if cfg!(windows) { - cc_build.flag("/EHsc"); + cc_build.flag(arg); + // if arg.starts_with("-I") { + // cc_build.include(&arg[2..]); + // } else if arg.starts_with("-D") { + // let split = &mut arg[2..].split('='); + // cc_build.define(split.next().unwrap(), split.next().unwrap_or("")); + // } else if arg.starts_with("-pthread") { + // cc_build.flag(arg); + // } else { + // panic!("unsupported argument '{}'. please file a bug.", arg) + // } } + // if cfg!(windows) { + // cc_build.flag("/EHsc"); + // } cc_build } pub fn print_wx_config_libs_for_cargo() { // from `wx-config --libs` let libs = wx_config(&["--libs"]); - let mut next_is_framework_name = false; - for arg in libs.split_whitespace() { - if next_is_framework_name { - println!("cargo:rustc-link-lib=framework={}", arg); - next_is_framework_name = false; - } else if arg == "-framework" { - next_is_framework_name = true; - } else if arg.starts_with("-L") { - println!("cargo:rustc-link-search=native={}", &arg[2..]); - } else if arg.starts_with("-l") { - println!("cargo:rustc-link-lib={}", &arg[2..]); - } else if arg.starts_with("-pthread") { - // ignore - } else { - panic!("unsupported argument '{}'. please file a bug.", arg) - } - } + for f in libs.split_whitespace() { + println!("cargo:rustc-flags={}", f); + } // let mut next_is_framework_name = false; + // for arg in libs.split_whitespace() { + // if next_is_framework_name { + // println!("cargo:rustc-link-lib=framework={}", arg); + // next_is_framework_name = false; + // } else if arg == "-framework" { + // next_is_framework_name = true; + // } else if arg.starts_with("-L") { + // println!("cargo:rustc-link-search=native={}", &arg[2..]); + // } else if arg.starts_with("-l") { + // println!("cargo:rustc-link-lib={}", &arg[2..]); + // } else if arg.starts_with("-pthread") { + // // ignore + // } else { + // panic!("unsupported argument '{}'. please file a bug.", arg) + // } + // } } fn wx_config(args: &[&str]) -> String { - if cfg!(windows) { - wx_config_win(args) - } else { - let output = Command::new("wx-config") - .args(args) - .output() - .expect("failed execute wx-config command."); - String::from_utf8_lossy(&output.stdout).to_string() - } -} - -fn wx_config_win(args: &[&str]) -> String { - let wxwin = env::var("wxwin") - .expect("Set 'wxwin' environment variable to point the wxMSW binaries dir."); - // TODO: support linking with the wx debug DLL - let is_debug = false; //env::var("PROFILE").unwrap() == "debug"; - let d_or_not = if is_debug { "d" } else { "" }; - if args.contains(&"--cflags") { - let mut cflags = vec![ - format!("-I{}\\include", wxwin), - format!("-I{}\\lib\\vc14x_x64_dll\\mswu{}", wxwin, d_or_not), - "-DWXUSINGDLL".to_string(), - ]; - if is_debug { - cflags.push("-D_DEBUG".to_string()); + // if cfg!(windows) { + // wx_config_win(args) + // } else { + // let output = Command::new("wx-config") + // .args(args) + // .output() + // .expect("failed execute wx-config command."); + // String::from_utf8_lossy(&output.stdout).to_string() + let flags: Vec<_> = env::var("DEP_WX_UNIVERSAL_APPLE_DARWIN_CFLAGS") + .unwrap() + .split_whitespace() + .map(ToOwned::to_owned) + .collect(); + let (ldflags, cflags): (Vec<_>, Vec<_>) = flags + .into_iter() + .partition(|f| f.starts_with("-l") || f.starts_with("-L")); + if args.contains(&"--cflags") { + cflags.join(" ") } else { - cflags.push("-D__NO_VC_CRTDBG__".to_string()); - cflags.push("-DwxDEBUG_LEVEL=0".to_string()); - cflags.push("-DNDEBUG".to_string()); + ldflags.join(" ") } - cflags.join(" ") - } else { - let libs = vec![ - format!("-L{}\\lib\\vc14x_x64_dll", wxwin), - format!("-lwxbase31u{}", d_or_not), - format!("-lwxmsw31u{}_core", d_or_not), - ]; - libs.join(" ") - } + // } } + +// fn wx_config_win(args: &[&str]) -> String { +// let wxwin = env::var("wxwin") +// .expect("Set 'wxwin' environment variable to point the wxMSW binaries dir."); +// // TODO: support linking with the wx debug DLL +// let is_debug = false; //env::var("PROFILE").unwrap() == "debug"; +// let d_or_not = if is_debug { "d" } else { "" }; +// if args.contains(&"--cflags") { +// let mut cflags = vec![ +// format!("-I{}\\include", wxwin), +// format!("-I{}\\lib\\vc14x_x64_dll\\mswu{}", wxwin, d_or_not), +// "-DWXUSINGDLL".to_string(), +// ]; +// if is_debug { +// cflags.push("-D_DEBUG".to_string()); +// } else { +// cflags.push("-D__NO_VC_CRTDBG__".to_string()); +// cflags.push("-DwxDEBUG_LEVEL=0".to_string()); +// cflags.push("-DNDEBUG".to_string()); +// } +// cflags.join(" ") +// } else { +// let libs = vec![ +// format!("-L{}\\lib\\vc14x_x64_dll", wxwin), +// format!("-lwxbase31u{}", d_or_not), +// format!("-lwxmsw31u{}_core", d_or_not), +// ]; +// libs.join(" ") +// } +// } From 3d24f44f4b93539413b0e7b55bdf2ccce337326f Mon Sep 17 00:00:00 2001 From: KENZ Date: Wed, 22 Jun 2022 00:58:37 +0900 Subject: [PATCH 02/21] Build fixed by specifying `-fapple-link-rtlib` --- wxrust-config/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index 7858aa79..5a9ea92b 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -36,7 +36,9 @@ pub fn print_wx_config_libs_for_cargo() { let libs = wx_config(&["--libs"]); for f in libs.split_whitespace() { println!("cargo:rustc-flags={}", f); - } // let mut next_is_framework_name = false; + } + println!("cargo:rustc-link-arg=-fapple-link-rtlib"); + // let mut next_is_framework_name = false; // for arg in libs.split_whitespace() { // if next_is_framework_name { // println!("cargo:rustc-link-lib=framework={}", arg); From 8f48f2c2335167528a062f5978e2ae89d1768122 Mon Sep 17 00:00:00 2001 From: KENZ Date: Thu, 23 Jun 2022 00:59:22 +0900 Subject: [PATCH 03/21] Support x86_64-pc-windows-msvc binary dep --- Cargo.lock | 7 +++++ wx-base/Cargo.toml | 7 +++-- wx-core/Cargo.toml | 7 ++++- wxrust-config/src/lib.rs | 62 ++++++++++++++++++++++------------------ 4 files changed, 52 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79b5026c..91f2c265 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,6 +51,7 @@ dependencies = [ "cc", "wx-base", "wx-universal-apple-darwin", + "wx-x86_64-pc-windows-msvc", "wxrust-config", ] @@ -60,6 +61,7 @@ version = "0.1.0" dependencies = [ "cc", "wx-universal-apple-darwin", + "wx-x86_64-pc-windows-msvc", "wxrust-config", ] @@ -68,6 +70,11 @@ name = "wx-universal-apple-darwin" version = "3.1.6" source = "git+https://github.com/ancwrd1/wx-universal-apple-darwin#4e512d2c125436007a7ee1331a48d8b5de430fb4" +[[package]] +name = "wx-x86_64-pc-windows-msvc" +version = "3.1.7" +source = "git+https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc#baac6119a393ab49c25edc3926747d5ce2644d56" + [[package]] name = "wxrust-config" version = "0.1.0" diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index 1cd28170..6f306e12 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -5,8 +5,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[dependencies] -wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } +[target.universal-apple-darwin.dependencies] +wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } + +[target.x86_64-pc-windows-msvc.dependencies] +wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } [build-dependencies] cc = "1.0.72" diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 17174538..14d67357 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -6,9 +6,14 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../wx-base" } +[target.universal-apple-darwin.dependencies] +wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } + +[target.x86_64-pc-windows-msvc.dependencies] +wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } + [build-dependencies] cc = "1.0.72" wxrust-config = { path = "../wxrust-config" } diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index 5a9ea92b..b36ccb2c 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -5,13 +5,10 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { // from `wx-config --cflags` let cflags = wx_config(&["--cflags"]); // ignore too many warnings with wx3.0 - cc_build - .flag("-DNDEBUG") - .flag("-std=c++14") - .cpp(true); - // .flag_if_supported("-Wno-deprecated-copy") - // .flag_if_supported("-Wno-ignored-qualifiers") - // .flag_if_supported("-Wno-unused-parameter"); + cc_build.flag("-DNDEBUG").flag("-std=c++14").cpp(true); + // .flag_if_supported("-Wno-deprecated-copy") + // .flag_if_supported("-Wno-ignored-qualifiers") + // .flag_if_supported("-Wno-unused-parameter"); for arg in cflags.split_whitespace() { cc_build.flag(arg); // if arg.starts_with("-I") { @@ -25,9 +22,9 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { // panic!("unsupported argument '{}'. please file a bug.", arg) // } } - // if cfg!(windows) { - // cc_build.flag("/EHsc"); - // } + if cfg!(windows) { + cc_build.flag("/EHsc"); + } cc_build } @@ -57,28 +54,37 @@ pub fn print_wx_config_libs_for_cargo() { // } } +fn dep_links() -> String { + let target = env::var("TARGET").unwrap().replace('-', "_").to_uppercase(); + if target.contains("APPLE") { + "UNIVERSAL_APPLE_DARWIN".to_owned() + } else { + target + } +} + fn wx_config(args: &[&str]) -> String { // if cfg!(windows) { // wx_config_win(args) // } else { - // let output = Command::new("wx-config") - // .args(args) - // .output() - // .expect("failed execute wx-config command."); - // String::from_utf8_lossy(&output.stdout).to_string() - let flags: Vec<_> = env::var("DEP_WX_UNIVERSAL_APPLE_DARWIN_CFLAGS") - .unwrap() - .split_whitespace() - .map(ToOwned::to_owned) - .collect(); - let (ldflags, cflags): (Vec<_>, Vec<_>) = flags - .into_iter() - .partition(|f| f.starts_with("-l") || f.starts_with("-L")); - if args.contains(&"--cflags") { - cflags.join(" ") - } else { - ldflags.join(" ") - } + // let output = Command::new("wx-config") + // .args(args) + // .output() + // .expect("failed execute wx-config command."); + // String::from_utf8_lossy(&output.stdout).to_string() + let flags: Vec<_> = env::var(format!("DEP_WX_{}_CFLAGS", dep_links())) + .unwrap() + .split_whitespace() + .map(ToOwned::to_owned) + .collect(); + let (ldflags, cflags): (Vec<_>, Vec<_>) = flags + .into_iter() + .partition(|f| f.starts_with("-l") || f.starts_with("-L")); + if args.contains(&"--cflags") { + cflags.join(" ") + } else { + ldflags.join(" ") + } // } } From 180a5896028c9d9bc02ebbddde1137510eda4f4f Mon Sep 17 00:00:00 2001 From: KENZ Date: Fri, 24 Jun 2022 05:48:45 +0900 Subject: [PATCH 04/21] Fixed mac build (this time) - `cargo:rustc-link-arg` was not transitive. - Specified it in project-base config.toml --- .cargo/config.toml | 2 ++ Cargo.lock | 4 ---- samples/hello/Cargo.toml | 2 -- samples/minimal/Cargo.toml | 1 - samples/widgets/Cargo.toml | 1 - samples/wrapsizer/Cargo.toml | 2 -- wx-base/Cargo.toml | 2 +- wx-core/Cargo.toml | 2 +- wxrust-config/src/lib.rs | 1 - 9 files changed, 4 insertions(+), 13 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..af376d8a --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.'cfg(target_os = "macos")'] +rustflags = "-C link-arg=-fapple-link-rtlib" diff --git a/Cargo.lock b/Cargo.lock index 91f2c265..c33e3e67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,6 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", - "wx-universal-apple-darwin", ] [[package]] @@ -23,7 +22,6 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", - "wx-universal-apple-darwin", ] [[package]] @@ -32,7 +30,6 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", - "wx-universal-apple-darwin", ] [[package]] @@ -41,7 +38,6 @@ version = "0.1.0" dependencies = [ "wx", "wx-base", - "wx-universal-apple-darwin", ] [[package]] diff --git a/samples/hello/Cargo.toml b/samples/hello/Cargo.toml index 33c92f99..727c849c 100644 --- a/samples/hello/Cargo.toml +++ b/samples/hello/Cargo.toml @@ -6,7 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } - diff --git a/samples/minimal/Cargo.toml b/samples/minimal/Cargo.toml index 5d1fa707..fda9dcfa 100644 --- a/samples/minimal/Cargo.toml +++ b/samples/minimal/Cargo.toml @@ -6,6 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } diff --git a/samples/widgets/Cargo.toml b/samples/widgets/Cargo.toml index 0dba2390..939bdc3a 100644 --- a/samples/widgets/Cargo.toml +++ b/samples/widgets/Cargo.toml @@ -6,6 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } diff --git a/samples/wrapsizer/Cargo.toml b/samples/wrapsizer/Cargo.toml index 01360458..2dcc63c8 100644 --- a/samples/wrapsizer/Cargo.toml +++ b/samples/wrapsizer/Cargo.toml @@ -6,7 +6,5 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -wx-bin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", package = "wx-universal-apple-darwin" } wx-base = { path = "../../wx-base" } wx = { path = "../../wx-core" } - diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index 6f306e12..b08951fe 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[target.universal-apple-darwin.dependencies] +[target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } [target.x86_64-pc-windows-msvc.dependencies] diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 14d67357..ea56b105 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] wx-base = { path = "../wx-base" } -[target.universal-apple-darwin.dependencies] +[target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } [target.x86_64-pc-windows-msvc.dependencies] diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index b36ccb2c..c044aceb 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -34,7 +34,6 @@ pub fn print_wx_config_libs_for_cargo() { for f in libs.split_whitespace() { println!("cargo:rustc-flags={}", f); } - println!("cargo:rustc-link-arg=-fapple-link-rtlib"); // let mut next_is_framework_name = false; // for arg in libs.split_whitespace() { // if next_is_framework_name { From 1e3b9c27fd94854f8633d08c467c47d316a43f0d Mon Sep 17 00:00:00 2001 From: KENZ Date: Fri, 24 Jun 2022 06:11:43 +0900 Subject: [PATCH 05/21] Reduce diff in PR while building mac --- wxrust-config/src/lib.rs | 129 ++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 63 deletions(-) diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index c044aceb..63b09b0f 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -5,22 +5,25 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { // from `wx-config --cflags` let cflags = wx_config(&["--cflags"]); // ignore too many warnings with wx3.0 - cc_build.flag("-DNDEBUG").flag("-std=c++14").cpp(true); - // .flag_if_supported("-Wno-deprecated-copy") - // .flag_if_supported("-Wno-ignored-qualifiers") - // .flag_if_supported("-Wno-unused-parameter"); + cc_build + .flag("-DNDEBUG") // for Windows + // .flag("-std=c++14") + // .cpp(true) + .flag_if_supported("-Wno-deprecated-copy") + .flag_if_supported("-Wno-ignored-qualifiers") + .flag_if_supported("-Wno-unused-parameter"); for arg in cflags.split_whitespace() { - cc_build.flag(arg); - // if arg.starts_with("-I") { - // cc_build.include(&arg[2..]); - // } else if arg.starts_with("-D") { - // let split = &mut arg[2..].split('='); - // cc_build.define(split.next().unwrap(), split.next().unwrap_or("")); - // } else if arg.starts_with("-pthread") { - // cc_build.flag(arg); - // } else { - // panic!("unsupported argument '{}'. please file a bug.", arg) - // } + // cc_build.flag(arg); + if arg.starts_with("-I") { + cc_build.include(&arg[2..]); + } else if arg.starts_with("-D") { + let split = &mut arg[2..].split('='); + cc_build.define(split.next().unwrap(), split.next().unwrap_or("")); + } else if arg.starts_with("-pthread") { + cc_build.flag(arg); + } else { + panic!("unsupported argument '{}'. please file a bug.", arg) + } } if cfg!(windows) { cc_build.flag("/EHsc"); @@ -31,26 +34,26 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { pub fn print_wx_config_libs_for_cargo() { // from `wx-config --libs` let libs = wx_config(&["--libs"]); - for f in libs.split_whitespace() { - println!("cargo:rustc-flags={}", f); - } - // let mut next_is_framework_name = false; - // for arg in libs.split_whitespace() { - // if next_is_framework_name { - // println!("cargo:rustc-link-lib=framework={}", arg); - // next_is_framework_name = false; - // } else if arg == "-framework" { - // next_is_framework_name = true; - // } else if arg.starts_with("-L") { - // println!("cargo:rustc-link-search=native={}", &arg[2..]); - // } else if arg.starts_with("-l") { - // println!("cargo:rustc-link-lib={}", &arg[2..]); - // } else if arg.starts_with("-pthread") { - // // ignore - // } else { - // panic!("unsupported argument '{}'. please file a bug.", arg) - // } + // for f in libs.split_whitespace() { + // println!("cargo:rustc-flags={}", f); // } + let mut next_is_framework_name = false; + for arg in libs.split_whitespace() { + if next_is_framework_name { + println!("cargo:rustc-link-lib=framework={}", arg); + next_is_framework_name = false; + } else if arg == "-framework" { + next_is_framework_name = true; + } else if arg.starts_with("-L") { + println!("cargo:rustc-link-search=native={}", &arg[2..]); + } else if arg.starts_with("-l") { + println!("cargo:rustc-link-lib={}", &arg[2..]); + } else if arg.starts_with("-pthread") { + // ignore + } else { + panic!("unsupported argument '{}'. please file a bug.", arg) + } + } } fn dep_links() -> String { @@ -87,32 +90,32 @@ fn wx_config(args: &[&str]) -> String { // } } -// fn wx_config_win(args: &[&str]) -> String { -// let wxwin = env::var("wxwin") -// .expect("Set 'wxwin' environment variable to point the wxMSW binaries dir."); -// // TODO: support linking with the wx debug DLL -// let is_debug = false; //env::var("PROFILE").unwrap() == "debug"; -// let d_or_not = if is_debug { "d" } else { "" }; -// if args.contains(&"--cflags") { -// let mut cflags = vec![ -// format!("-I{}\\include", wxwin), -// format!("-I{}\\lib\\vc14x_x64_dll\\mswu{}", wxwin, d_or_not), -// "-DWXUSINGDLL".to_string(), -// ]; -// if is_debug { -// cflags.push("-D_DEBUG".to_string()); -// } else { -// cflags.push("-D__NO_VC_CRTDBG__".to_string()); -// cflags.push("-DwxDEBUG_LEVEL=0".to_string()); -// cflags.push("-DNDEBUG".to_string()); -// } -// cflags.join(" ") -// } else { -// let libs = vec![ -// format!("-L{}\\lib\\vc14x_x64_dll", wxwin), -// format!("-lwxbase31u{}", d_or_not), -// format!("-lwxmsw31u{}_core", d_or_not), -// ]; -// libs.join(" ") -// } -// } +fn wx_config_win(args: &[&str]) -> String { + let wxwin = env::var("wxwin") + .expect("Set 'wxwin' environment variable to point the wxMSW binaries dir."); + // TODO: support linking with the wx debug DLL + let is_debug = false; //env::var("PROFILE").unwrap() == "debug"; + let d_or_not = if is_debug { "d" } else { "" }; + if args.contains(&"--cflags") { + let mut cflags = vec![ + format!("-I{}\\include", wxwin), + format!("-I{}\\lib\\vc14x_x64_dll\\mswu{}", wxwin, d_or_not), + "-DWXUSINGDLL".to_string(), + ]; + if is_debug { + cflags.push("-D_DEBUG".to_string()); + } else { + cflags.push("-D__NO_VC_CRTDBG__".to_string()); + cflags.push("-DwxDEBUG_LEVEL=0".to_string()); + cflags.push("-DNDEBUG".to_string()); + } + cflags.join(" ") + } else { + let libs = vec![ + format!("-L{}\\lib\\vc14x_x64_dll", wxwin), + format!("-lwxbase31u{}", d_or_not), + format!("-lwxmsw31u{}_core", d_or_not), + ]; + libs.join(" ") + } +} From d41298f5638e1a201c27ea07749265b6a1d3ae7c Mon Sep 17 00:00:00 2001 From: KENZ Date: Thu, 30 Jun 2022 08:56:14 +0900 Subject: [PATCH 06/21] Make use_binary cargo feature --- wx-base/Cargo.toml | 3 +++ wx-core/Cargo.toml | 3 +++ wxrust-config/Cargo.toml | 3 +++ wxrust-config/src/lib.rs | 43 +++++++++++++++++++++------------------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index b08951fe..5daecb1f 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +use_binary = ["wxrust-config/use_binary"] + [target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index ea56b105..c3ec77b5 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -5,6 +5,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +use_binary = ["wxrust-config/use_binary"] + [dependencies] wx-base = { path = "../wx-base" } diff --git a/wxrust-config/Cargo.toml b/wxrust-config/Cargo.toml index 3cb478f4..7dd41799 100644 --- a/wxrust-config/Cargo.toml +++ b/wxrust-config/Cargo.toml @@ -5,5 +5,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +use_binary = [] + [dependencies] cc = "1.0.72" diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index 63b09b0f..821cea95 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -66,28 +66,31 @@ fn dep_links() -> String { } fn wx_config(args: &[&str]) -> String { - // if cfg!(windows) { - // wx_config_win(args) - // } else { - // let output = Command::new("wx-config") - // .args(args) - // .output() - // .expect("failed execute wx-config command."); - // String::from_utf8_lossy(&output.stdout).to_string() - let flags: Vec<_> = env::var(format!("DEP_WX_{}_CFLAGS", dep_links())) - .unwrap() - .split_whitespace() - .map(ToOwned::to_owned) - .collect(); - let (ldflags, cflags): (Vec<_>, Vec<_>) = flags - .into_iter() - .partition(|f| f.starts_with("-l") || f.starts_with("-L")); - if args.contains(&"--cflags") { - cflags.join(" ") + if cfg!(feature = "use_binary") { + let flags: Vec<_> = env::var(format!("DEP_WX_{}_CFLAGS", dep_links())) + .unwrap() + .split_whitespace() + .map(ToOwned::to_owned) + .collect(); + let (ldflags, cflags): (Vec<_>, Vec<_>) = flags + .into_iter() + .partition(|f| f.starts_with("-l") || f.starts_with("-L")); + return if args.contains(&"--cflags") { + cflags.join(" ") + } else { + ldflags.join(" ") + }; + } + + if cfg!(windows) { + wx_config_win(args) } else { - ldflags.join(" ") + let output = Command::new("wx-config") + .args(args) + .output() + .expect("failed execute wx-config command."); + String::from_utf8_lossy(&output.stdout).to_string() } - // } } fn wx_config_win(args: &[&str]) -> String { From d6684c9b8c8c371dbf770d32c69736b96283e1d8 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 13:42:27 +0900 Subject: [PATCH 07/21] Specify binary crate for x86_64-pc-windows-gnu target --- Cargo.lock | 7 +++++++ wx-base/Cargo.toml | 3 +++ wx-core/Cargo.toml | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index c33e3e67..a5d3ceae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -47,6 +47,7 @@ dependencies = [ "cc", "wx-base", "wx-universal-apple-darwin", + "wx-x86_64-pc-windows-gnu", "wx-x86_64-pc-windows-msvc", "wxrust-config", ] @@ -57,6 +58,7 @@ version = "0.1.0" dependencies = [ "cc", "wx-universal-apple-darwin", + "wx-x86_64-pc-windows-gnu", "wx-x86_64-pc-windows-msvc", "wxrust-config", ] @@ -66,6 +68,11 @@ name = "wx-universal-apple-darwin" version = "3.1.6" source = "git+https://github.com/ancwrd1/wx-universal-apple-darwin#4e512d2c125436007a7ee1331a48d8b5de430fb4" +[[package]] +name = "wx-x86_64-pc-windows-gnu" +version = "3.1.6" +source = "git+https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu#b41af996f766692e2d08926dbd2660091a654916" + [[package]] name = "wx-x86_64-pc-windows-msvc" version = "3.1.7" diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index 5daecb1f..5adef70b 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -14,6 +14,9 @@ wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-app [target.x86_64-pc-windows-msvc.dependencies] wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } +[target.x86_64-pc-windows-gnu.dependencies] +wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu" } + [build-dependencies] cc = "1.0.72" wxrust-config = { path = "../wxrust-config" } diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index c3ec77b5..7c254653 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -17,6 +17,9 @@ wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-app [target.x86_64-pc-windows-msvc.dependencies] wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } +[target.x86_64-pc-windows-gnu.dependencies] +wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu" } + [build-dependencies] cc = "1.0.72" wxrust-config = { path = "../wxrust-config" } From 9a1427bcc9cd2112a9844ace10ed2174cc924966 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 13:44:49 +0900 Subject: [PATCH 08/21] Return wrapped value for const& retrun value * At least, ming64 treat this as rvalue, and retrieving the address of rvalue is error. * This fixes build error. --- doxybindgen/binding.py | 9 +++++---- doxybindgen/model.py | 3 ++- wx-core/include/generated.h | 12 ++++++------ wx-core/src/generated.cpp | 24 ++++++++++++------------ 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/doxybindgen/binding.py b/doxybindgen/binding.py index 4c8a2779..b9a5cbfe 100644 --- a/doxybindgen/binding.py +++ b/doxybindgen/binding.py @@ -581,11 +581,12 @@ def lines(self, is_cc): self.__model.name(without_index=True), new_params_or_expr, ) - if (self.__model.maybe_returns_self() or - self.__model.returns.is_ref_to_binding()): - yield ' return &(%s);' % (new_params_or_expr,) - elif wrapped: + if (wrapped or + self.__model.returns.is_const_ref_to_binding()): yield ' return new %s(%s);' % (wrapped.in_cxx(), new_params_or_expr) + elif (self.__model.maybe_returns_self() or + self.__model.returns.is_ref_to_binding()): + yield ' return &(%s);' % (new_params_or_expr,) else: yield ' return %s;' % (new_params_or_expr,) yield '}' diff --git a/doxybindgen/model.py b/doxybindgen/model.py index 3aa41af5..6a5edc93 100644 --- a/doxybindgen/model.py +++ b/doxybindgen/model.py @@ -181,7 +181,8 @@ def overload_indexed(self, name): def wrap_return_type(self, allows_ptr): if (self.is_ctor or - self.returns_new() or + self.returns_new() or + self.returns.is_const_ref_to_binding() or allows_ptr and (self.returns.is_ptr_to_binding() or self.returns.is_ref_to_binding())): return ReturnTypeWrapper(self) diff --git a/wx-core/include/generated.h b/wx-core/include/generated.h index eb3d73ef..8535a14e 100644 --- a/wx-core/include/generated.h +++ b/wx-core/include/generated.h @@ -443,7 +443,7 @@ wxMenuBar * wxMenuBar_MacGetCommonMenuBar(); // CLASS: wxMenuItem #ifdef __WXMSW__ -const wxBitmap * wxMenuItem_GetDisabledBitmap(const wxMenuItem * self); +wxBitmap *wxMenuItem_GetDisabledBitmap(const wxMenuItem * self); #endif wxString *wxMenuItem_GetHelp(const wxMenuItem * self); int wxMenuItem_GetId(const wxMenuItem * self); @@ -762,7 +762,7 @@ void wxStaticText_Wrap(wxStaticText * self, int width); // CLASS: wxTextAttr void wxTextAttr_delete(wxTextAttr *self); -const wxColour * wxTextAttr_GetBackgroundColour(const wxTextAttr * self); +wxColour *wxTextAttr_GetBackgroundColour(const wxTextAttr * self); wxString *wxTextAttr_GetBulletFont(const wxTextAttr * self); wxString *wxTextAttr_GetBulletName(const wxTextAttr * self); int wxTextAttr_GetBulletNumber(const wxTextAttr * self); @@ -775,7 +775,7 @@ wxString *wxTextAttr_GetFontFaceName(const wxTextAttr * self); int wxTextAttr_GetFontSize(const wxTextAttr * self); bool wxTextAttr_GetFontUnderlined(const wxTextAttr * self); #if wxCHECK_VERSION(3, 1, 0) -const wxColour * wxTextAttr_GetUnderlineColour(const wxTextAttr * self); +wxColour *wxTextAttr_GetUnderlineColour(const wxTextAttr * self); #endif long wxTextAttr_GetLeftIndent(const wxTextAttr * self); long wxTextAttr_GetLeftSubIndent(const wxTextAttr * self); @@ -786,7 +786,7 @@ int wxTextAttr_GetParagraphSpacingAfter(const wxTextAttr * self); int wxTextAttr_GetParagraphSpacingBefore(const wxTextAttr * self); wxString *wxTextAttr_GetParagraphStyleName(const wxTextAttr * self); long wxTextAttr_GetRightIndent(const wxTextAttr * self); -const wxColour * wxTextAttr_GetTextColour(const wxTextAttr * self); +wxColour *wxTextAttr_GetTextColour(const wxTextAttr * self); int wxTextAttr_GetTextEffectFlags(const wxTextAttr * self); int wxTextAttr_GetTextEffects(const wxTextAttr * self); wxString *wxTextAttr_GetURL(const wxTextAttr * self); @@ -865,7 +865,7 @@ wxTextCtrl *wxTextCtrl_new1(wxWindow * parent, wxWindowID id, const wxString * v bool wxTextCtrl_Create(wxTextCtrl * self, wxWindow * parent, wxWindowID id, const wxString * value, const wxPoint * pos, const wxSize * size, long style, const wxValidator * validator, const wxString * name); void wxTextCtrl_DiscardEdits(wxTextCtrl * self); bool wxTextCtrl_EmulateKeyPress(wxTextCtrl * self, const wxKeyEvent * event); -const wxTextAttr * wxTextCtrl_GetDefaultStyle(const wxTextCtrl * self); +wxTextAttr *wxTextCtrl_GetDefaultStyle(const wxTextCtrl * self); int wxTextCtrl_GetLineLength(const wxTextCtrl * self, long line_no); wxString *wxTextCtrl_GetLineText(const wxTextCtrl * self, long line_no); int wxTextCtrl_GetNumberOfLines(const wxTextCtrl * self); @@ -1064,7 +1064,7 @@ void wxWindow_AddChild(wxWindow * self, wxWindow * child); bool wxWindow_DestroyChildren(wxWindow * self); wxWindow * wxWindow_FindWindow(const wxWindow * self, long id); wxWindow * wxWindow_FindWindow1(const wxWindow * self, const wxString * name); -const wxWindowList * wxWindow_GetChildren1(const wxWindow * self); +wxWindowList *wxWindow_GetChildren1(const wxWindow * self); void wxWindow_RemoveChild(wxWindow * self, wxWindow * child); wxWindow * wxWindow_GetGrandParent(const wxWindow * self); wxWindow * wxWindow_GetNextSibling(const wxWindow * self); diff --git a/wx-core/src/generated.cpp b/wx-core/src/generated.cpp index e5376b13..b053dacf 100644 --- a/wx-core/src/generated.cpp +++ b/wx-core/src/generated.cpp @@ -1150,8 +1150,8 @@ wxMenuBar * wxMenuBar_MacGetCommonMenuBar() { // CLASS: wxMenuItem #ifdef __WXMSW__ -const wxBitmap * wxMenuItem_GetDisabledBitmap(const wxMenuItem * self) { - return &(self->GetDisabledBitmap()); +wxBitmap *wxMenuItem_GetDisabledBitmap(const wxMenuItem * self) { + return new wxBitmap(self->GetDisabledBitmap()); } #endif wxString *wxMenuItem_GetHelp(const wxMenuItem * self) { @@ -2015,8 +2015,8 @@ void wxStaticText_Wrap(wxStaticText * self, int width) { void wxTextAttr_delete(wxTextAttr *self) { delete self; } -const wxColour * wxTextAttr_GetBackgroundColour(const wxTextAttr * self) { - return &(self->GetBackgroundColour()); +wxColour *wxTextAttr_GetBackgroundColour(const wxTextAttr * self) { + return new wxColour(self->GetBackgroundColour()); } wxString *wxTextAttr_GetBulletFont(const wxTextAttr * self) { return new wxString(self->GetBulletFont()); @@ -2052,8 +2052,8 @@ bool wxTextAttr_GetFontUnderlined(const wxTextAttr * self) { return self->GetFontUnderlined(); } #if wxCHECK_VERSION(3, 1, 0) -const wxColour * wxTextAttr_GetUnderlineColour(const wxTextAttr * self) { - return &(self->GetUnderlineColour()); +wxColour *wxTextAttr_GetUnderlineColour(const wxTextAttr * self) { + return new wxColour(self->GetUnderlineColour()); } #endif long wxTextAttr_GetLeftIndent(const wxTextAttr * self) { @@ -2083,8 +2083,8 @@ wxString *wxTextAttr_GetParagraphStyleName(const wxTextAttr * self) { long wxTextAttr_GetRightIndent(const wxTextAttr * self) { return self->GetRightIndent(); } -const wxColour * wxTextAttr_GetTextColour(const wxTextAttr * self) { - return &(self->GetTextColour()); +wxColour *wxTextAttr_GetTextColour(const wxTextAttr * self) { + return new wxColour(self->GetTextColour()); } int wxTextAttr_GetTextEffectFlags(const wxTextAttr * self) { return self->GetTextEffectFlags(); @@ -2316,8 +2316,8 @@ void wxTextCtrl_DiscardEdits(wxTextCtrl * self) { bool wxTextCtrl_EmulateKeyPress(wxTextCtrl * self, const wxKeyEvent * event) { return self->EmulateKeyPress(*event); } -const wxTextAttr * wxTextCtrl_GetDefaultStyle(const wxTextCtrl * self) { - return &(self->GetDefaultStyle()); +wxTextAttr *wxTextCtrl_GetDefaultStyle(const wxTextCtrl * self) { + return new wxTextAttr(self->GetDefaultStyle()); } int wxTextCtrl_GetLineLength(const wxTextCtrl * self, long line_no) { return self->GetLineLength(line_no); @@ -2867,8 +2867,8 @@ wxWindow * wxWindow_FindWindow(const wxWindow * self, long id) { wxWindow * wxWindow_FindWindow1(const wxWindow * self, const wxString * name) { return self->FindWindow(*name); } -const wxWindowList * wxWindow_GetChildren1(const wxWindow * self) { - return &(self->GetChildren()); +wxWindowList *wxWindow_GetChildren1(const wxWindow * self) { + return new wxWindowList(self->GetChildren()); } void wxWindow_RemoveChild(wxWindow * self, wxWindow * child) { return self->RemoveChild(child); From 556218b12b9cbcc8e8ca619d8921cccf4ee8d32b Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 13:45:43 +0900 Subject: [PATCH 09/21] Specify `/EHsc` only for MSVC --- wxrust-config/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index 821cea95..64760e9e 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -25,7 +25,7 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { panic!("unsupported argument '{}'. please file a bug.", arg) } } - if cfg!(windows) { + if cfg!(target_env = "msvc") { cc_build.flag("/EHsc"); } cc_build From 4fd2245136e4b53f0aa2585e3c9d79f976071a74 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 20:06:06 +0900 Subject: [PATCH 10/21] Try mac CI build without wx prerequisite --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2b8f7da8..f8ab9651 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -72,8 +72,8 @@ jobs: ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Install Prerequisites - run: brew install wxwidgets + # - name: Install Prerequisites + # run: brew install wxwidgets - name: Build run: cargo build --verbose - name: Run tests From a17520e3d6a5a5f0c7ba37afec4adb25f390b0e7 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 20:08:08 +0900 Subject: [PATCH 11/21] Try using binary with mac CI build --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f8ab9651..a3f69fab 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -75,6 +75,6 @@ jobs: # - name: Install Prerequisites # run: brew install wxwidgets - name: Build - run: cargo build --verbose + run: cargo build --verbose --features use_binary - name: Run tests run: cargo test --verbose From c2b679fe1d232128c0fde54723db2fb00405ed07 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 20:10:21 +0900 Subject: [PATCH 12/21] Try using binary for mac CI test too --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a3f69fab..badfefd6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -77,4 +77,4 @@ jobs: - name: Build run: cargo build --verbose --features use_binary - name: Run tests - run: cargo test --verbose + run: cargo test --verbose --features use_binary From 5f6437da37ec9368ef65a70c35ae1a6caf412354 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 20:15:21 +0900 Subject: [PATCH 13/21] Try making mac binary crate dependencies optional --- wx-base/Cargo.toml | 2 +- wx-core/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index 5adef70b..b7f4b026 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" use_binary = ["wxrust-config/use_binary"] [target.'cfg(target_os = "macos")'.dependencies] -wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } +wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } [target.x86_64-pc-windows-msvc.dependencies] wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 7c254653..16a18fd3 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -12,7 +12,7 @@ use_binary = ["wxrust-config/use_binary"] wx-base = { path = "../wx-base" } [target.'cfg(target_os = "macos")'.dependencies] -wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin" } +wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } [target.x86_64-pc-windows-msvc.dependencies] wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } From f12cf2c6ce4559779747230d5a665d339cc9b84c Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 20:18:29 +0900 Subject: [PATCH 14/21] Set dependency from use_binary feature to mac binary optional crate dependency --- wx-base/Cargo.toml | 2 +- wx-core/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index b7f4b026..ff708794 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = ["wxrust-config/use_binary"] +use_binary = ["wxrust-config/use_binary", "dep:wx-universal-apple-darwin"] [target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 16a18fd3..b159ae5a 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = ["wxrust-config/use_binary"] +use_binary = ["wxrust-config/use_binary", "dep:wx-universal-apple-darwin"] [dependencies] wx-base = { path = "../wx-base" } From 5500a1c98b832629cbec3d3ce4e6520bd8df2c36 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sat, 2 Jul 2022 20:28:12 +0900 Subject: [PATCH 15/21] Make other binary crates optional too --- wx-base/Cargo.toml | 11 ++++++++--- wx-core/Cargo.toml | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index ff708794..751987ef 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -6,16 +6,21 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = ["wxrust-config/use_binary", "dep:wx-universal-apple-darwin"] +use_binary = [ + "wxrust-config/use_binary", + "dep:wx-universal-apple-darwin", + "dep:wx-x86_64-pc-windows-msvc", + "dep:wx-x86_64-pc-windows-gnu", +] [target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } [target.x86_64-pc-windows-msvc.dependencies] -wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } +wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc", optional = true } [target.x86_64-pc-windows-gnu.dependencies] -wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu" } +wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu", optional = true } [build-dependencies] cc = "1.0.72" diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index b159ae5a..813b698b 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -6,7 +6,12 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = ["wxrust-config/use_binary", "dep:wx-universal-apple-darwin"] +use_binary = [ + "wxrust-config/use_binary", + "dep:wx-universal-apple-darwin", + "dep:wx-x86_64-pc-windows-msvc", + "dep:wx-x86_64-pc-windows-gnu", +] [dependencies] wx-base = { path = "../wx-base" } @@ -15,10 +20,10 @@ wx-base = { path = "../wx-base" } wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } [target.x86_64-pc-windows-msvc.dependencies] -wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc" } +wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc", optional = true } [target.x86_64-pc-windows-gnu.dependencies] -wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu" } +wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu", optional = true } [build-dependencies] cc = "1.0.72" From 55ff6fef19f6cc89c8b902026f9d6f5377b62efb Mon Sep 17 00:00:00 2001 From: KENZ Date: Sun, 3 Jul 2022 09:20:06 +0900 Subject: [PATCH 16/21] Add build-mac-vendored job --- .github/workflows/rust.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index badfefd6..bafba059 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -61,6 +61,27 @@ jobs: build-mac: runs-on: macOS-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install Prerequisites + run: brew install wxwidgets + - name: Build + run: cargo build --verbose + - name: Run tests + run: cargo test --verbose + + build-mac-vendored: + runs-on: macOS-latest + steps: - uses: actions/checkout@v3 - uses: actions/cache@v3 From 574595eda64e31685716f6f14a1377812c239e61 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sun, 3 Jul 2022 09:20:24 +0900 Subject: [PATCH 17/21] Reduce diff and sorted target dependencies --- samples/hello/Cargo.toml | 2 +- samples/minimal/Cargo.toml | 2 +- samples/widgets/Cargo.toml | 2 +- samples/wrapsizer/Cargo.toml | 2 +- wx-base/Cargo.toml | 8 ++++---- wx-core/Cargo.toml | 8 ++++---- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/hello/Cargo.toml b/samples/hello/Cargo.toml index 727c849c..4bda29bd 100644 --- a/samples/hello/Cargo.toml +++ b/samples/hello/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } +wx = { path = "../../wx-core" } \ No newline at end of file diff --git a/samples/minimal/Cargo.toml b/samples/minimal/Cargo.toml index fda9dcfa..26393f7b 100644 --- a/samples/minimal/Cargo.toml +++ b/samples/minimal/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } +wx = { path = "../../wx-core" } \ No newline at end of file diff --git a/samples/widgets/Cargo.toml b/samples/widgets/Cargo.toml index 939bdc3a..830db463 100644 --- a/samples/widgets/Cargo.toml +++ b/samples/widgets/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } +wx = { path = "../../wx-core" } \ No newline at end of file diff --git a/samples/wrapsizer/Cargo.toml b/samples/wrapsizer/Cargo.toml index 2dcc63c8..05e2db9e 100644 --- a/samples/wrapsizer/Cargo.toml +++ b/samples/wrapsizer/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } +wx = { path = "../../wx-core" } \ No newline at end of file diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index 751987ef..de0a3477 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -9,19 +9,19 @@ edition = "2021" use_binary = [ "wxrust-config/use_binary", "dep:wx-universal-apple-darwin", - "dep:wx-x86_64-pc-windows-msvc", "dep:wx-x86_64-pc-windows-gnu", + "dep:wx-x86_64-pc-windows-msvc", ] [target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } -[target.x86_64-pc-windows-msvc.dependencies] -wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc", optional = true } - [target.x86_64-pc-windows-gnu.dependencies] wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu", optional = true } +[target.x86_64-pc-windows-msvc.dependencies] +wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc", optional = true } + [build-dependencies] cc = "1.0.72" wxrust-config = { path = "../wxrust-config" } diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 813b698b..51a2f615 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" use_binary = [ "wxrust-config/use_binary", "dep:wx-universal-apple-darwin", - "dep:wx-x86_64-pc-windows-msvc", "dep:wx-x86_64-pc-windows-gnu", + "dep:wx-x86_64-pc-windows-msvc", ] [dependencies] @@ -19,12 +19,12 @@ wx-base = { path = "../wx-base" } [target.'cfg(target_os = "macos")'.dependencies] wx-universal-apple-darwin = { git = "https://github.com/ancwrd1/wx-universal-apple-darwin", optional = true } -[target.x86_64-pc-windows-msvc.dependencies] -wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc", optional = true } - [target.x86_64-pc-windows-gnu.dependencies] wx-x86_64-pc-windows-gnu = { git = "https://github.com/ancwrd1/wx-x86_64-pc-windows-gnu", optional = true } +[target.x86_64-pc-windows-msvc.dependencies] +wx-x86_64-pc-windows-msvc = { git = "https://github.com/kenz-gelsoft/wx-x86_64-pc-windows-msvc", optional = true } + [build-dependencies] cc = "1.0.72" wxrust-config = { path = "../wxrust-config" } From 755b19ee67dcf0bfcb28aa934e1439116382e3e1 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sun, 3 Jul 2022 09:46:19 +0900 Subject: [PATCH 18/21] Rename `use_binary` feature to `vendored` --- .github/workflows/rust.yml | 4 ++-- wx-base/Cargo.toml | 4 ++-- wx-core/Cargo.toml | 4 ++-- wxrust-config/Cargo.toml | 2 +- wxrust-config/src/lib.rs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bafba059..63baddb9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -96,6 +96,6 @@ jobs: # - name: Install Prerequisites # run: brew install wxwidgets - name: Build - run: cargo build --verbose --features use_binary + run: cargo build --verbose --features vendored - name: Run tests - run: cargo test --verbose --features use_binary + run: cargo test --verbose --features vendored diff --git a/wx-base/Cargo.toml b/wx-base/Cargo.toml index de0a3477..caa9e360 100644 --- a/wx-base/Cargo.toml +++ b/wx-base/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = [ - "wxrust-config/use_binary", +vendored = [ + "wxrust-config/vendored", "dep:wx-universal-apple-darwin", "dep:wx-x86_64-pc-windows-gnu", "dep:wx-x86_64-pc-windows-msvc", diff --git a/wx-core/Cargo.toml b/wx-core/Cargo.toml index 51a2f615..70b6a86c 100644 --- a/wx-core/Cargo.toml +++ b/wx-core/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = [ - "wxrust-config/use_binary", +vendored = [ + "wxrust-config/vendored", "dep:wx-universal-apple-darwin", "dep:wx-x86_64-pc-windows-gnu", "dep:wx-x86_64-pc-windows-msvc", diff --git a/wxrust-config/Cargo.toml b/wxrust-config/Cargo.toml index 7dd41799..0b3dc6c6 100644 --- a/wxrust-config/Cargo.toml +++ b/wxrust-config/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -use_binary = [] +vendored = [] [dependencies] cc = "1.0.72" diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index 64760e9e..aca3ddbb 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -66,7 +66,7 @@ fn dep_links() -> String { } fn wx_config(args: &[&str]) -> String { - if cfg!(feature = "use_binary") { + if cfg!(feature = "vendored") { let flags: Vec<_> = env::var(format!("DEP_WX_{}_CFLAGS", dep_links())) .unwrap() .split_whitespace() From 3e08b93c9bdf89ae0e1a35d7204415332063b56b Mon Sep 17 00:00:00 2001 From: KENZ Date: Sun, 3 Jul 2022 09:50:52 +0900 Subject: [PATCH 19/21] Fix last new line --- samples/hello/Cargo.toml | 2 +- samples/minimal/Cargo.toml | 2 +- samples/widgets/Cargo.toml | 2 +- samples/wrapsizer/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/hello/Cargo.toml b/samples/hello/Cargo.toml index 4bda29bd..727c849c 100644 --- a/samples/hello/Cargo.toml +++ b/samples/hello/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } \ No newline at end of file +wx = { path = "../../wx-core" } diff --git a/samples/minimal/Cargo.toml b/samples/minimal/Cargo.toml index 26393f7b..fda9dcfa 100644 --- a/samples/minimal/Cargo.toml +++ b/samples/minimal/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } \ No newline at end of file +wx = { path = "../../wx-core" } diff --git a/samples/widgets/Cargo.toml b/samples/widgets/Cargo.toml index 830db463..939bdc3a 100644 --- a/samples/widgets/Cargo.toml +++ b/samples/widgets/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } \ No newline at end of file +wx = { path = "../../wx-core" } diff --git a/samples/wrapsizer/Cargo.toml b/samples/wrapsizer/Cargo.toml index 05e2db9e..2dcc63c8 100644 --- a/samples/wrapsizer/Cargo.toml +++ b/samples/wrapsizer/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] wx-base = { path = "../../wx-base" } -wx = { path = "../../wx-core" } \ No newline at end of file +wx = { path = "../../wx-core" } From 58e310570331d44b219bea423c04bbf345aa8fd9 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sun, 3 Jul 2022 12:03:00 +0900 Subject: [PATCH 20/21] Make 3.1.7 specific API available for 3.1.7 environment --- doxybindgen.toml | 13 ++++++++++- wx-core/include/generated.h | 21 +++++++++++++++++ wx-core/src/generated.cpp | 39 +++++++++++++++++++++++++++++++ wx-core/src/generated/ffi.rs | 18 +++++++------- wx-core/src/generated/methods.rs | 40 +++++++++++++++++++++++++------- 5 files changed, 112 insertions(+), 19 deletions(-) diff --git a/doxybindgen.toml b/doxybindgen.toml index 5d3dc6f0..aba6ce54 100644 --- a/doxybindgen.toml +++ b/doxybindgen.toml @@ -71,12 +71,17 @@ cxx = "#ifndef __WXGTK__" [conditions.wx31] cxx = "#if wxCHECK_VERSION(3, 1, 0)" +[conditions.wx317] +cxx = "#if wxCHECK_VERSION(3, 1, 7)" + [types] [types.wxAnyButton] library = 'core' [types.wxArtProvider] blocklist = [ 'Insert', +] +wx317 = [ # Doc isn't up-to-date in wx3.1.6 'GetSizeHint', ] @@ -90,6 +95,8 @@ wx31 = [ blocklist = [ # doesn't support returning wxList 'GetHandlers', +] +wx317 = [ # Doc isn't up-to-date in wx3.1.6 'SetDepth', 'SetHeight', @@ -193,6 +200,8 @@ blocklist = [ [types.wxIcon] blocklist = [ 'operator=', +] +wx317 = [ # Doc isn't up-to-date in wx3.1.6 'SetDepth', 'SetHeight', @@ -304,7 +313,7 @@ blocklist = [ 'operator*=', ] [types.wxRadioBox] -blocklist = [ +wx317 = [ # Doc isn't up-to-date in wx3.1.6 'GetItemHelpText', ] @@ -425,6 +434,8 @@ blocklist = [ 'GetChildren', 'GetCursor', 'GetUpdateRegion', +] +wx317 = [ # Doc isn't up-to-date in wx3.1.6 'GetHelpText', ] diff --git a/wx-core/include/generated.h b/wx-core/include/generated.h index 8535a14e..f0fe04fe 100644 --- a/wx-core/include/generated.h +++ b/wx-core/include/generated.h @@ -33,6 +33,9 @@ bool wxArtProvider_Delete(wxArtProvider * provider); wxBitmap *wxArtProvider_GetBitmap(const wxArtID * id, const wxArtClient * client, const wxSize * size); wxIcon *wxArtProvider_GetIcon(const wxArtID * id, const wxArtClient * client, const wxSize * size); wxSize *wxArtProvider_GetNativeSizeHint(const wxArtClient * client); +#if wxCHECK_VERSION(3, 1, 7) +wxSize *wxArtProvider_GetSizeHint(const wxArtClient * client, bool platform_default); +#endif bool wxArtProvider_HasNativeProvider(); bool wxArtProvider_Pop(); void wxArtProvider_Push(wxArtProvider * provider); @@ -64,8 +67,15 @@ wxBitmap *wxBitmap_GetSubBitmap(const wxBitmap * self, const wxRect * rect); wxSize *wxBitmap_GetSize(const wxBitmap * self); int wxBitmap_GetWidth(const wxBitmap * self); bool wxBitmap_IsOk(const wxBitmap * self); +#if wxCHECK_VERSION(3, 1, 7) +void wxBitmap_SetDepth(wxBitmap * self, int depth); +void wxBitmap_SetHeight(wxBitmap * self, int height); +#endif void wxBitmap_SetMask(wxBitmap * self, wxMask * mask); void wxBitmap_SetPalette(wxBitmap * self, const wxPalette * palette); +#if wxCHECK_VERSION(3, 1, 7) +void wxBitmap_SetWidth(wxBitmap * self, int width); +#endif void wxBitmap_AddHandler(wxBitmapHandler * handler); void wxBitmap_CleanUpHandlers(); #ifndef __WXMSW__ @@ -274,6 +284,11 @@ int wxIcon_GetDepth(const wxIcon * self); int wxIcon_GetHeight(const wxIcon * self); int wxIcon_GetWidth(const wxIcon * self); bool wxIcon_IsOk(const wxIcon * self); +#if wxCHECK_VERSION(3, 1, 7) +void wxIcon_SetDepth(wxIcon * self, int depth); +void wxIcon_SetHeight(wxIcon * self, int height); +void wxIcon_SetWidth(wxIcon * self, int width); +#endif // CLASS: wxItemContainer void wxItemContainer_delete(wxItemContainer *self); @@ -543,6 +558,9 @@ bool wxRadioBox_Create1(wxRadioBox * self, wxWindow * parent, wxWindowID id, con bool wxRadioBox_Enable(wxRadioBox * self, unsigned int n, bool enable); unsigned int wxRadioBox_GetColumnCount(const wxRadioBox * self); int wxRadioBox_GetItemFromPoint(const wxRadioBox * self, const wxPoint * pt); +#if wxCHECK_VERSION(3, 1, 7) +wxString *wxRadioBox_GetItemHelpText(const wxRadioBox * self, unsigned int item); +#endif wxToolTip * wxRadioBox_GetItemToolTip(const wxRadioBox * self, unsigned int item); unsigned int wxRadioBox_GetRowCount(const wxRadioBox * self); bool wxRadioBox_IsItemEnabled(const wxRadioBox * self, unsigned int n); @@ -1256,6 +1274,9 @@ bool wxWindow_IsShownOnScreen(const wxWindow * self); bool wxWindow_Disable(wxWindow * self); bool wxWindow_Enable(wxWindow * self, bool enable); bool wxWindow_Show(wxWindow * self, bool show); +#if wxCHECK_VERSION(3, 1, 7) +wxString *wxWindow_GetHelpText(const wxWindow * self); +#endif void wxWindow_SetHelpText(wxWindow * self, const wxString * help_text); wxToolTip * wxWindow_GetToolTip(const wxWindow * self); wxString *wxWindow_GetToolTipText(const wxWindow * self); diff --git a/wx-core/src/generated.cpp b/wx-core/src/generated.cpp index b053dacf..d10c1f83 100644 --- a/wx-core/src/generated.cpp +++ b/wx-core/src/generated.cpp @@ -68,6 +68,11 @@ wxIcon *wxArtProvider_GetIcon(const wxArtID * id, const wxArtClient * client, co wxSize *wxArtProvider_GetNativeSizeHint(const wxArtClient * client) { return new wxSize(wxArtProvider::GetNativeSizeHint(*client)); } +#if wxCHECK_VERSION(3, 1, 7) +wxSize *wxArtProvider_GetSizeHint(const wxArtClient * client, bool platform_default) { + return new wxSize(wxArtProvider::GetSizeHint(*client, platform_default)); +} +#endif bool wxArtProvider_HasNativeProvider() { return wxArtProvider::HasNativeProvider(); } @@ -153,12 +158,25 @@ int wxBitmap_GetWidth(const wxBitmap * self) { bool wxBitmap_IsOk(const wxBitmap * self) { return self->IsOk(); } +#if wxCHECK_VERSION(3, 1, 7) +void wxBitmap_SetDepth(wxBitmap * self, int depth) { + return self->SetDepth(depth); +} +void wxBitmap_SetHeight(wxBitmap * self, int height) { + return self->SetHeight(height); +} +#endif void wxBitmap_SetMask(wxBitmap * self, wxMask * mask) { return self->SetMask(mask); } void wxBitmap_SetPalette(wxBitmap * self, const wxPalette * palette) { return self->SetPalette(*palette); } +#if wxCHECK_VERSION(3, 1, 7) +void wxBitmap_SetWidth(wxBitmap * self, int width) { + return self->SetWidth(width); +} +#endif void wxBitmap_AddHandler(wxBitmapHandler * handler) { return wxBitmap::AddHandler(handler); } @@ -683,6 +701,17 @@ int wxIcon_GetWidth(const wxIcon * self) { bool wxIcon_IsOk(const wxIcon * self) { return self->IsOk(); } +#if wxCHECK_VERSION(3, 1, 7) +void wxIcon_SetDepth(wxIcon * self, int depth) { + return self->SetDepth(depth); +} +void wxIcon_SetHeight(wxIcon * self, int height) { + return self->SetHeight(height); +} +void wxIcon_SetWidth(wxIcon * self, int width) { + return self->SetWidth(width); +} +#endif // CLASS: wxItemContainer void wxItemContainer_delete(wxItemContainer *self) { @@ -1404,6 +1433,11 @@ unsigned int wxRadioBox_GetColumnCount(const wxRadioBox * self) { int wxRadioBox_GetItemFromPoint(const wxRadioBox * self, const wxPoint * pt) { return self->GetItemFromPoint(*pt); } +#if wxCHECK_VERSION(3, 1, 7) +wxString *wxRadioBox_GetItemHelpText(const wxRadioBox * self, unsigned int item) { + return new wxString(self->GetItemHelpText(item)); +} +#endif wxToolTip * wxRadioBox_GetItemToolTip(const wxRadioBox * self, unsigned int item) { return self->GetItemToolTip(item); } @@ -3419,6 +3453,11 @@ bool wxWindow_Enable(wxWindow * self, bool enable) { bool wxWindow_Show(wxWindow * self, bool show) { return self->Show(show); } +#if wxCHECK_VERSION(3, 1, 7) +wxString *wxWindow_GetHelpText(const wxWindow * self) { + return new wxString(self->GetHelpText()); +} +#endif void wxWindow_SetHelpText(wxWindow * self, const wxString * help_text) { return self->SetHelpText(*help_text); } diff --git a/wx-core/src/generated/ffi.rs b/wx-core/src/generated/ffi.rs index caeb9e12..29c9d38e 100644 --- a/wx-core/src/generated/ffi.rs +++ b/wx-core/src/generated/ffi.rs @@ -38,7 +38,7 @@ extern "C" { size: *const c_void, ) -> *mut c_void; pub fn wxArtProvider_GetNativeSizeHint(client: *const c_void) -> *mut c_void; - // BLOCKED: pub fn wxArtProvider_GetSizeHint(client: *const c_void, platform_default: bool) -> wxSize; + pub fn wxArtProvider_GetSizeHint(client: *const c_void, platform_default: bool) -> *mut c_void; // NOT_SUPPORTED: pub fn wxArtProvider_GetIconBundle(id: *const c_void, client: *const c_void) -> wxIconBundle; pub fn wxArtProvider_HasNativeProvider() -> bool; // BLOCKED: pub fn wxArtProvider_Insert(provider: *mut c_void); @@ -88,11 +88,11 @@ extern "C" { pub fn wxBitmap_IsOk(self_: *const c_void) -> bool; // NOT_SUPPORTED: pub fn wxBitmap_LoadFile(self_: *mut c_void, name: *const c_void, type_: wxBitmapType) -> bool; // NOT_SUPPORTED: pub fn wxBitmap_SaveFile(self_: *const c_void, name: *const c_void, type_: wxBitmapType, palette: *const c_void) -> bool; - // BLOCKED: pub fn wxBitmap_SetDepth(self_: *mut c_void, depth: c_int); - // BLOCKED: pub fn wxBitmap_SetHeight(self_: *mut c_void, height: c_int); + pub fn wxBitmap_SetDepth(self_: *mut c_void, depth: c_int); + pub fn wxBitmap_SetHeight(self_: *mut c_void, height: c_int); pub fn wxBitmap_SetMask(self_: *mut c_void, mask: *mut c_void); pub fn wxBitmap_SetPalette(self_: *mut c_void, palette: *const c_void); - // BLOCKED: pub fn wxBitmap_SetWidth(self_: *mut c_void, width: c_int); + pub fn wxBitmap_SetWidth(self_: *mut c_void, width: c_int); pub fn wxBitmap_AddHandler(handler: *mut c_void); pub fn wxBitmap_CleanUpHandlers(); pub fn wxBitmap_FindHandler(name: *const c_void) -> *mut c_void; @@ -578,9 +578,9 @@ extern "C" { pub fn wxIcon_GetWidth(self_: *const c_void) -> c_int; pub fn wxIcon_IsOk(self_: *const c_void) -> bool; // NOT_SUPPORTED: pub fn wxIcon_LoadFile(self_: *mut c_void, name: *const c_void, type_: wxBitmapType, desired_width: c_int, desired_height: c_int) -> bool; - // BLOCKED: pub fn wxIcon_SetDepth(self_: *mut c_void, depth: c_int); - // BLOCKED: pub fn wxIcon_SetHeight(self_: *mut c_void, height: c_int); - // BLOCKED: pub fn wxIcon_SetWidth(self_: *mut c_void, width: c_int); + pub fn wxIcon_SetDepth(self_: *mut c_void, depth: c_int); + pub fn wxIcon_SetHeight(self_: *mut c_void, height: c_int); + pub fn wxIcon_SetWidth(self_: *mut c_void, width: c_int); // BLOCKED: pub fn wxIcon_operator=(self_: *mut c_void, icon: *const c_void) -> *mut c_void; // wxItemContainer @@ -1148,7 +1148,7 @@ extern "C" { pub fn wxRadioBox_Enable(self_: *mut c_void, n: c_uint, enable: bool) -> bool; pub fn wxRadioBox_GetColumnCount(self_: *const c_void) -> c_uint; pub fn wxRadioBox_GetItemFromPoint(self_: *const c_void, pt: *const c_void) -> c_int; - // BLOCKED: pub fn wxRadioBox_GetItemHelpText(self_: *const c_void, item: c_uint) -> wxString; + pub fn wxRadioBox_GetItemHelpText(self_: *const c_void, item: c_uint) -> *mut c_void; pub fn wxRadioBox_GetItemToolTip(self_: *const c_void, item: c_uint) -> *mut c_void; pub fn wxRadioBox_GetRowCount(self_: *const c_void) -> c_uint; pub fn wxRadioBox_IsItemEnabled(self_: *const c_void, n: c_uint) -> bool; @@ -2345,7 +2345,7 @@ extern "C" { pub fn wxWindow_Enable(self_: *mut c_void, enable: bool) -> bool; pub fn wxWindow_Show(self_: *mut c_void, show: bool) -> bool; // NOT_SUPPORTED: pub fn wxWindow_ShowWithEffect(self_: *mut c_void, effect: wxShowEffect, timeout: c_uint) -> bool; - // BLOCKED: pub fn wxWindow_GetHelpText(self_: *const c_void) -> wxString; + pub fn wxWindow_GetHelpText(self_: *const c_void) -> *mut c_void; pub fn wxWindow_SetHelpText(self_: *mut c_void, help_text: *const c_void); // NOT_SUPPORTED: pub fn wxWindow_GetHelpTextAtPoint(self_: *const c_void, point: *const c_void, origin: wxHelpEvent::Origin) -> *mut c_void; pub fn wxWindow_GetToolTip(self_: *const c_void) -> *mut c_void; diff --git a/wx-core/src/generated/methods.rs b/wx-core/src/generated/methods.rs index 17e77de4..6cdf5a63 100644 --- a/wx-core/src/generated/methods.rs +++ b/wx-core/src/generated/methods.rs @@ -118,7 +118,13 @@ pub trait ArtProviderMethods: ObjectMethods { Size::from_ptr(ffi::wxArtProvider_GetNativeSizeHint(client)) } } - // BLOCKED: fn GetSizeHint() + fn get_size_hint(client: &str, platform_default: bool) -> Size { + unsafe { + let client = WxString::from(client); + let client = client.as_ptr(); + Size::from_ptr(ffi::wxArtProvider_GetSizeHint(client, platform_default)) + } + } // NOT_SUPPORTED: fn GetIconBundle() fn has_native_provider() -> bool { unsafe { ffi::wxArtProvider_HasNativeProvider() } @@ -223,15 +229,21 @@ pub trait BitmapMethods: GDIObjectMethods { } // NOT_SUPPORTED: fn LoadFile() // NOT_SUPPORTED: fn SaveFile() - // BLOCKED: fn SetDepth() - // BLOCKED: fn SetHeight() + fn set_depth(&self, depth: c_int) { + unsafe { ffi::wxBitmap_SetDepth(self.as_ptr(), depth) } + } + fn set_height(&self, height: c_int) { + unsafe { ffi::wxBitmap_SetHeight(self.as_ptr(), height) } + } fn set_mask(&self, mask: *mut c_void) { unsafe { ffi::wxBitmap_SetMask(self.as_ptr(), mask) } } fn set_palette(&self, palette: *const c_void) { unsafe { ffi::wxBitmap_SetPalette(self.as_ptr(), palette) } } - // BLOCKED: fn SetWidth() + fn set_width(&self, width: c_int) { + unsafe { ffi::wxBitmap_SetWidth(self.as_ptr(), width) } + } fn add_handler(handler: *mut c_void) { unsafe { ffi::wxBitmap_AddHandler(handler) } } @@ -1207,9 +1219,15 @@ pub trait IconMethods: GDIObjectMethods { unsafe { ffi::wxIcon_IsOk(self.as_ptr()) } } // NOT_SUPPORTED: fn LoadFile() - // BLOCKED: fn SetDepth() - // BLOCKED: fn SetHeight() - // BLOCKED: fn SetWidth() + fn set_depth(&self, depth: c_int) { + unsafe { ffi::wxIcon_SetDepth(self.as_ptr(), depth) } + } + fn set_height(&self, height: c_int) { + unsafe { ffi::wxIcon_SetHeight(self.as_ptr(), height) } + } + fn set_width(&self, width: c_int) { + unsafe { ffi::wxIcon_SetWidth(self.as_ptr(), width) } + } // BLOCKED: fn operator=() } @@ -2641,7 +2659,9 @@ pub trait RadioBoxMethods: ControlMethods { ffi::wxRadioBox_GetItemFromPoint(self.as_ptr(), pt) } } - // BLOCKED: fn GetItemHelpText() + fn get_item_help_text(&self, item: c_uint) -> String { + unsafe { WxString::from_ptr(ffi::wxRadioBox_GetItemHelpText(self.as_ptr(), item)).into() } + } fn get_item_tool_tip(&self, item: c_uint) -> *mut c_void { unsafe { ffi::wxRadioBox_GetItemToolTip(self.as_ptr(), item) } } @@ -6056,7 +6076,9 @@ pub trait WindowMethods: EvtHandlerMethods { unsafe { ffi::wxWindow_Show(self.as_ptr(), show) } } // NOT_SUPPORTED: fn ShowWithEffect() - // BLOCKED: fn GetHelpText() + fn get_help_text(&self) -> String { + unsafe { WxString::from_ptr(ffi::wxWindow_GetHelpText(self.as_ptr())).into() } + } fn set_help_text(&self, help_text: &str) { unsafe { let help_text = WxString::from(help_text); From 1efb75da7dbada1e5b3c998dc0dd27574011e942 Mon Sep 17 00:00:00 2001 From: KENZ Date: Sun, 3 Jul 2022 12:18:26 +0900 Subject: [PATCH 21/21] Reduce redandant diff --- wxrust-config/src/lib.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/wxrust-config/src/lib.rs b/wxrust-config/src/lib.rs index aca3ddbb..5d6d634d 100644 --- a/wxrust-config/src/lib.rs +++ b/wxrust-config/src/lib.rs @@ -6,14 +6,10 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { let cflags = wx_config(&["--cflags"]); // ignore too many warnings with wx3.0 cc_build - .flag("-DNDEBUG") // for Windows - // .flag("-std=c++14") - // .cpp(true) .flag_if_supported("-Wno-deprecated-copy") .flag_if_supported("-Wno-ignored-qualifiers") .flag_if_supported("-Wno-unused-parameter"); for arg in cflags.split_whitespace() { - // cc_build.flag(arg); if arg.starts_with("-I") { cc_build.include(&arg[2..]); } else if arg.starts_with("-D") { @@ -34,9 +30,6 @@ pub fn wx_config_cflags(cc_build: &mut cc::Build) -> &mut cc::Build { pub fn print_wx_config_libs_for_cargo() { // from `wx-config --libs` let libs = wx_config(&["--libs"]); - // for f in libs.split_whitespace() { - // println!("cargo:rustc-flags={}", f); - // } let mut next_is_framework_name = false; for arg in libs.split_whitespace() { if next_is_framework_name {