-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cairo_native): make the starknet-native-compile crate a part of…
… the workspace
- Loading branch information
1 parent
a3d8940
commit b3f6e8e
Showing
8 changed files
with
152 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
[package] | ||
name = "starknet-native-compile" | ||
# The version of this crate should equal the version of cairo-native. | ||
version = "0.2.5" | ||
edition = "2021" | ||
repository = "https://github.com/starkware-libs/sequencer/" | ||
license = "Apache-2.0" | ||
# Make sure this version equals the version of `cairo-native`. | ||
version.workspace = true | ||
edition.workspace = true | ||
repository.workspace = true | ||
license-file.workspace = true | ||
description = "A binary that compiles Sierra into Cairo native." | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[features] | ||
cairo_native = [ | ||
"dep:cairo-lang-sierra", | ||
"dep:cairo-lang-starknet-classes", | ||
"dep:cairo-native", | ||
"dep:clap", | ||
"dep:serde_json", | ||
] | ||
|
||
[dependencies] | ||
# TODO(Avi, 01/02/2025): Check consistency with the blockifier. | ||
cairo-lang-sierra = "2.10.0-rc.1" | ||
cairo-lang-starknet-classes = "2.10.0-rc.1" | ||
cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "981093a" } | ||
clap = { version = "4.5.4", features = ["derive"] } | ||
serde_json = "1.0.116" | ||
cairo-lang-sierra = { workspace = true, optional = true } | ||
cairo-lang-starknet-classes = { workspace = true, optional = true } | ||
cairo-native = { workspace = true, optional = true } | ||
clap = { workspace = true, optional = true } | ||
serde_json = { workspace = true, optional = true } | ||
|
||
[build-dependencies] | ||
cargo_metadata.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#[cfg(feature = "cairo_native")] | ||
use cargo_metadata::{CargoOpt, MetadataCommand}; | ||
|
||
#[cfg(feature = "cairo_native")] | ||
fn main() { | ||
let cairo_native_version = find_cairo_native_version(); | ||
println!("cargo:rustc-env=DEP_CAIRO_NATIVE_VERSION={}", cairo_native_version); | ||
} | ||
|
||
#[cfg(feature = "cairo_native")] | ||
fn find_cairo_native_version() -> String { | ||
let target_package_name = "cairo-native"; | ||
|
||
// Query Cargo for the actual resolved metadata | ||
let metadata = MetadataCommand::new() | ||
.features(CargoOpt::SomeFeatures(vec!["cairo_native".into()])) | ||
.exec() | ||
.unwrap_or_else(|err| { | ||
eprintln!("Failed to read Cargo metadata: {}", err); | ||
std::process::exit(1); | ||
}); | ||
|
||
// Find the package in the resolved graph | ||
let package = metadata.packages.iter().find(|package| package.name == target_package_name); | ||
|
||
package.expect("Could not find cairo-native package in Cargo metadata").version.to_string() | ||
} | ||
|
||
#[cfg(not(feature = "cairo_native"))] | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters