File tree Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -434,16 +434,28 @@ mod tests {
434434 ) ) ;
435435 }
436436
437+ fn get_openblas_source ( ) -> PathBuf {
438+ let openblas_src_root = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "../openblas-src" ) ;
439+ let openblas_version = "0.3.21" ;
440+ let source = openblas_src_root. join ( format ! ( "OpenBLAS-{}" , openblas_version) ) ;
441+ if !source. exists ( ) {
442+ Command :: new ( "tar" )
443+ . arg ( "xf" )
444+ . arg ( format ! ( "OpenBLAS-{}.tar.gz" , openblas_version) )
445+ . current_dir ( openblas_src_root)
446+ . status ( )
447+ . expect ( "tar command not found" ) ;
448+ }
449+ source
450+ }
451+
437452 #[ ignore]
438453 #[ test]
439454 fn build_default ( ) {
440455 let root = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
441456 let opt = Configure :: default ( ) ;
442457 let _detail = opt
443- . build (
444- root. join ( "../openblas-src/source" ) ,
445- root. join ( "test_build/build_default" ) ,
446- )
458+ . build ( get_openblas_source ( ) , root. join ( "test_build/build_default" ) )
447459 . unwrap ( ) ;
448460 }
449461
@@ -455,7 +467,7 @@ mod tests {
455467 opt. no_shared = true ;
456468 let detail = opt
457469 . build (
458- root . join ( "../openblas-src/source" ) ,
470+ get_openblas_source ( ) ,
459471 root. join ( "test_build/build_no_shared" ) ,
460472 )
461473 . unwrap ( ) ;
@@ -470,7 +482,7 @@ mod tests {
470482 opt. no_lapacke = true ;
471483 let detail = opt
472484 . build (
473- root . join ( "../openblas-src/source" ) ,
485+ get_openblas_source ( ) ,
474486 root. join ( "test_build/build_no_lapacke" ) ,
475487 )
476488 . unwrap ( ) ;
Original file line number Diff line number Diff line change 11use std:: { env, path:: * , process:: Command } ;
22
3+ const OPENBLAS_VERSION : & str = "0.3.21" ;
4+
35fn feature_enabled ( feature : & str ) -> bool {
46 env:: var ( format ! ( "CARGO_FEATURE_{}" , feature. to_uppercase( ) ) ) . is_ok ( )
57}
@@ -158,13 +160,12 @@ fn build() {
158160 ) ;
159161 }
160162
161- let openblas_version = "0.3.21" ;
162163 let source =
163- PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( format ! ( "OpenBLAS-{}" , openblas_version ) ) ;
164+ PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( format ! ( "OpenBLAS-{}" , OPENBLAS_VERSION ) ) ;
164165 if !source. exists ( ) {
165166 Command :: new ( "tar" )
166167 . arg ( "xf" )
167- . arg ( format ! ( "OpenBLAS-{}.tar.gz" , openblas_version ) )
168+ . arg ( format ! ( "OpenBLAS-{}.tar.gz" , OPENBLAS_VERSION ) )
168169 . current_dir ( env ! ( "CARGO_MANIFEST_DIR" ) )
169170 . status ( )
170171 . expect ( "tar command not found" ) ;
@@ -243,7 +244,10 @@ fn build() {
243244 if source_tmp. exists ( ) {
244245 fs:: remove_dir_all ( & source_tmp) . unwrap ( ) ;
245246 }
246- run ( Command :: new ( "cp" ) . arg ( "-R" ) . arg ( "source" ) . arg ( & source_tmp) ) ;
247+ run ( Command :: new ( "cp" )
248+ . arg ( "-R" )
249+ . arg ( format ! ( "OpenBLAS-{}" , OPENBLAS_VERSION ) )
250+ . arg ( & source_tmp) ) ;
247251 fs:: rename ( & source_tmp, & source) . unwrap ( ) ;
248252 }
249253 for name in & vec ! [ "CC" , "FC" , "HOSTCC" ] {
You can’t perform that action at this time.
0 commit comments