forked from M-Labs/artiq
1
0
Fork 0

libboard: use --cfg

This commit is contained in:
Sebastien Bourdeauducq 2017-01-03 21:39:40 +01:00
parent fbf5a4d4a2
commit 9b4c1ddc8e
3 changed files with 22 additions and 4 deletions

View File

@ -2,6 +2,7 @@
authors = ["M-Labs"] authors = ["M-Labs"]
name = "board" name = "board"
version = "0.0.0" version = "0.0.0"
build = "build.rs"
[lib] [lib]
name = "board" name = "board"

View 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");
}

View File

@ -11,15 +11,15 @@ include!(concat!(env!("BUILDINC_DIRECTORY"), "/generated/csr.rs"));
pub mod spr; pub mod spr;
pub mod irq; pub mod irq;
pub mod clock; pub mod clock;
// XXX #[cfg(has_ad9516)] #[cfg(has_ad9516)]
#[allow(dead_code)] #[allow(dead_code)]
mod ad9516_reg; mod ad9516_reg;
// XXX #[cfg(has_ad9516)] #[cfg(has_ad9516)]
pub mod ad9516; pub mod ad9516;
// XXX #[cfg(has_converter_spi)] #[cfg(has_converter_spi)]
#[allow(dead_code)] #[allow(dead_code)]
mod ad9154_reg; mod ad9154_reg;
// XXX #[cfg(has_converter_spi)] #[cfg(has_converter_spi)]
pub mod ad9154; pub mod ad9154;
extern { extern {