build.rs (1014B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 use std::env; 6 use std::fs; 7 use std::path::PathBuf; 8 9 fn main() { 10 let target = env::var("TARGET").unwrap(); 11 let out_dir = env::var_os("OUT_DIR").unwrap(); 12 let out_dir = PathBuf::from(out_dir); 13 14 println!("cargo:rerun-if-changed=res/wrench.exe.manifest"); 15 if target.contains("windows") { 16 let src = PathBuf::from("res/wrench.exe.manifest"); 17 let mut dst = out_dir 18 .parent() 19 .unwrap() 20 .parent() 21 .unwrap() 22 .parent() 23 .unwrap() 24 .to_owned(); 25 dst.push("wrench.exe.manifest"); 26 fs::copy(&src, &dst).unwrap(); 27 } 28 29 println!("cargo:rerun-if-changed=src/composite.cpp"); 30 31 cc::Build::new() 32 .cpp(true) 33 .file("src/composite.cpp") 34 .compile("wr_composite"); 35 }