mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
keep conditional compilation local
This commit is contained in:
parent
26e5ac85d4
commit
a2c760aa56
3 changed files with 18 additions and 26 deletions
|
@ -379,18 +379,8 @@ pub fn build_file<'a>(
|
|||
inputs.push(host_input_path.as_path().to_str().unwrap());
|
||||
}
|
||||
|
||||
let builtins_host_tempfile = {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
bitcode::host_unix_tempfile()
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
bitcode::host_windows_tempfile()
|
||||
}
|
||||
}
|
||||
.expect("failed to write host builtins object to tempfile");
|
||||
let builtins_host_tempfile =
|
||||
bitcode::host_tempfile().expect("failed to write host builtins object to tempfile");
|
||||
|
||||
if matches!(code_gen_options.backend, program::CodeGenBackend::Assembly) {
|
||||
inputs.push(builtins_host_tempfile.path().to_str().unwrap());
|
||||
|
|
|
@ -705,18 +705,8 @@ pub fn rebuild_host(
|
|||
let env_home = env::var("HOME").unwrap_or_else(|_| "".to_string());
|
||||
let env_cpath = env::var("CPATH").unwrap_or_else(|_| "".to_string());
|
||||
|
||||
let builtins_host_tempfile = {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
bitcode::host_windows_tempfile()
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
bitcode::host_unix_tempfile()
|
||||
}
|
||||
}
|
||||
.expect("failed to write host builtins object to tempfile");
|
||||
let builtins_host_tempfile =
|
||||
bitcode::host_tempfile().expect("failed to write host builtins object to tempfile");
|
||||
|
||||
if zig_host_src.exists() {
|
||||
// Compile host.zig
|
||||
|
|
|
@ -27,7 +27,7 @@ pub fn host_wasm_tempfile() -> std::io::Result<NamedTempFile> {
|
|||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
pub fn host_unix_tempfile() -> std::io::Result<NamedTempFile> {
|
||||
fn host_unix_tempfile() -> std::io::Result<NamedTempFile> {
|
||||
let tempfile = tempfile::Builder::new()
|
||||
.prefix("host_bitcode")
|
||||
.suffix(".o")
|
||||
|
@ -40,7 +40,7 @@ pub fn host_unix_tempfile() -> std::io::Result<NamedTempFile> {
|
|||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub fn host_windows_tempfile() -> std::io::Result<NamedTempFile> {
|
||||
fn host_windows_tempfile() -> std::io::Result<NamedTempFile> {
|
||||
let tempfile = tempfile::Builder::new()
|
||||
.prefix("host_bitcode")
|
||||
.suffix(".obj")
|
||||
|
@ -52,6 +52,18 @@ pub fn host_windows_tempfile() -> std::io::Result<NamedTempFile> {
|
|||
Ok(tempfile)
|
||||
}
|
||||
|
||||
pub fn host_tempfile() -> std::io::Result<NamedTempFile> {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
host_unix_tempfile()
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
host_windows_tempfile()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
pub struct IntrinsicName {
|
||||
pub options: [&'static str; 14],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue