mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
parent
f27a2b8c74
commit
53775465dc
3 changed files with 37 additions and 9 deletions
|
@ -340,21 +340,30 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
||||||
.with_include("sixtyfps_image.h")
|
.with_include("sixtyfps_image.h")
|
||||||
.with_include("sixtyfps_pathdata.h")
|
.with_include("sixtyfps_pathdata.h")
|
||||||
.with_include("sixtyfps_brush.h")
|
.with_include("sixtyfps_brush.h")
|
||||||
.with_after_include(format!(
|
.with_header(format!(
|
||||||
r"
|
r"
|
||||||
namespace sixtyfps {{
|
#define SIXTYFPS_VERSION_MAJOR {}
|
||||||
namespace private_api {{ enum class VersionCheck {{ Major = {}, Minor = {}, Patch = {} }}; class WindowRc; }}
|
#define SIXTYFPS_VERSION_MINOR {}
|
||||||
namespace cbindgen_private {{
|
#define SIXTYFPS_VERSION_PATCH {}
|
||||||
|
",
|
||||||
|
env!("CARGO_PKG_VERSION_MAJOR"),
|
||||||
|
env!("CARGO_PKG_VERSION_MINOR"),
|
||||||
|
env!("CARGO_PKG_VERSION_PATCH"),
|
||||||
|
))
|
||||||
|
.with_after_include(
|
||||||
|
r"
|
||||||
|
namespace sixtyfps {
|
||||||
|
namespace private_api { class WindowRc; }
|
||||||
|
namespace cbindgen_private {
|
||||||
using sixtyfps::private_api::WindowRc;
|
using sixtyfps::private_api::WindowRc;
|
||||||
using namespace vtable;
|
using namespace vtable;
|
||||||
struct KeyEvent; struct PointerEvent;
|
struct KeyEvent; struct PointerEvent;
|
||||||
using private_api::Property;
|
using private_api::Property;
|
||||||
using private_api::PathData;
|
using private_api::PathData;
|
||||||
using private_api::Point;
|
using private_api::Point;
|
||||||
}}
|
}
|
||||||
}}",
|
}",
|
||||||
env!("CARGO_PKG_VERSION_MAJOR"), env!("CARGO_PKG_VERSION_MINOR"), env!("CARGO_PKG_VERSION_PATCH"),
|
)
|
||||||
))
|
|
||||||
.with_trailer(gen_item_declarations(&items))
|
.with_trailer(gen_item_declarations(&items))
|
||||||
.generate()
|
.generate()
|
||||||
.expect("Unable to generate bindings")
|
.expect("Unable to generate bindings")
|
||||||
|
|
|
@ -42,6 +42,19 @@ struct ItemVTable;
|
||||||
/// \endrst
|
/// \endrst
|
||||||
namespace sixtyfps {
|
namespace sixtyfps {
|
||||||
|
|
||||||
|
// these macro are defined in the generated sixtyfps_internal.h
|
||||||
|
#if defined(DOXYGEN)
|
||||||
|
/// This macro expands to the to the numeric value of the major version of SixtyFPS you're developing against.
|
||||||
|
/// For example if you're using version 1.5.2, this macro will expand to 1.
|
||||||
|
#define SIXTYFPS_VERSION_MAJOR SIXTYFPS_VERSION_MAJOR
|
||||||
|
/// This macro expands to the to the numeric value of the minor version of SixtyFPS you're developing against.
|
||||||
|
/// For example if you're using version 1.5.2, this macro will expand to 5.
|
||||||
|
#define SIXTYFPS_VERSION_MINOR SIXTYFPS_VERSION_MINOR
|
||||||
|
/// This macro expands to the to the numeric value of the patch version of SixtyFPS you're developing against.
|
||||||
|
/// For example if you're using version 1.5.2, this macro will expand to 2.
|
||||||
|
#define SIXTYFPS_VERSION_PATCH SIXTYFPS_VERSION_PATCH
|
||||||
|
#endif
|
||||||
|
|
||||||
// Bring opaque structure in scope
|
// Bring opaque structure in scope
|
||||||
namespace private_api {
|
namespace private_api {
|
||||||
using cbindgen_private::ComponentVTable;
|
using cbindgen_private::ComponentVTable;
|
||||||
|
@ -756,6 +769,12 @@ inline bool operator!=(const StandardListViewItem &a, const StandardListViewItem
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace private_api {
|
namespace private_api {
|
||||||
|
// Code generated by SixtyFPS <= 0.1.5 uses this enum with VersionCheckHelper
|
||||||
|
enum class [[deprecated]] VersionCheck {
|
||||||
|
Major = SIXTYFPS_VERSION_MAJOR,
|
||||||
|
Minor = SIXTYFPS_VERSION_MINOR,
|
||||||
|
Patch = SIXTYFPS_VERSION_PATCH
|
||||||
|
};
|
||||||
template<int Major, int Minor, int Patch>
|
template<int Major, int Minor, int Patch>
|
||||||
struct VersionCheckHelper
|
struct VersionCheckHelper
|
||||||
{
|
{
|
||||||
|
|
|
@ -702,7 +702,7 @@ pub fn generate(doc: &Document, diag: &mut BuildDiagnostics) -> Option<impl std:
|
||||||
env!("CARGO_PKG_VERSION_MINOR"),
|
env!("CARGO_PKG_VERSION_MINOR"),
|
||||||
env!("CARGO_PKG_VERSION_PATCH")),
|
env!("CARGO_PKG_VERSION_PATCH")),
|
||||||
name: "THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME".into(),
|
name: "THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME".into(),
|
||||||
init: Some("sixtyfps::private_api::VersionCheckHelper<int(sixtyfps::private_api::VersionCheck::Major), int(sixtyfps::private_api::VersionCheck::Minor), int(sixtyfps::private_api::VersionCheck::Patch)>()".into()),
|
init: Some("sixtyfps::private_api::VersionCheckHelper<SIXTYFPS_VERSION_MAJOR, SIXTYFPS_VERSION_MINOR, SIXTYFPS_VERSION_PATCH>()".into()),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue