Skip to content

Commit

Permalink
Merge pull request #90 from kenz-gelsoft/use_binary_crate
Browse files Browse the repository at this point in the history
WIP: Use binary crate
  • Loading branch information
kenz-gelsoft authored Jul 3, 2022
2 parents 4b9a1fd + 1efb75d commit 48c223a
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.'cfg(target_os = "macos")']
rustflags = "-C link-arg=-fapple-link-rtlib"
21 changes: 21 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,24 @@ jobs:
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
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 --features vendored
- name: Run tests
run: cargo test --verbose --features vendored
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions doxybindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,20 @@ 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',
]
[types.wxBitmapButton]
wx31 = [
'CreateCloseButton',
Expand All @@ -89,6 +96,12 @@ blocklist = [
# doesn't support returning wxList
'GetHandlers',
]
wx317 = [
# Doc isn't up-to-date in wx3.1.6
'SetDepth',
'SetHeight',
'SetWidth',
]
wx31 = [
'wxBitmap8',
]
Expand Down Expand Up @@ -188,6 +201,12 @@ blocklist = [
blocklist = [
'operator=',
]
wx317 = [
# Doc isn't up-to-date in wx3.1.6
'SetDepth',
'SetHeight',
'SetWidth',
]
[types.wxItemContainer]
blocklist = [
# std::vector<T> is not supported
Expand Down Expand Up @@ -293,6 +312,11 @@ blocklist = [
'operator/=',
'operator*=',
]
[types.wxRadioBox]
wx317 = [
# Doc isn't up-to-date in wx3.1.6
'GetItemHelpText',
]
[types.wxRect]
blocklist = [
'operator==',
Expand Down Expand Up @@ -411,6 +435,10 @@ blocklist = [
'GetCursor',
'GetUpdateRegion',
]
wx317 = [
# Doc isn't up-to-date in wx3.1.6
'GetHelpText',
]
not_gtk = [
'RegisterHotKey',
'UnregisterHotKey',
Expand Down
9 changes: 5 additions & 4 deletions doxybindgen/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '}'
Expand Down
3 changes: 2 additions & 1 deletion doxybindgen/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion samples/hello/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ edition = "2021"
[dependencies]
wx-base = { path = "../../wx-base" }
wx = { path = "../../wx-core" }

1 change: 0 additions & 1 deletion samples/minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ edition = "2021"
[dependencies]
wx-base = { path = "../../wx-base" }
wx = { path = "../../wx-core" }

1 change: 0 additions & 1 deletion samples/widgets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ edition = "2021"
[dependencies]
wx-base = { path = "../../wx-base" }
wx = { path = "../../wx-core" }

1 change: 0 additions & 1 deletion samples/wrapsizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ edition = "2021"
[dependencies]
wx-base = { path = "../../wx-base" }
wx = { path = "../../wx-core" }

17 changes: 17 additions & 0 deletions wx-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
vendored = [
"wxrust-config/vendored",
"dep:wx-universal-apple-darwin",
"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-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" }
17 changes: 17 additions & 0 deletions wx-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,26 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
vendored = [
"wxrust-config/vendored",
"dep:wx-universal-apple-darwin",
"dep:wx-x86_64-pc-windows-gnu",
"dep:wx-x86_64-pc-windows-msvc",
]

[dependencies]
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-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" }
24 changes: 18 additions & 6 deletions wx-core/include/generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +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);
Expand Down Expand Up @@ -65,11 +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__
Expand Down Expand Up @@ -278,9 +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);
Expand Down Expand Up @@ -450,7 +458,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);
Expand Down Expand Up @@ -550,7 +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);
Expand Down Expand Up @@ -770,7 +780,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);
Expand All @@ -783,7 +793,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);
Expand All @@ -794,7 +804,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);
Expand Down Expand Up @@ -873,7 +883,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);
Expand Down Expand Up @@ -1072,7 +1082,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);
Expand Down Expand Up @@ -1264,7 +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);
Expand Down
Loading

0 comments on commit 48c223a

Please sign in to comment.