Skip to content

Commit 9ace864

Browse files
committed
fix(codspeed): use target_os cfg
1 parent 9a49543 commit 9ace864

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

crates/codspeed/build.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
use std::{env, path::PathBuf};
22

33
fn main() {
4+
if cfg!(not(target_os = "linux")) {
5+
// The instrument-hooks library is only supported on Linux.
6+
return;
7+
}
8+
49
// Compile the C library
510
cc::Build::new()
611
.file("instrument-hooks/dist/core.c")

crates/codspeed/src/instrument_hooks/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#[cfg(unix)]
1+
#[cfg(target_os = "linux")]
22
mod ffi;
33

4-
#[cfg(unix)]
5-
mod unix_impl {
4+
#[cfg(target_os = "linux")]
5+
mod linux_impl {
66
use nix::sys::time::TimeValLike;
77

88
use super::ffi;
@@ -131,7 +131,7 @@ mod unix_impl {
131131
}
132132
}
133133

134-
#[cfg(not(unix))]
134+
#[cfg(not(target_os = "linux"))]
135135
mod other_impl {
136136
pub struct InstrumentHooks;
137137

@@ -169,10 +169,10 @@ mod other_impl {
169169
}
170170
}
171171

172-
#[cfg(unix)]
173-
pub use unix_impl::InstrumentHooks;
172+
#[cfg(target_os = "linux")]
173+
pub use linux_impl::InstrumentHooks;
174174

175-
#[cfg(not(unix))]
175+
#[cfg(not(target_os = "linux"))]
176176
pub use other_impl::InstrumentHooks;
177177

178178
#[cfg(test)]

0 commit comments

Comments
 (0)