build.rs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. fn main()
  2. {
  3. cxx_build::bridge("src/lib.rs")
  4. .file("src/AssociativeContainerOfOpaqueTypes.cc")
  5. .file("src/Ciphertext.cc")
  6. .file("src/CryptoContext.cc")
  7. .file("src/CryptoParametersBase.cc")
  8. .file("src/EvalKey.cc")
  9. .file("src/KeyPair.cc")
  10. .file("src/LWEPrivateKey.cc")
  11. .file("src/Params.cc")
  12. .file("src/Plaintext.cc")
  13. .file("src/PrivateKey.cc")
  14. .file("src/PublicKey.cc")
  15. .file("src/SchemeBase.cc")
  16. .file("src/SequenceContainerOfOpaqueTypes.cc")
  17. .file("src/SerialDeserial.cc")
  18. .include("/usr/local/include/openfhe")
  19. .include("/usr/local/include/openfhe/third-party/include")
  20. .include("/usr/local/include/openfhe/core")
  21. .include("/usr/local/include/openfhe/pke")
  22. .include("/usr/local/include/openfhe/binfhe")
  23. .flag_if_supported("-std=c++17")
  24. .flag_if_supported("-Wall")
  25. .flag_if_supported("-Werror")
  26. .flag_if_supported("-O3")
  27. .flag_if_supported("-fopenmp") // [-Wunknown-pragmas]
  28. .flag_if_supported("-Wno-parentheses") // [-Wparentheses]
  29. .flag_if_supported("-Wno-unused-parameter") // [-Wunused-parameter]
  30. .flag_if_supported("-Wno-missing-field-initializers") // [-Wmissing-field-initializers]
  31. .flag_if_supported("-Wno-unused-function") // [-Wunused-function]
  32. .compile("openfhe");
  33. println!("cargo::rerun-if-changed=src/lib.rs");
  34. println!("cargo::rerun-if-changed=src/AssociativeContainerOfOpaqueTypes.h");
  35. println!("cargo::rerun-if-changed=src/AssociativeContainerOfOpaqueTypes.cc");
  36. println!("cargo::rerun-if-changed=src/Ciphertext.h");
  37. println!("cargo::rerun-if-changed=src/Ciphertext.cc");
  38. println!("cargo::rerun-if-changed=src/CryptoContext.h");
  39. println!("cargo::rerun-if-changed=src/CryptoContext.cc");
  40. println!("cargo::rerun-if-changed=src/CryptoParametersBase.h");
  41. println!("cargo::rerun-if-changed=src/CryptoParametersBase.cc");
  42. println!("cargo::rerun-if-changed=src/EvalKey.h");
  43. println!("cargo::rerun-if-changed=src/EvalKey.cc");
  44. println!("cargo::rerun-if-changed=src/KeyPair.h");
  45. println!("cargo::rerun-if-changed=src/KeyPair.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/Params.h");
  49. println!("cargo::rerun-if-changed=src/Params.cc");
  50. println!("cargo::rerun-if-changed=src/Plaintext.h");
  51. println!("cargo::rerun-if-changed=src/Plaintext.cc");
  52. println!("cargo::rerun-if-changed=src/PrivateKey.h");
  53. println!("cargo::rerun-if-changed=src/PrivateKey.cc");
  54. println!("cargo::rerun-if-changed=src/PublicKey.h");
  55. println!("cargo::rerun-if-changed=src/PublicKey.cc");
  56. println!("cargo::rerun-if-changed=src/SchemeBase.h");
  57. println!("cargo::rerun-if-changed=src/SchemeBase.cc");
  58. println!("cargo::rerun-if-changed=src/SequenceContainerOfOpaqueTypes.h");
  59. println!("cargo::rerun-if-changed=src/SequenceContainerOfOpaqueTypes.cc");
  60. println!("cargo::rerun-if-changed=src/SerialDeserial.h");
  61. println!("cargo::rerun-if-changed=src/SerialDeserial.cc");
  62. // linking openFHE
  63. println!("cargo::rustc-link-arg=-L/usr/local/lib");
  64. println!("cargo::rustc-link-arg=-lOPENFHEpke");
  65. println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
  66. println!("cargo::rustc-link-arg=-lOPENFHEcore");
  67. // linking OpenMP
  68. println!("cargo::rustc-link-arg=-fopenmp");
  69. // necessary to avoid LD_LIBRARY_PATH
  70. println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
  71. }