Browse Source

set cmake install dir

Sergey Gomenyuk 1 year ago
parent
commit
65d2fd693a
3 changed files with 16 additions and 13 deletions
  1. 9 13
      .github/workflows/build.yml
  2. 0 0
      Dockerfile.build
  3. 7 0
      build.rs

+ 9 - 13
.github/workflows/build.yml

@@ -13,10 +13,6 @@ jobs:
       - name: Clone Git repository
         uses: actions/checkout@v4
 
-      - name: Install g++
-        run: |
-          sudo apt-get install -y g++
-
       - name: Install Cmake
         run: |
           sudo apt update
@@ -26,10 +22,10 @@ jobs:
         run: |
           git clone https://github.com/openfheorg/openfhe-development.git
           cd openfhe-development
-          cmake -B ${OPENFHE_BUILD:-build} -DBUILD_SHARED=ON .
+          mkdir install
+          cmake -B ${OPENFHE_BUILD:-build} -DBUILD_SHARED=ON -DCMAKE_INSTALL_PREFIX=`pwd`/install .
           make -C ${OPENFHE_BUILD:-build} -j$(nproc)
           make -C ${OPENFHE_BUILD:-build} install
-          sudo ldconfig
 
       - name: Install Rust
         uses: dtolnay/rust-toolchain@stable
@@ -38,16 +34,16 @@ jobs:
 
       - name: Build openfhe-rs
         run: |
-          cargo build
+          cargo build --verbose
 
       - name: Test openfhe-rs
         run: |
-          cargo test -- --test-threads=1
+          LD_LIBRARY_PATH=`pwd`/openfhe-development/install/lib cargo test -- --test-threads=1
 
       - name: Examples openfhe-rs
-        run: |
-          cargo run --example polynomial_evaluation
-          cargo run --example function_evaluation
-          cargo run --example simple_integers
-          cargo run --example simple_real_numbers
+        run: | 
+          LD_LIBRARY_PATH=`pwd`/openfhe-development/install/lib cargo run --example polynomial_evaluation
+          LD_LIBRARY_PATH=`pwd`/openfhe-development/install/lib cargo run --example function_evaluation
+          LD_LIBRARY_PATH=`pwd`/openfhe-development/install/lib cargo run --example simple_integers
+          LD_LIBRARY_PATH=`pwd`/openfhe-development/install/lib cargo run --example simple_real_numbers
 

+ 0 - 0
Dockerfile.build


+ 7 - 0
build.rs

@@ -23,6 +23,12 @@ fn main()
         .include("/usr/local/include/openfhe/core")
         .include("/usr/local/include/openfhe/pke")
         .include("/usr/local/include/openfhe/binfhe")
+        .include("./openfhe-development/install/include")
+        .include("./openfhe-development/install/include/openfhe")
+        .include("./openfhe-development/install/include/openfhe/third-party/include")
+        .include("./openfhe-development/install/include/openfhe/core")
+        .include("./openfhe-development/install/include/openfhe/pke")
+        .include("./openfhe-development/install/include/openfhe/binfhe")
         .flag_if_supported("-std=c++17")
         .flag_if_supported("-Wall")
         .flag_if_supported("-Werror")
@@ -72,6 +78,7 @@ fn main()
 
     // linking openFHE
     println!("cargo::rustc-link-arg=-L/usr/local/lib");
+    println!("cargo::rustc-link-arg=-L./openfhe-development/install/lib");
     println!("cargo::rustc-link-arg=-lOPENFHEpke");
     println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
     println!("cargo::rustc-link-arg=-lOPENFHEcore");