forked from M-Labs/artiq
1
0
Fork 0

firmware: fix embedding of software version during build.

This commit is contained in:
whitequark 2017-01-26 17:40:18 +00:00
parent 31e5f9a810
commit b7f6bfffeb
3 changed files with 9 additions and 3 deletions

View File

@ -2,7 +2,7 @@ extern crate walkdir;
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::{BufRead, BufReader}; use std::io::{Write, BufRead, BufReader};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -27,6 +27,12 @@ pub fn git_describe() {
.unwrap(); .unwrap();
let id = id.split("-").collect::<Vec<_>>(); let id = id.split("-").collect::<Vec<_>>();
let id = format!("{}+{}.{}", id[0], id[1], id[2]); let id = format!("{}+{}.{}", id[0], id[1], id[2]);
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("git-describe");
let mut f = File::create(&dest_path).unwrap();
f.write(id.as_bytes()).unwrap();
println!("cargo:rust-cfg=git_describe={:?}", id); println!("cargo:rust-cfg=git_describe={:?}", id);
println!("cargo:rerun-if-changed=../../../.git/HEAD"); println!("cargo:rerun-if-changed=../../../.git/HEAD");

View File

@ -60,7 +60,7 @@ mod analyzer;
fn startup() { fn startup() {
board::clock::init(); board::clock::init();
info!("ARTIQ runtime starting..."); info!("ARTIQ runtime starting...");
info!("software version {}", cfg!(git_describe)); info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe")));
info!("gateware version {}", board::ident(&mut [0; 64])); info!("gateware version {}", board::ident(&mut [0; 64]));
let t = board::clock::get_ms(); let t = board::clock::get_ms();

View File

@ -11,7 +11,7 @@ extern crate board;
fn startup() { fn startup() {
board::clock::init(); board::clock::init();
info!("ARTIQ satellite manager starting..."); info!("ARTIQ satellite manager starting...");
info!("software version {}", cfg!(git_describe)); info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe")));
info!("gateware version {}", board::ident(&mut [0; 64])); info!("gateware version {}", board::ident(&mut [0; 64]));
loop {} loop {}