1 unstable release
new 0.1.0 | May 8, 2025 |
---|
#949 in GUI
Used in wxdragon
285KB
5K
SLoC
wxdragon-sys
This crate provides raw FFI (Foreign Function Interface) bindings to libwxdragon
, a C++ library that wraps parts of the wxWidgets cross-platform GUI toolkit. libwxdragon
itself is built and statically linked by this crate during its build process, and it includes a vendored version of wxWidgets.
Purpose
wxdragon-sys
is the unsafe foundation upon which the safe Rust abstractions in the wxdragon
crate are built. It is not typically used directly by end-users but rather as a dependency for higher-level crates aiming to use wxWidgets functionality from Rust.
Features
- Raw,
unsafe
bindings to the C API exposed bylibwxdragon
. - Build script that compiles and links
libwxdragon
and its vendored wxWidgets. - The
links = "wxdragon"
directive inCargo.toml
ensures proper linking and allows other crates to discover build metadata.
Build Process
The build process (build.rs
) for this crate performs the following key steps:
- Downloads wxWidgets: Fetches the wxWidgets 3.2.4 source tarball.
- Extracts wxWidgets: Decompresses and extracts the sources.
- Builds wxWidgets: Compiles wxWidgets as a static library using CMake.
- Builds libwxdragon: Compiles the
wxdragon
C++ wrapper code (found in thesrc
directory of the main project) which links against the just-built wxWidgets. This also becomes a static library. - Generates Bindings: Uses
bindgen
to generate Rust FFI bindings from theinclude/wxdragon.h
header file.
Usage
This crate is intended to be used as a dependency in your Cargo.toml
:
[dependencies]
wxdragon-sys = "0.1.0" # Replace with the desired version from crates.io
Direct interaction with this crate involves unsafe
calls to C functions. For a safer, more idiomatic Rust experience, consider using the wxdragon
crate.
Related Crates
wxdragon
: Safe, idiomatic Rust wrappers for wxWidgets, built on top of this-sys
crate.
License
This crate is licensed under the terms of the MIT license OR the Apache License 2.0 (see LICENSE-MIT
and LICENSE-APACHE
files in the workspace root).
The vendored wxWidgets library is distributed under its own wxWindows Library Licence.
Dependencies
~0–4MB
~69K SLoC