-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
32 lines (25 loc) · 870 Bytes
/
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
extern crate lalrpop;
fn main() {
// FIXME: Ensure that SDL2.dll is placed when this is used
// println!("cargo:rerun-if-changed=src/parse/parser.lalrpop");
// Link SDL2 library
let sdl2_path = r"C:/Development/SDL2/lib/x64";
println!(r"cargo:rustc-link-search={}", sdl2_path);
// Build the sdf-lang parser
lalrpop::Configuration::new()
.use_cargo_dir_conventions()
.process_file("src/parse/parser.lalrpop")
.unwrap();
// Copy SDL2 runtime library into executable's path
#[cfg(runtime)]
{
#[cfg(target_os = "windows")]
{
let sdl2_dll = std::path::Path::new("./SDL2.dll");
if !sdl2_dll.exists() {
std::fs::copy(format!("{}/{}", sdl2_path, "SDL2.dll"), sdl2_dll).unwrap();
}
}
// TODO: Other operating systems
}
}