build.rs 995 B

123456789101112131415161718192021222324252627282930313233343536
  1. #[cfg(target_os = "windows")]
  2. fn build_c_impl() {
  3. let mut build = cc::Build::new();
  4. build.file("src/windows/wf_cliprdr.c");
  5. {
  6. build.flag_if_supported("-Wno-c++0x-extensions");
  7. build.flag_if_supported("-Wno-return-type-c-linkage");
  8. build.flag_if_supported("-Wno-invalid-offsetof");
  9. build.flag_if_supported("-Wno-unused-parameter");
  10. if build.get_compiler().is_like_msvc() {
  11. build.define("WIN32", "");
  12. // build.define("_AMD64_", "");
  13. build.flag("-Z7");
  14. build.flag("-GR-");
  15. // build.flag("-std:c++11");
  16. } else {
  17. build.flag("-fPIC");
  18. // build.flag("-std=c++11");
  19. // build.flag("-include");
  20. // build.flag(&confdefs_path.to_string_lossy());
  21. }
  22. build.compile("mycliprdr");
  23. }
  24. println!("cargo:rerun-if-changed=src/windows/wf_cliprdr.c");
  25. }
  26. fn main() {
  27. #[cfg(target_os = "windows")]
  28. build_c_impl();
  29. }