Skip to content

Commit

Permalink
Merge pull request #51 from parasyte/feature/feature-flags
Browse files Browse the repository at this point in the history
Add support for Cargo feature flags
  • Loading branch information
boozook authored Sep 13, 2023
2 parents 7eea747 + 0413c11 commit 8c77385
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit 8c77385

Please sign in to comment.