2022-02-14 17:34:09 +08:00
|
|
|
fn build_c_impl() {
|
2023-09-08 19:39:00 +08:00
|
|
|
#[cfg(not(target_os = "linux"))]
|
2022-02-14 17:34:09 +08:00
|
|
|
let mut build = cc::Build::new();
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
build.file("src/windows/wf_cliprdr.c");
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
build.file("src/OSX/Clipboard.m");
|
|
|
|
|
2023-09-08 19:39:00 +08:00
|
|
|
#[cfg(not(target_os = "linux"))]
|
|
|
|
{
|
|
|
|
build.flag_if_supported("-Wno-c++0x-extensions");
|
|
|
|
build.flag_if_supported("-Wno-return-type-c-linkage");
|
|
|
|
build.flag_if_supported("-Wno-invalid-offsetof");
|
|
|
|
build.flag_if_supported("-Wno-unused-parameter");
|
2022-02-14 17:34:09 +08:00
|
|
|
|
2023-09-08 19:39:00 +08:00
|
|
|
if build.get_compiler().is_like_msvc() {
|
|
|
|
build.define("WIN32", "");
|
|
|
|
// build.define("_AMD64_", "");
|
|
|
|
build.flag("-Z7");
|
|
|
|
build.flag("-GR-");
|
|
|
|
// build.flag("-std:c++11");
|
|
|
|
} else {
|
|
|
|
build.flag("-fPIC");
|
|
|
|
// build.flag("-std=c++11");
|
|
|
|
// build.flag("-include");
|
|
|
|
// build.flag(&confdefs_path.to_string_lossy());
|
|
|
|
}
|
2022-02-14 17:34:09 +08:00
|
|
|
|
2023-09-08 19:39:00 +08:00
|
|
|
build.compile("mycliprdr");
|
|
|
|
}
|
2022-02-14 17:34:09 +08:00
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
println!("cargo:rerun-if-changed=src/windows/wf_cliprdr.c");
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
println!("cargo:rerun-if-changed=src/OSX/Clipboard.m");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
build_c_impl();
|
|
|
|
}
|