fix compilation on non-linux systems

This commit is contained in:
Folkert 2022-12-30 01:24:30 +01:00
parent 9500b0b97b
commit 407fef0602
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 18 additions and 1 deletions

View file

@ -133,7 +133,7 @@ pub fn build_file<'a>(
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn build_loaded_file<'a>( fn build_loaded_file<'a>(
arena: &'a Bump, arena: &'a Bump,
target: &Triple, target: &Triple,
app_module_path: PathBuf, app_module_path: PathBuf,

View file

@ -1,3 +1,4 @@
#[cfg(target_os = "linux")]
fn main() { fn main() {
let temp_dir = tempfile::tempdir().unwrap(); let temp_dir = tempfile::tempdir().unwrap();
let app_module_path = temp_dir.path().join("app.roc"); let app_module_path = temp_dir.path().join("app.roc");
@ -31,3 +32,6 @@ fn main() {
res_binary_path.unwrap(); res_binary_path.unwrap();
} }
#[cfg(not(target_os = "linux"))]
fn main() {}

View file

@ -6,6 +6,19 @@ use cli_utils::helpers::{extract_valgrind_errors, ValgrindError, ValgrindErrorXW
use roc_cli::build::BuiltFile; use roc_cli::build::BuiltFile;
fn valgrind_test(source: &str) { fn valgrind_test(source: &str) {
#[cfg(target_os = "linux")]
{
valgrind_test_linux(source)
}
#[cfg(not(target_os = "linux"))]
{
let _ = source;
}
}
#[cfg(target_os = "linux")]
fn valgrind_test_linux(source: &str) {
let pf = std::env::current_dir() let pf = std::env::current_dir()
.unwrap() .unwrap()
.join("zig-platform/main.roc"); .join("zig-platform/main.roc");