Build bitcode with zig 🎉

This commit is contained in:
Jared Ramirez 2020-10-25 14:50:31 -07:00
parent 4502471e9a
commit 242eb6f905
17 changed files with 1365 additions and 88 deletions

View file

@ -0,0 +1,18 @@
use std::fs::File;
use std::io::prelude::Read;
use std::vec::Vec;
pub fn get_bytes() -> Vec<u8> {
// In the build script for the gen module, we compile the builtins bitcode and set
// BUILTINS_BC to the path to the compiled output.
let path: &'static str = env!(
"BUILTINS_BC",
"Env var BUILTINS_BC not found. Is there a problem with the build script?"
);
let mut builtins_bitcode = File::open(path).expect("Unable to find builtins bitcode source");
let mut buffer = Vec::new();
builtins_bitcode
.read_to_end(&mut buffer)
.expect("Unable to read builtins bitcode");
buffer
}