Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ readme = "README.md"
serde = { version = "1.0.183", features = ["derive"], optional = true}
thiserror = "1.0"

[target.'cfg(any(target_family = "unix"))'.build-dependencies]
cc = "1.0.73"

[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
libc = "0.2.101"

[target.'cfg(any(target_os = "ios", target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "dragonfly"))'.dependencies]
libc = "0.2.101"

[target.'cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "dragonfly"))'.build-dependencies]
cc = "1.0.73"

[target.'cfg(target_os = "windows")'.dependencies]
libc = "0.2.101"
winapi = {version = "0.3", features = ["ws2def", "ws2ipdef", "netioapi", "iphlpapi", "iptypes", "ntdef", "winerror"] }
Expand Down
9 changes: 1 addition & 8 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
fn main() {
#[cfg(any(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By doing this the build script will also run for Windows.

Perhaps we could constraint this to run on OS Family Unix only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, target_family seems a good way to allow build.rs to be run on linux while preventing it to be run on Windows. I don't think the use case of cross compiling from Windows to Freebsd will happen any time soon (I don't even know if that's actually possible). I fixed it in 7d45bff

target_os = "macos",
target_os = "ios",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd",
target_os = "dragonfly"
))]
#[cfg(any(target_family = "unix"))]
{
use cc::Build;
use std::path::Path;
Expand Down
Loading