-
Notifications
You must be signed in to change notification settings - Fork 122
/
native.rs
39 lines (34 loc) · 1.37 KB
/
native.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Install tools and build the `esp-idf` using native tooling.
#![cfg_attr(feature = "pio", allow(unused))]
use super::common::EspIdfBuildOutput;
use anyhow::Result;
use std::env;
/// The name of the tools sub-directory.
pub const TOOLS_DIR: &str = "espressif";
pub fn build() -> Result<EspIdfBuildOutput> {
if env::var_os(cmake_driver::CARGO_CMAKE_BUILD_ACTIVE_VAR).is_some()
|| env::var_os(cmake_driver::CARGO_CMAKE_BUILD_INCLUDES_VAR).is_some()
{
cmake_driver::build()
} else {
cargo_driver::build()
}
}
/// The root rust crate is a component in an esp-idf project, the esp-idf is built
/// externally by cmake.
///
/// We only need to generate the esp-idf bindings and don't need to compile the esp-idf.
///
/// See
/// [esp-idf-template/README-cmake](https://github.com/esp-rs/esp-idf-template/blob/master/README-cmake.md)
/// for how to setup such a project.
pub mod cmake_driver;
/// The root rust crate is the entry-point, the esp-idf should be compiled by the build script.
///
/// This module does the heavy-lifting of compiling the esp-idf and generating the
/// bindings to it. This process is heavily configurable (see <https://github.com/esp-rs/esp-idf-sys#configuration>).
///
/// See
/// [esp-idf-template/README](https://github.com/esp-rs/esp-idf-template/blob/master/README.md)
/// for how to setup such a project.
pub mod cargo_driver;