build.rs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. fn main()
  2. {
  3. cxx_build::bridge("src/lib.rs")
  4. .file("src/Ciphertext.cc")
  5. .file("src/CryptoContext.cc")
  6. .file("src/KeyPair.cc")
  7. .file("src/Params.cc")
  8. .file("src/Plaintext.cc")
  9. .file("src/PublicKey.cc")
  10. .file("src/SerialDeserial.cc")
  11. .include("/usr/local/include/openfhe")
  12. .include("/usr/local/include/openfhe/third-party/include")
  13. .include("/usr/local/include/openfhe/core")
  14. .include("/usr/local/include/openfhe/pke")
  15. .include("/usr/local/include/openfhe/binfhe")
  16. .flag_if_supported("-std=c++17")
  17. .flag_if_supported("-Wall")
  18. .flag_if_supported("-Werror")
  19. .flag_if_supported("-O3")
  20. .flag_if_supported("-fopenmp") // [-Wunknown-pragmas]
  21. .flag_if_supported("-Wno-parentheses") // [-Wparentheses]
  22. .flag_if_supported("-Wno-unused-parameter") // [-Wunused-parameter]
  23. .flag_if_supported("-Wno-missing-field-initializers") // [-Wmissing-field-initializers]
  24. .flag_if_supported("-Wno-unused-function") // [-Wunused-function]
  25. .compile("openfhe");
  26. println!("cargo::rerun-if-changed=src/lib.rs");
  27. println!("cargo::rerun-if-changed=src/Ciphertext.h");
  28. println!("cargo::rerun-if-changed=src/Ciphertext.cc");
  29. println!("cargo::rerun-if-changed=src/CryptoContext.h");
  30. println!("cargo::rerun-if-changed=src/CryptoContext.cc");
  31. println!("cargo::rerun-if-changed=src/KeyPair.h");
  32. println!("cargo::rerun-if-changed=src/KeyPair.cc");
  33. println!("cargo::rerun-if-changed=src/Params.h");
  34. println!("cargo::rerun-if-changed=src/Params.cc");
  35. println!("cargo::rerun-if-changed=src/Plaintext.h");
  36. println!("cargo::rerun-if-changed=src/Plaintext.cc");
  37. println!("cargo::rerun-if-changed=src/PublicKey.h");
  38. println!("cargo::rerun-if-changed=src/PublicKey.cc");
  39. println!("cargo::rerun-if-changed=src/SerialDeserial.h");
  40. println!("cargo::rerun-if-changed=src/SerialDeserial.cc");
  41. // linking openFHE
  42. println!("cargo::rustc-link-arg=-L/usr/local/lib");
  43. println!("cargo::rustc-link-arg=-lOPENFHEpke");
  44. println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
  45. println!("cargo::rustc-link-arg=-lOPENFHEcore");
  46. // linking OpenMP
  47. println!("cargo::rustc-link-arg=-fopenmp");
  48. // necessary to avoid LD_LIBRARY_PATH
  49. println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
  50. }