build.rs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. .file("src/EvalKey.cc")
  12. .file("src/LWEPrivateKey.cc")
  13. .file("src/VectorOfCiphertexts.cc")
  14. .include("/usr/local/include/openfhe")
  15. .include("/usr/local/include/openfhe/third-party/include")
  16. .include("/usr/local/include/openfhe/core")
  17. .include("/usr/local/include/openfhe/pke")
  18. .include("/usr/local/include/openfhe/binfhe")
  19. .flag_if_supported("-std=c++17")
  20. .flag_if_supported("-Wall")
  21. .flag_if_supported("-Werror")
  22. .flag_if_supported("-O3")
  23. .flag_if_supported("-fopenmp") // [-Wunknown-pragmas]
  24. .flag_if_supported("-Wno-parentheses") // [-Wparentheses]
  25. .flag_if_supported("-Wno-unused-parameter") // [-Wunused-parameter]
  26. .flag_if_supported("-Wno-missing-field-initializers") // [-Wmissing-field-initializers]
  27. .flag_if_supported("-Wno-unused-function") // [-Wunused-function]
  28. .compile("openfhe");
  29. println!("cargo::rerun-if-changed=src/lib.rs");
  30. println!("cargo::rerun-if-changed=src/Ciphertext.h");
  31. println!("cargo::rerun-if-changed=src/Ciphertext.cc");
  32. println!("cargo::rerun-if-changed=src/CryptoContext.h");
  33. println!("cargo::rerun-if-changed=src/CryptoContext.cc");
  34. println!("cargo::rerun-if-changed=src/KeyPair.h");
  35. println!("cargo::rerun-if-changed=src/KeyPair.cc");
  36. println!("cargo::rerun-if-changed=src/Params.h");
  37. println!("cargo::rerun-if-changed=src/Params.cc");
  38. println!("cargo::rerun-if-changed=src/Plaintext.h");
  39. println!("cargo::rerun-if-changed=src/Plaintext.cc");
  40. println!("cargo::rerun-if-changed=src/PublicKey.h");
  41. println!("cargo::rerun-if-changed=src/PublicKey.cc");
  42. println!("cargo::rerun-if-changed=src/SerialDeserial.h");
  43. println!("cargo::rerun-if-changed=src/SerialDeserial.cc");
  44. println!("cargo::rerun-if-changed=src/EvalKey.h");
  45. println!("cargo::rerun-if-changed=src/EvalKey.cc");
  46. println!("cargo::rerun-if-changed=src/LWEPrivateKey.h");
  47. println!("cargo::rerun-if-changed=src/LWEPrivateKey.cc");
  48. println!("cargo::rerun-if-changed=src/VectorOfCiphertexts.h");
  49. println!("cargo::rerun-if-changed=src/VectorOfCiphertexts.cc");
  50. // linking openFHE
  51. println!("cargo::rustc-link-arg=-L/usr/local/lib");
  52. println!("cargo::rustc-link-arg=-lOPENFHEpke");
  53. println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
  54. println!("cargo::rustc-link-arg=-lOPENFHEcore");
  55. // linking OpenMP
  56. println!("cargo::rustc-link-arg=-fopenmp");
  57. // necessary to avoid LD_LIBRARY_PATH
  58. println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
  59. }