From 36581cf4143cdbb9a0aab1c4bcad48b757157820 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Fri, 11 Dec 2020 10:59:03 +0100 Subject: [PATCH] feat(c-api) Add the `WASMER_VERSION_{MAJOR|MINOR|PATCH|PRE}` constants in C. --- lib/c-api/build.rs | 12 ++++++++++-- lib/c-api/wasmer.h | 4 ++++ lib/c-api/wasmer.hh | 4 ++++ lib/c-api/wasmer_wasm.h | 4 ++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/c-api/build.rs b/lib/c-api/build.rs index fb29331ed8d..9726384c96c 100644 --- a/lib/c-api/build.rs +++ b/lib/c-api/build.rs @@ -205,9 +205,17 @@ fn add_wasmer_version(pre_header: &mut String) { pre_header.push_str(&format!( r#" // This file corresponds to the following Wasmer version. -#define WASMER_VERSION "{version}" +#define WASMER_VERSION "{full}" +#define WASMER_VERSION_MAJOR "{major}" +#define WASMER_VERSION_MINOR "{minor}" +#define WASMER_VERSION_PATCH "{patch}" +#define WASMER_VERSION_PRE "{pre}" "#, - version = env!("CARGO_PKG_VERSION") + full = env!("CARGO_PKG_VERSION"), + major = env!("CARGO_PKG_VERSION_MAJOR"), + minor = env!("CARGO_PKG_VERSION_MINOR"), + patch = env!("CARGO_PKG_VERSION_PATCH"), + pre = env!("CARGO_PKG_VERSION_PRE"), )); } diff --git a/lib/c-api/wasmer.h b/lib/c-api/wasmer.h index 771a87edd56..3db6c59a12d 100644 --- a/lib/c-api/wasmer.h +++ b/lib/c-api/wasmer.h @@ -33,6 +33,10 @@ // This file corresponds to the following Wasmer version. #define WASMER_VERSION "1.0.0-beta1" +#define WASMER_VERSION_MAJOR "1" +#define WASMER_VERSION_MINOR "0" +#define WASMER_VERSION_PATCH "0" +#define WASMER_VERSION_PRE "beta1" #endif // WASMER_H_PRELUDE diff --git a/lib/c-api/wasmer.hh b/lib/c-api/wasmer.hh index 83edd2dc370..b31f7a7b43a 100644 --- a/lib/c-api/wasmer.hh +++ b/lib/c-api/wasmer.hh @@ -33,6 +33,10 @@ // This file corresponds to the following Wasmer version. #define WASMER_VERSION "1.0.0-beta1" +#define WASMER_VERSION_MAJOR "1" +#define WASMER_VERSION_MINOR "0" +#define WASMER_VERSION_PATCH "0" +#define WASMER_VERSION_PRE "beta1" #endif // WASMER_H_PRELUDE diff --git a/lib/c-api/wasmer_wasm.h b/lib/c-api/wasmer_wasm.h index e27330c73f7..b32e3336e26 100644 --- a/lib/c-api/wasmer_wasm.h +++ b/lib/c-api/wasmer_wasm.h @@ -40,6 +40,10 @@ // This file corresponds to the following Wasmer version. #define WASMER_VERSION "1.0.0-beta1" +#define WASMER_VERSION_MAJOR "1" +#define WASMER_VERSION_MINOR "0" +#define WASMER_VERSION_PATCH "0" +#define WASMER_VERSION_PRE "beta1" #endif // WASMER_WASM_H_PRELUDE