Skip to content

Commit 8ed577b

Browse files
committed
Added "include-zip" feature which is passed on to mathcat. This is needed for building a zip file in the github release.
1 parent 856faf8 commit 8ed577b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

.github/workflows/automaticRelease.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Build Rust Library
1919
run: |
2020
# doesn't need a release build since all that we want is the Rules dir and the .h files
21-
cargo build --target x86_64-unknown-linux-gnu
21+
cargo build --target x86_64-unknown-linux-gnu --features include-zip
2222
- name: create rules.zip
2323
uses: thedoctor0/zip-release@0.7.5
2424
with:

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ license = "MIT"
77
description = "C/C++ interface for MathCAT (for MathCAT info, see crates.io or nsoiffer.github.io/MathCAT)"
88
resolver = "2" # allows different build dependency features
99

10+
[features]
11+
"include-zip" = ["mathcat/include-zip"] # include the zip files in the build
12+
1013
[dependencies]
1114
mathcat = { version = "0.7.0-rc.2"} # for building, we want the zip files so we can include them separately
1215
# mathcat = { path= "../MathCAT/"} # for building, we want the zip files so we can include them separately

build.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ use std::env;
88
use cbindgen::*;
99

1010

11-
// use zip::ZipArchive;
12-
// fn unzip_rules(location: &Path) {
13-
// let archive = libmathcat::ZIPPED_RULE_FILES;
14-
// let archive = std::io::Cursor::new(archive);
11+
use zip::ZipArchive;
12+
fn unzip_rules(location: &Path) {
13+
let archive = libmathcat::ZIPPED_RULE_FILES;
14+
let archive = std::io::Cursor::new(archive);
1515

16-
// let mut zip_archive = ZipArchive::new(archive).unwrap();
17-
// zip_archive.extract(location).expect("Zip extraction failed");
18-
// }
16+
let mut zip_archive = ZipArchive::new(archive).unwrap();
17+
zip_archive.extract(location).expect("Zip extraction failed");
18+
}
1919

2020
fn main() {
2121
let examples_dir = PathBuf::from("Example");
22-
// unzip_rules(&examples_dir);
22+
if std::env::var("CARGO_FEATURE_INCLUDE_ZIP").is_ok() {
23+
unzip_rules(&examples_dir);
24+
}
2325
write_headers(&examples_dir, "mathcat-c.h", Language::C);
2426
write_headers(&examples_dir, "mathcat.h", Language::Cxx);
2527
}

0 commit comments

Comments
 (0)