diff --git a/src/commands.rs b/src/commands.rs index 48009bc..de7966e 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -4,6 +4,7 @@ use indexmap::IndexMap; use memoize::memoize; use serde_json::Value; use std::collections::HashMap; +use std::env::consts::DLL_SUFFIX; use std::io::{BufRead, BufReader, Write}; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; @@ -328,7 +329,7 @@ impl CargoBuildExterns { .find(|f| f.ends_with(".rmeta")) .or_else(|| files.iter().find(|f| f.ends_with(".rlib"))) .or_else(|| files.iter().find(|f| f.ends_with(".cdylib"))) - .or_else(|| files.iter().find(|f| f.ends_with(".so"))) + .or_else(|| files.iter().find(|f| f.ends_with(DLL_SUFFIX))) .unwrap_or(&files[0]) .to_string(); let dep = DependentLibrary { diff --git a/src/doc.rs b/src/doc.rs index 3243ffa..6f57231 100644 --- a/src/doc.rs +++ b/src/doc.rs @@ -3,6 +3,7 @@ use cargo_metadata::MetadataCommand; use colored::Colorize; use indexmap::IndexMap; use std::collections::HashSet; +use std::env::consts::{DLL_PREFIX, DLL_SUFFIX}; use std::path::{Path, PathBuf}; use std::process::Command; @@ -111,15 +112,16 @@ fn generate_single_target_doc( // Add extern dependencies for verus_builtin_macros (proc-macro -> host triple) let builtin_macros_path = - verus_target_dir.join(format!("verus_builtin_macros{}", verus::DYN_LIB)); + verus_target_dir.join(format!("{DLL_PREFIX}verus_builtin_macros{DLL_SUFFIX}")); cmd.arg("--extern").arg(format!( "verus_builtin_macros={}", builtin_macros_path.display() )); // Add extern dependencies for verus_state_machines_macros - let state_machine_macros_path = - verus_target_dir.join(format!("verus_state_machines_macros{}", verus::DYN_LIB)); + let state_machine_macros_path = verus_target_dir.join(format!( + "{DLL_PREFIX}verus_state_machines_macros{DLL_SUFFIX}" + )); cmd.arg("--extern").arg(format!( "verus_state_machines_macros={}", state_machine_macros_path.display() diff --git a/src/verus.rs b/src/verus.rs index e0b0262..822094c 100644 --- a/src/verus.rs +++ b/src/verus.rs @@ -36,13 +36,6 @@ pub const Z3_HINT: &str = "tools/verus/source"; pub const VERUSFMT_BIN: &str = "verusfmt"; -#[cfg(target_os = "windows")] -pub const DYN_LIB: &str = ".dll"; -#[cfg(target_os = "linux")] -pub const DYN_LIB: &str = ".so"; -#[cfg(target_os = "macos")] -pub const DYN_LIB: &str = ".dylib"; - pub const RUSTDOC_BIN: &str = "rustdoc"; pub const VERUSDOC_BIN: &str = "verusdoc";