2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

firmware: deduplicate libbuild_misoc and libbuild_artiq.

This commit is contained in:
whitequark 2017-12-28 12:57:40 +00:00
parent 8153cfa88f
commit b9754e7108
9 changed files with 18 additions and 25 deletions

View File

@ -126,7 +126,7 @@ dependencies = [
"alloc_stub 0.0.0",
"amp 0.0.0",
"board 0.0.0",
"build_artiq 0.0.0",
"build_misoc 0.0.0",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.0 (git+https://github.com/m-labs/compiler-builtins?rev=97916b1)",
"cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -185,6 +185,7 @@ dependencies = [
"board 0.0.0",
"board_artiq 0.0.0",
"build_artiq 0.0.0",
"build_misoc 0.0.0",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.0 (git+https://github.com/m-labs/compiler-builtins?rev=97916b1)",
"cslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -10,7 +10,7 @@ path = "lib.rs"
crate-type = ["staticlib"]
[build-dependencies]
build_artiq = { path = "../libbuild_artiq" }
build_misoc = { path = "../libbuild_misoc" }
[dependencies]
byteorder = { version = "1.0", default-features = false }

View File

@ -1,6 +1,6 @@
extern crate build_artiq;
extern crate build_misoc;
fn main() {
build_artiq::misoc_cfg();
build_misoc::cfg();
println!("cargo:rustc-cfg={}", "ksupport");
}

View File

@ -1,10 +1,9 @@
extern crate build_misoc;
extern crate build_artiq;
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::path::Path;
use std::process::Command;
fn gen_hmc7043_writes() {
@ -19,8 +18,8 @@ fn gen_hmc7043_writes() {
.ok()
.and_then(|o| String::from_utf8(o.stdout).ok())
.unwrap();
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let mut f = File::create(out_dir.join("hmc7043_writes.rs")).unwrap();
let out_dir = env::var("OUT_DIR").unwrap();
let mut f = File::create(Path::new(&out_dir).join("hmc7043_writes.rs")).unwrap();
write!(f, "{}", hmc7043_writes).unwrap();
}

View File

@ -2,8 +2,8 @@ extern crate walkdir;
use std::env;
use std::fs::File;
use std::io::{Write, BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::io::Write;
use std::path::Path;
use std::process::Command;
use walkdir::WalkDir;
@ -42,18 +42,7 @@ pub fn git_describe() {
version = "unknown".to_owned();
}
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let mut f = File::create(out_dir.join("git-describe")).unwrap();
let out_dir = env::var("OUT_DIR").unwrap();
let mut f = File::create(Path::new(&out_dir).join("git-describe")).unwrap();
write!(f, "{}", version).unwrap();
}
pub fn misoc_cfg() {
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());
}
}

View File

@ -10,6 +10,7 @@ crate-type = ["staticlib"]
path = "main.rs"
[build-dependencies]
build_misoc = { path = "../libbuild_misoc" }
build_artiq = { path = "../libbuild_artiq" }
[dependencies]

View File

@ -1,6 +1,7 @@
extern crate build_misoc;
extern crate build_artiq;
fn main() {
build_misoc::cfg();
build_artiq::git_describe();
build_artiq::misoc_cfg();
}

View File

@ -10,6 +10,7 @@ crate-type = ["staticlib"]
path = "main.rs"
[build-dependencies]
build_misoc = { path = "../libbuild_misoc" }
build_artiq = { path = "../libbuild_artiq" }
[dependencies]

View File

@ -1,6 +1,7 @@
extern crate build_misoc;
extern crate build_artiq;
fn main() {
build_misoc::cfg();
build_artiq::git_describe();
build_artiq::misoc_cfg();
}