forked from huonw/unicode_names
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.rs
34 lines (32 loc) · 1.27 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::{env, path::PathBuf};
use unicode_names2_generator as generator;
/// [UnicodeData.txt] contains Unicode Character Data
///
/// [UnicodeData.txt]: https://www.unicode.org/Public/16.0.0/ucd/UnicodeData.txt
const UNICODE_DATA: &str = include_str!("data/UnicodeData.txt");
/// Unicode aliases
///
/// [NamesList.txt] contents contains a map of unicode aliases to their corresponding values.
///
/// [NamesList.txt]: https://www.unicode.org/Public/16.0.0/ucd/NameAliases.txt
const NAME_ALIASES: &str = include_str!("data/NameAliases.txt");
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=data/");
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
{
let mut generated_path = out_dir.clone();
generated_path.push("generated.rs");
generator::generate(UNICODE_DATA, Some(&generated_path), None);
}
{
let mut generated_phf_path = out_dir.clone();
generated_phf_path.push("generated_phf.rs");
generator::generate_phf(UNICODE_DATA, Some(&generated_phf_path), None, 3, 2);
}
{
let mut generated_alias_path = out_dir;
generated_alias_path.push("generated_alias.rs");
generator::generate_aliases(NAME_ALIASES, &generated_alias_path);
}
}