2019-08-18 19:45:47 -04:00
|
|
|
extern crate capnpc;
|
|
|
|
|
|
|
|
use std::path::Path;
|
2019-09-02 22:40:56 -04:00
|
|
|
use std::process::Command;
|
2019-08-18 19:45:47 -04:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
capnpc::CompilerCommand::new()
|
|
|
|
.src_prefix("")
|
|
|
|
.file("marketdata.capnp")
|
|
|
|
.output_path("src/")
|
2019-08-24 22:49:07 -04:00
|
|
|
.run()
|
|
|
|
.expect("Unable to compile capnpc");
|
2019-08-18 19:45:47 -04:00
|
|
|
|
|
|
|
flatc_rust::run(flatc_rust::Args {
|
|
|
|
inputs: &[Path::new("marketdata.fbs")],
|
|
|
|
out_dir: Path::new("src/"),
|
|
|
|
..Default::default()
|
2019-09-06 22:23:46 -04:00
|
|
|
})
|
|
|
|
.expect("Unable to compile flatc");
|
2019-09-02 22:40:56 -04:00
|
|
|
|
|
|
|
// There's no Rust-style builder crate for SBE,
|
|
|
|
// so we need to run the command by hand.
|
|
|
|
// TODO: Automatically download the SBE JAR?
|
|
|
|
let _output = Command::new("java")
|
|
|
|
.arg("-Dsbe.output.dir=src")
|
|
|
|
.arg("-Dsbe.xinclude.aware=true")
|
|
|
|
.arg("-Dsbe.target.language=uk.co.real_logic.sbe.generation.rust.Rust")
|
|
|
|
.arg("-Dsbe.target.namespace=marketdata_sbe")
|
2019-09-06 22:23:46 -04:00
|
|
|
.arg("-jar")
|
|
|
|
.arg("sbe-all-1.13.2-all.jar")
|
2019-09-02 22:40:56 -04:00
|
|
|
.arg("marketdata.xml")
|
|
|
|
.output()
|
|
|
|
.expect("Unable to execute SBE compiler");
|
2019-08-24 22:49:07 -04:00
|
|
|
}
|