Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support windows mingw64 gnu #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ name = "libxml"
[dependencies]
libc = "0.2"

[target.'cfg(windows)'.build-dependencies]
[target.'cfg(all(target_family = "windows", target_env = "msvc"))'.build-dependencies]
vcpkg = "0.2"

[target.'cfg(all(target_family = "windows", target_env = "gnu"))'.build-dependencies]
pkg-config = "0.3.2"

[target.'cfg(macos)'.build-dependencies]
pkg-config = "0.3.2"

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ $ pkg install libxml2 pkgconf

### Windows

#### gnu

On mingw64 environment you'd install libxml2 with `pacman -S mingw64/mingw-w64-x86_64-libxml2`.

#### msvc

[Community contributed](https://github.com/KWARC/rust-libxml/issues/81#issuecomment-760364976):

* manually install builds tools c++ and english language by visiting [BuildTools](https://visualstudio.microsoft.com/fr/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16)
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ mod pkg_config_dep {
#[cfg(target_family = "windows")]
mod vcpkg_dep {
pub fn find() -> bool {
#[cfg(target_env = "gnu")]
if pkg_config::find_library("libxml-2.0").is_ok() {
return true;
}
#[cfg(target_env = "msvc")]
if vcpkg::find_package("libxml2").is_ok() {
return true;
}
Expand Down
Loading