Skip to content

Commit

Permalink
add frozen abi requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalojoec committed Apr 4, 2024
1 parent 34659d6 commit 27bbb69
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ bpf-entrypoint = []
test-sbf = []

[dependencies]
bincode = "1.3.3"
log = "0.4.20"
serde = { version = "1.0.193", features = ["derive"] }
solana-frozen-abi-macro = "1.18.2"
solana-frozen-abi = "1.18.2"
solana-program = "1.18.2"

[lib]
crate-type = ["cdylib", "lib"]

[build-dependencies]
rustc_version = "0.4"
23 changes: 23 additions & 0 deletions program/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! Required for `solana-frozen-abi-macro` to work.
extern crate rustc_version;
use rustc_version::{version_meta, Channel};

fn main() {
// Copied and adapted from
// https://github.com/Kimundi/rustc-version-rs/blob/1d692a965f4e48a8cb72e82cda953107c0d22f47/README.md#example
// Licensed under Apache-2.0 + MIT
match version_meta().unwrap().channel {
Channel::Stable => {
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
}
Channel::Beta => {
println!("cargo:rustc-cfg=RUSTC_WITHOUT_SPECIALIZATION");
}
Channel::Nightly => {
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION");
}
Channel::Dev => {
println!("cargo:rustc-cfg=RUSTC_WITH_SPECIALIZATION");
}
}
}
3 changes: 3 additions & 0 deletions program/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//! Vote Program.
// [Core BPF]: Required for `solana-frozen-abi-macro` to work.
#![allow(incomplete_features)]
#![cfg_attr(RUSTC_WITH_SPECIALIZATION, feature(specialization))]

#[cfg(all(target_os = "solana", feature = "bpf-entrypoint"))]
mod entrypoint;
Expand Down

0 comments on commit 27bbb69

Please sign in to comment.