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

Allow for external system libs #969

Open
wants to merge 5 commits into
base: 0.3
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ winapi-x86_64-pc-windows-gnu = { version = "0.4", path = "x86_64" }
[features]
debug = ["impl-debug"]
everything = []
external-lib = []
impl-debug = []
impl-default = []
std = []
Expand Down
40 changes: 21 additions & 19 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,25 +469,27 @@ impl Graph {
}
}
fn emit_libraries(&self) {
let mut libs = self.0.iter().filter(|&(_, header)| {
header.included.get()
}).flat_map(|(_, header)| {
header.libraries.iter()
}).collect::<Vec<_>>();
libs.sort();
libs.dedup();
// FIXME Temporary hacks until build script is redesigned.
libs.retain(|&&lib| match &*var("TARGET").unwrap() {
"aarch64-pc-windows-msvc" | "aarch64-uwp-windows-msvc" | "thumbv7a-pc-windows-msvc" => {
if lib == "opengl32" { false }
else { true }
},
_ => true,
});
let prefix = library_prefix();
let kind = library_kind();
for lib in libs {
println!("cargo:rustc-link-lib={}={}{}", kind, prefix, lib);
if var("CARGO_FEATURE_EXTERNAL_LIB").is_err() {
let mut libs = self.0.iter().filter(|&(_, header)| {
header.included.get()
}).flat_map(|(_, header)| {
header.libraries.iter()
}).collect::<Vec<_>>();
libs.sort();
libs.dedup();
// FIXME Temporary hacks until build script is redesigned.
libs.retain(|&&lib| match &*var("TARGET").unwrap() {
"aarch64-pc-windows-msvc" | "aarch64-uwp-windows-msvc" | "thumbv7a-pc-windows-msvc" => {
if lib == "opengl32" { false }
else { true }
},
_ => true,
});
let prefix = library_prefix();
let kind = library_kind();
for lib in libs {
println!("cargo:rustc-link-lib={}={}{}", kind, prefix, lib);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/code_checkers/check_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn check_missing_features_in_cargo_file(build_features: &[String],
cargo_features: &[String],
errors: &mut u32) {
const FEATURES_TO_IGNORE: &'static [&'static str] = &[
"debug", "everything", "impl-debug", "impl-default", "std",
"debug", "everything", "external-lib", "impl-debug", "impl-default", "std",
];
let mut it1 = 0;
let mut it2 = 0;
Expand Down