Only include_bytes when actually building

This commit is contained in:
Richard Feldman 2021-06-06 00:51:17 -04:00
parent 9eee9df29b
commit 5b91de40db
2 changed files with 3 additions and 7 deletions

View File

@ -3,12 +3,6 @@ pub const OBJ_PATH: &str = env!(
"Env var BUILTINS_O not found. Is there a problem with the build script?"
);
pub fn as_bytes() -> &'static [u8] {
// In the build script for the builtins module,
// we compile the builtins into LLVM bitcode
include_bytes!("../bitcode/builtins.bc")
}
pub const NUM_ASIN: &str = "roc_builtins.num.asin";
pub const NUM_ACOS: &str = "roc_builtins.num.acos";
pub const NUM_ATAN: &str = "roc_builtins.num.atan";

View File

@ -341,7 +341,9 @@ impl<'a, 'ctx, 'env> Env<'a, 'ctx, 'env> {
}
pub fn module_from_builtins<'ctx>(ctx: &'ctx Context, module_name: &str) -> Module<'ctx> {
let bitcode_bytes = bitcode::as_bytes();
// In the build script for the builtins module,
// we compile the builtins into LLVM bitcode
let bitcode_bytes: &[u8] = include_bytes!("../../../builtins/bitcode/builtins.bc");
let memory_buffer = MemoryBuffer::create_from_memory_range(&bitcode_bytes, module_name);