Skip to content

Commit

Permalink
Copy src and CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Aug 13, 2024
1 parent a6de49c commit 335b2ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ jobs:
run: cargo build --release

- name: Prepare for publish
run: cp -r src rust-bindings/cpp
run: |
mkdir rust-bindings/cpp
cp -r src rust-bindings/cpp/src
cp CMakeLists.txt rust-bindings/cpp/CMakeLists.txt
- name: Publish to crates.io (dry run)
# We use `--allow-dirty` because the `cpp` folder is copied into the working directory.
Expand All @@ -84,6 +87,4 @@ jobs:
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.cargo_registry_token }}
# See comment above for why `--allow-dirty` is used.
run: |
cp -r src rust-bindings/cpp
cargo publish -p chiapos --allow-dirty
run: cargo publish -p chiapos --allow-dirty
18 changes: 10 additions & 8 deletions rust-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ fn main() {

let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());

let dst = Config::new(manifest_dir.parent().unwrap())
let mut cpp_dir = manifest_dir.join("cpp");
if !cpp_dir.exists() {
cpp_dir = manifest_dir
.parent()
.expect("can't access ../")
.to_path_buf();
}

let dst = Config::new(cpp_dir.as_path())
.build_target("chiapos_static")
.define("BUILD_STATIC_CHIAPOS_LIBRARY", "ON")
.build();
Expand Down Expand Up @@ -39,13 +47,7 @@ fn main() {
.clang_arg("c++")
.clang_arg(format!(
"-I{}",
manifest_dir
.parent()
.unwrap()
.join("lib")
.join("include")
.to_str()
.unwrap()
cpp_dir.join("lib").join("include").to_str().unwrap()
))
.clang_arg(format!("-I{}", blake3_include_path.to_str().unwrap()))
.clang_arg("-std=c++14")
Expand Down

0 comments on commit 335b2ea

Please sign in to comment.