Skip to content

options: Remove the linking-related options. #1288

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

Merged
merged 1 commit into from
Apr 2, 2018
Merged
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name = "bindgen"
readme = "README.md"
repository = "https://github.com/rust-lang-nursery/rust-bindgen"
documentation = "https://docs.rs/bindgen"
version = "0.35.0"
version = "0.36.0"
build = "build.rs"

include = [
Expand Down
76 changes: 0 additions & 76 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,19 +343,6 @@ impl Builder {
output_vector.push("--disable-name-namespacing".into());
}

self.options
.links
.iter()
.map(|&(ref item, _)| {
output_vector.push("--framework".into());
output_vector.push(
item.trim_left_matches("^")
.trim_right_matches("$")
.into(),
);
})
.count();

if !self.options.codegen_config.functions {
output_vector.push("--ignore-functions".into());
}
Expand Down Expand Up @@ -389,19 +376,6 @@ impl Builder {
output_vector.push("--ignore-methods".into());
}

self.options
.links
.iter()
.map(|&(ref item, _)| {
output_vector.push("--clang-args".into());
output_vector.push(
item.trim_left_matches("^")
.trim_right_matches("$")
.into(),
);
})
.count();

if !self.options.convert_floats {
output_vector.push("--no-convert-floats".into());
}
Expand Down Expand Up @@ -437,19 +411,6 @@ impl Builder {
})
.count();

self.options
.links
.iter()
.map(|&(ref item, _)| {
output_vector.push("--static".into());
output_vector.push(
item.trim_left_matches("^")
.trim_right_matches("$")
.into(),
);
})
.count();

if self.options.use_core {
output_vector.push("--use-core".into());
}
Expand Down Expand Up @@ -824,26 +785,6 @@ impl Builder {
self
}

/// Make the generated bindings link the given shared library.
pub fn link<T: Into<String>>(mut self, library: T) -> Builder {
self.options.links.push((library.into(), LinkType::Default));
self
}

/// Make the generated bindings link the given static library.
pub fn link_static<T: Into<String>>(mut self, library: T) -> Builder {
self.options.links.push((library.into(), LinkType::Static));
self
}

/// Make the generated bindings link the given framework.
pub fn link_framework<T: Into<String>>(mut self, library: T) -> Builder {
self.options.links.push(
(library.into(), LinkType::Framework),
);
self
}

/// Emit bindings for builtin definitions (for example `__builtin_va_list`)
/// in the generated Rust.
pub fn emit_builtins(mut self) -> Builder {
Expand Down Expand Up @@ -1277,9 +1218,6 @@ struct BindgenOptions {
/// Whether we should generate builtins or not.
builtins: bool,

/// The set of libraries we should link in the generated Rust code.
links: Vec<(String, LinkType)>,

/// True if we should dump the Clang AST for debugging purposes.
emit_ast: bool,

Expand Down Expand Up @@ -1484,7 +1422,6 @@ impl Default for BindgenOptions {
rustified_enums: Default::default(),
constified_enum_modules: Default::default(),
builtins: false,
links: vec![],
emit_ast: false,
emit_ir: false,
emit_ir_graphviz: None,
Expand Down Expand Up @@ -1529,19 +1466,6 @@ impl Default for BindgenOptions {
}
}

/// The linking type to use with a given library.
///
/// TODO: #104: This is ignored at the moment, but shouldn't be.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum LinkType {
/// Use shared library linking. This is the default.
Default,
/// Use static linking.
Static,
/// The library is an OSX framework.
Framework,
}

fn ensure_libclang_is_loaded() {
if clang_sys::is_loaded() {
return;
Expand Down
37 changes: 0 additions & 37 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,6 @@ where
.help("Disable namespacing via mangling, causing bindgen to \
generate names like \"Baz\" instead of \"foo_bar_Baz\" \
for an input name \"foo::bar::Baz\"."),
Arg::with_name("framework")
.long("framework-link")
.help("Link to framework.")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("ignore-functions")
.long("ignore-functions")
.help("Do not generate bindings for functions or methods. This \
Expand All @@ -168,13 +162,6 @@ where
Arg::with_name("ignore-methods")
.long("ignore-methods")
.help("Do not generate bindings for methods."),
Arg::with_name("dynamic")
.short("l")
.long("link")
.help("Link to dynamic library.")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("no-convert-floats")
.long("no-convert-floats")
.help("Do not automatically convert floats to f32/f64."),
Expand Down Expand Up @@ -207,12 +194,6 @@ where
.long("rust-target")
.help(&rust_target_help)
.takes_value(true),
Arg::with_name("static")
.long("static-link")
.help("Link to static library.")
.takes_value(true)
.multiple(true)
.number_of_values(1),
Arg::with_name("use-core")
.long("use-core")
.help("Use types from Rust core instead of std."),
Expand Down Expand Up @@ -409,12 +390,6 @@ where
builder = builder.ctypes_prefix(prefix);
}

if let Some(links) = matches.values_of("dynamic") {
for library in links {
builder = builder.link(library);
}
}

if let Some(what_to_generate) = matches.value_of("generate") {
let mut config = CodegenConfig::nothing();
for what in what_to_generate.split(",") {
Expand Down Expand Up @@ -456,12 +431,6 @@ where
builder = builder.disable_name_namespacing();
}

if let Some(links) = matches.values_of("framework") {
for framework in links {
builder = builder.link_framework(framework);
}
}

if matches.is_present("ignore-functions") {
builder = builder.ignore_functions();
}
Expand Down Expand Up @@ -498,12 +467,6 @@ where
}
}

if let Some(links) = matches.values_of("static") {
for library in links {
builder = builder.link_static(library);
}
}

if matches.is_present("use-core") {
builder = builder.use_core();
}
Expand Down