forked from M-Labs/artiq
libboard: use --cfg
This commit is contained in:
parent
fbf5a4d4a2
commit
9b4c1ddc8e
@ -2,6 +2,7 @@
|
||||
authors = ["M-Labs"]
|
||||
name = "board"
|
||||
version = "0.0.0"
|
||||
build = "build.rs"
|
||||
|
||||
[lib]
|
||||
name = "board"
|
||||
|
17
artiq/firmware/libboard/build.rs
Normal file
17
artiq/firmware/libboard/build.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::fs::File;
|
||||
|
||||
fn main() {
|
||||
let out_dir = env::var("BUILDINC_DIRECTORY").unwrap();
|
||||
let cfg_path = Path::new(&out_dir).join("generated").join("rust-cfg");
|
||||
println!("cargo:rerun-if-changed={}", cfg_path.to_str().unwrap());
|
||||
|
||||
let f = BufReader::new(File::open(&cfg_path).unwrap());
|
||||
for line in f.lines() {
|
||||
println!("cargo:rustc-cfg={}", line.unwrap());
|
||||
}
|
||||
|
||||
println!("cargo:rustc-cfg={}", "board");
|
||||
}
|
@ -11,15 +11,15 @@ include!(concat!(env!("BUILDINC_DIRECTORY"), "/generated/csr.rs"));
|
||||
pub mod spr;
|
||||
pub mod irq;
|
||||
pub mod clock;
|
||||
// XXX #[cfg(has_ad9516)]
|
||||
#[cfg(has_ad9516)]
|
||||
#[allow(dead_code)]
|
||||
mod ad9516_reg;
|
||||
// XXX #[cfg(has_ad9516)]
|
||||
#[cfg(has_ad9516)]
|
||||
pub mod ad9516;
|
||||
// XXX #[cfg(has_converter_spi)]
|
||||
#[cfg(has_converter_spi)]
|
||||
#[allow(dead_code)]
|
||||
mod ad9154_reg;
|
||||
// XXX #[cfg(has_converter_spi)]
|
||||
#[cfg(has_converter_spi)]
|
||||
pub mod ad9154;
|
||||
|
||||
extern {
|
||||
|
Loading…
Reference in New Issue
Block a user