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
use crate::Error;
use std::path::Path;
#[cfg(all(target_os = "windows", feature = "cc"))]
pub fn compile_c_app_if_installed<P: AsRef<Path>>(out_dir: P, app: &str) -> Result<(), Error> {
cc::Build::new()
.file(app)
.out_dir(out_dir)
.target("x86_64-pc-windows-msvc")
.opt_level(0)
.host("x86_64-pc-windows-msvc")
.try_compile("foo")
.unwrap();
Ok(())
}
#[cfg(not(all(target_os = "windows", feature = "cc")))]
pub fn compile_c_app_if_installed<P: AsRef<Path>>(_out_dir: P, _app: &str) -> Result<(), Error> {
Ok(())
}