Rename C++ pre-processor macros

This commit is contained in:
Simon Hausmann 2022-02-02 11:17:40 +01:00
parent 96d87b1c16
commit 5226feab01
4 changed files with 10 additions and 11 deletions

View file

@ -46,8 +46,8 @@ fn default_config() -> cbindgen::Config {
..Default::default()
},
defines: [
("target_pointer_width = 64".into(), "SIXTYFPS_TARGET_64".into()),
("target_pointer_width = 32".into(), "SIXTYFPS_TARGET_32".into()),
("target_pointer_width = 64".into(), "SLINT_TARGET_64".into()),
("target_pointer_width = 32".into(), "SLINT_TARGET_32".into()),
]
.iter()
.cloned()
@ -323,13 +323,13 @@ fn gen_corelib(
r"
/// 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 {}
#define SLINT_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 {}
#define SLINT_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 {}
#define SLINT_VERSION_PATCH {}
",
env!("CARGO_PKG_VERSION_MAJOR"),
env!("CARGO_PKG_VERSION_MINOR"),

View file

@ -847,9 +847,8 @@ cbindgen_private::NativeStyleMetrics::~NativeStyleMetrics()
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 };
enum class [[deprecated]] VersionCheck { Major = SLINT_VERSION_MAJOR, Minor = SLINT_VERSION_MINOR,
Patch = SLINT_VERSION_PATCH };
template<int Major, int Minor, int Patch>
struct VersionCheckHelper
{

View file

@ -6,9 +6,9 @@
#include <cstdint>
#if UINTPTR_MAX == 0xFFFFFFFF
# define SIXTYFPS_TARGET_32
# define SLINT_TARGET_32
#elif UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFu
# define SIXTYFPS_TARGET_64
# define SLINT_TARGET_64
#endif
#if !defined(DOXYGEN)

View file

@ -557,7 +557,7 @@ pub fn generate(doc: &Document) -> impl std::fmt::Display {
env!("CARGO_PKG_VERSION_MINOR"),
env!("CARGO_PKG_VERSION_PATCH")),
name: "THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME".into(),
init: Some("sixtyfps::private_api::VersionCheckHelper<SIXTYFPS_VERSION_MAJOR, SIXTYFPS_VERSION_MINOR, SIXTYFPS_VERSION_PATCH>()".into()),
init: Some("sixtyfps::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>()".into()),
..Default::default()
}));