aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/build.rs b/build.rs
index 8d4404c..d41934c 100644
--- a/build.rs
+++ b/build.rs
@@ -7,20 +7,21 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#[cfg(feature = "named-entities")]
extern crate phf_codegen;
-use std::collections::HashMap;
-use std::env;
-use std::fs::File;
-use std::io::Write;
-use std::path::Path;
+#[cfg(feature = "named-entities")]
+use {std::collections::HashMap, std::env, std::fs::File, std::io::Write, std::path::Path};
+#[cfg(feature = "named-entities")]
mod entities;
fn main() {
+ #[cfg(feature = "named-entities")]
named_entities_to_phf(&Path::new(&env::var("OUT_DIR").unwrap()).join("named_entities.rs"));
}
+#[cfg(feature = "named-entities")]
fn named_entities_to_phf(to: &Path) {
let mut entities: HashMap<&str, (u32, u32)> = entities::NAMED_ENTITIES
.iter()