File tree Expand file tree Collapse file tree 3 files changed +14
-9
lines changed
Expand file tree Collapse file tree 3 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 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 :
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ license = "MIT"
77description = " C/C++ interface for MathCAT (for MathCAT info, see crates.io or nsoiffer.github.io/MathCAT)"
88resolver = " 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 ]
1114mathcat = { 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
Original file line number Diff line number Diff line change @@ -8,18 +8,20 @@ use std::env;
88use 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
2020fn 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}
You can’t perform that action at this time.
0 commit comments