From 850a18409900b0c1bd764bd328b6ab902b978a59 Mon Sep 17 00:00:00 2001 From: Frederick Vollbrecht Date: Tue, 2 Jul 2024 13:43:59 +0200 Subject: [PATCH] Add QoL config features in advanced cargo options - option to use git HEAD versions of esp-idf-* crates - option to change between global and local install for ESP-IDF --- cargo/.cargo/config.toml | 9 +++++++++ cargo/Cargo.toml | 10 +++++++++- cargo/cargo-generate.toml | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/cargo/.cargo/config.toml b/cargo/.cargo/config.toml index e749ecb..d929fb4 100644 --- a/cargo/.cargo/config.toml +++ b/cargo/.cargo/config.toml @@ -25,3 +25,12 @@ ESP_IDF_VERSION = "master" {% endif %} # Workaround for https://github.com/esp-rs/esp-idf-template/issues/174 CRATE_CC_NO_DEFAULTS = "1" + +# Set the install location for the ESP-IDF framework tooling. +{%- if installdir == "workspace - per project (inside .embuild)" %} +ESP_IDF_TOOLS_INSTALL_DIR = "workspace" +{% elsif installdir == "global - per user (inside $HOME/.espressif)" %} +ESP_IDF_TOOLS_INSTALL_DIR = "global" +{% endif %} + +# For more ESP-IDF specific build options check out https://github.com/esp-rs/esp-idf-sys/blob/master/BUILD-OPTIONS.md \ No newline at end of file diff --git a/cargo/Cargo.toml b/cargo/Cargo.toml index b939f2b..bcf3d3a 100644 --- a/cargo/Cargo.toml +++ b/cargo/Cargo.toml @@ -36,4 +36,12 @@ log = { version = "0.4", default-features = false } esp-idf-svc = { version = "0.49", default-features = false } [build-dependencies] -embuild = "0.32.0" \ No newline at end of file +embuild = "0.32.0" + +{%- if git %} + +[patch.crates-io] +esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys"} +esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf-hal"} +esp-idf-svc = { git = "https://github.com/esp-rs/esp-idf-svc"} +{%- endif %} \ No newline at end of file diff --git a/cargo/cargo-generate.toml b/cargo/cargo-generate.toml index a42a000..0702247 100644 --- a/cargo/cargo-generate.toml +++ b/cargo/cargo-generate.toml @@ -42,6 +42,17 @@ type = "bool" prompt = "Add CI files for GitHub Action?" default = false +[conditional.'advanced'.placeholders.installdir] +type = "string" +prompt = "Set installation dir of managed ESP-IDF version" +choices = ["workspace - per project (inside .embuild)", "global - per user (inside $HOME/.espressif)"] +default = "workspace - per project (inside .embuild)" + +[conditional.'advanced'.placeholders.git] +type = "bool" +prompt = "Use latest git versions of esp-idf-* crates, instead of released crates.io versions" +default = false + [conditional.'!devcontainer'] ignore = [ ".devcontainer/",