Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Cargo feature flags #51

Merged
merged 3 commits into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ struct Build {
#[structopt(long)]
release: bool,

/// Enable build feature flags.
#[structopt(long)]
features: Vec<String>,

/// Build a specific example from the examples/ dir.
#[structopt(long)]
example: Option<String>,
Expand Down Expand Up @@ -636,6 +640,12 @@ impl Build {
args.push("--release");
}

let features;
if !self.features.is_empty() {
features = format!("--features={}", self.features.join(","));
args.push(&features);
}

if self.device {
args.push("--target");
args.push("thumbv7em-none-eabihf");
Expand Down Expand Up @@ -784,6 +794,10 @@ struct Package {
#[structopt(long)]
example: Option<String>,

/// Enable build feature flags.
#[structopt(long)]
features: Vec<String>,

/// clean before building
#[structopt(long)]
clean: bool,
Expand Down Expand Up @@ -813,6 +827,7 @@ impl Package {
let device_build = Build {
device: true,
example: self.example.clone(),
features: self.features.clone(),
release: true,
run: false,
};
Expand All @@ -821,6 +836,7 @@ impl Package {
let sim_build = Build {
device: false,
example: self.example.clone(),
features: self.features.clone(),
release: true,
run: false,
};
Expand Down
Loading