Skip to content

Commit bd20ab2

Browse files
flierPhantomical
authored andcommitted
enable enc2
1 parent c099723 commit bd20ab2

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ keywords = ["xed", "intel", "x86", "x86_64"]
1111
categories = ["encoding", "external-ffi-bindings", "hardware-support", "parsing", "no_std"]
1212

1313
[badges]
14-
appveyor = { repository = "rust-xed/xed-sys" }
14+
appveyor = { repository = "rust-xed/xed-sys" }
1515
travis-ci = { repository = "rust-xed/xed-sys" }
1616

1717
[features]
18+
# Enable the enc2 module of XED.
19+
#
20+
# Note that this will somewhat dramatically slow down compilation of xed-sys.
21+
# The enc2 module involves a large amount of generated code and the resulting
22+
# bindgen definitions contain 40+MB of rust code.
23+
enc2 = ["bindgen"]
24+
1825
# Generate bindings with bindgen at build-time instead of using the
1926
# pregenerated bindings.
2027
#

build.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ fn build_xed() {
100100
cmd.arg("--opt=0");
101101
}
102102

103+
if cfg!(feature = "enc2") {
104+
cmd.arg("--enc2");
105+
}
106+
103107
eprintln!("XED build command: {:?}", cmd);
104108

105109
let status = cmd.status().expect("Failed to start xed build");
@@ -112,6 +116,13 @@ fn build_xed() {
112116

113117
println!("cargo:rustc-link-search=native={}", lib_dir.display());
114118
println!("cargo:rustc-link-lib=static=xed");
119+
120+
if cfg!(feature = "enc2") {
121+
println!("cargo:rustc-link-lib=static=xed-enc2-m32-a32");
122+
println!("cargo:rustc-link-lib=static=xed-enc2-m64-a64");
123+
println!("cargo:rustc-link-lib=static=xed-chk-enc2-m32-a32");
124+
println!("cargo:rustc-link-lib=static=xed-chk-enc2-m64-a64");
125+
}
115126
}
116127

117128
fn build_inline_shim() {

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
//!
77
//! # Features
88
//!
9+
//! - `enc2` - Enable the [fast XED encoder][1]. Note that enabling this feature
10+
//! results in XED generating a rather large amount of code and the resulting
11+
//! bindgen bindings are over 40MB in size. Expect 5+ minute compile times
12+
//! when enabling this option.
913
//! - `bindgen` - Don't use the bundled bindings files and instead regenerate
1014
//! rust bindings from scratch at compile time. You should never need to
1115
//! enable this manually but it will be enabled by other features.

0 commit comments

Comments
 (0)