Skip to content

Commit

Permalink
Radically simplify the generated Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Oct 26, 2024
1 parent be0a352 commit 58d1799
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 44 deletions.
17 changes: 4 additions & 13 deletions cargo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,13 @@ debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

[features]
{%- if std %}
default = ["std", "embassy", "esp-idf-svc/native"]
{%- else %}
default = ["alloc", "embassy", "esp-idf-svc/native", "esp-idf-svc/panic_handler", "esp-idf-svc/alloc_handler", "esp-idf-svc/libstart"]
{%- endif %}
default = []

pio = ["esp-idf-svc/pio"]
std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"]
alloc = ["esp-idf-svc/alloc"]
nightly = ["esp-idf-svc/nightly"]
experimental = ["esp-idf-svc/experimental"]
embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"]

[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.49", default-features = false }
log = "0.4"
esp-idf-svc = { version = "0.49", features = ["critical-section", "embassy-time-driver", "embassy-sync"] }

[build-dependencies]
embuild = "0.32.0"
embuild = "0.32.0"
17 changes: 1 addition & 16 deletions cmake/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
[template]
cargo_generate_version = ">=0.17.4"

[placeholders.advanced]
type = "bool"
prompt = "Configure advanced template options?"
default = false

[conditional.'advanced'.placeholders.toolchain]
[placeholders.toolchain]
type = "string"
prompt = "Rust toolchain (beware: nightly works only for riscv MCUs!)"
choices = ["esp", "nightly"]
default = "esp"

[conditional.'advanced'.placeholders.hal]
type = "bool"
prompt = "Enable HAL support?"
default = true

[conditional.'advanced'.placeholders.std]
type = "bool"
prompt = "Enable STD support?"
default = true
18 changes: 3 additions & 15 deletions cmake/components/rust-{{project-name}}/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,13 @@ opt-level = "s"
debug = true # Symbols are nice and they don't increase the size on Flash
opt-level = "z"

{%- if hal %}
[features]
{%- if std %}
default = ["std", "embassy", "esp-idf-svc/native"]
{%- else %}
default = ["alloc", "embassy", "esp-idf-svc/native", "esp-idf-svc/panic_handler", "esp-idf-svc/alloc_handler"]
{%- endif %}

pio = ["esp-idf-svc/pio"]
std = ["alloc", "esp-idf-svc/std"]
alloc = ["esp-idf-svc/alloc"]
nightly = ["esp-idf-svc/nightly"]
default = []
experimental = ["esp-idf-svc/experimental"]
embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"]

[dependencies]
log = { version = "0.4", default-features = false }
esp-idf-svc = { version = "0.49", default-features = false }
log = "0.4"
esp-idf-svc = { version = "0.49", default-features = false, features = ["std", "critical-section", "embassy-time-driver", "embassy-sync"] }

[build-dependencies]
embuild = "0.32.0"
{%- endif %}

0 comments on commit 58d1799

Please sign in to comment.