Skip to content

Commit

Permalink
Enable offline based on thirdparty dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Aug 21, 2024
1 parent 10bee35 commit 1775373
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ jobs:

- name: Prepare for publish
run: |
sh install-offline.sh
mkdir rust-bindings/cpp
cp -r src lib tests uint128_t python-bindings c-bindings CMakeLists.txt rust-bindings/cpp
cp -r src lib tests uint128_t python-bindings c-bindings CMakeLists.txt thirdparty rust-bindings/cpp
- name: Publish to crates.io (dry run)
# We use `--allow-dirty` because the `cpp` folder is copied into the working directory.
Expand Down
8 changes: 7 additions & 1 deletion rust-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ fn main() {
.to_path_buf();
}

let build_offline = cpp_dir.join("thirdparty").try_exists().unwrap();

let dst = Config::new(cpp_dir.as_path())
.build_target("chiapos_static")
.define("BUILD_STATIC_CHIAPOS_LIBRARY", "ON")
.define(
"BUILD_OFFLINE",
env::var("BUILD_OFFLINE").unwrap_or_else(|_| "OFF".to_string()),
if build_offline {
"ON".to_string()
} else {
"OFF".to_string()
},
)
.build();

Expand Down

0 comments on commit 1775373

Please sign in to comment.