mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Build bitcode with zig 🎉
This commit is contained in:
parent
4502471e9a
commit
242eb6f905
17 changed files with 1365 additions and 88 deletions
18
compiler/builtins/src/bitcode.rs
Normal file
18
compiler/builtins/src/bitcode.rs
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue