File tree 2 files changed +26
-10
lines changed
2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -434,16 +434,28 @@ mod tests {
434
434
) ) ;
435
435
}
436
436
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
+
437
452
#[ ignore]
438
453
#[ test]
439
454
fn build_default ( ) {
440
455
let root = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
441
456
let opt = Configure :: default ( ) ;
442
457
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" ) )
447
459
. unwrap ( ) ;
448
460
}
449
461
@@ -455,7 +467,7 @@ mod tests {
455
467
opt. no_shared = true ;
456
468
let detail = opt
457
469
. build (
458
- root . join ( "../openblas-src/source" ) ,
470
+ get_openblas_source ( ) ,
459
471
root. join ( "test_build/build_no_shared" ) ,
460
472
)
461
473
. unwrap ( ) ;
@@ -470,7 +482,7 @@ mod tests {
470
482
opt. no_lapacke = true ;
471
483
let detail = opt
472
484
. build (
473
- root . join ( "../openblas-src/source" ) ,
485
+ get_openblas_source ( ) ,
474
486
root. join ( "test_build/build_no_lapacke" ) ,
475
487
)
476
488
. unwrap ( ) ;
Original file line number Diff line number Diff line change 1
1
use std:: { env, path:: * , process:: Command } ;
2
2
3
+ const OPENBLAS_VERSION : & str = "0.3.21" ;
4
+
3
5
fn feature_enabled ( feature : & str ) -> bool {
4
6
env:: var ( format ! ( "CARGO_FEATURE_{}" , feature. to_uppercase( ) ) ) . is_ok ( )
5
7
}
@@ -158,13 +160,12 @@ fn build() {
158
160
) ;
159
161
}
160
162
161
- let openblas_version = "0.3.21" ;
162
163
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 ) ) ;
164
165
if !source. exists ( ) {
165
166
Command :: new ( "tar" )
166
167
. arg ( "xf" )
167
- . arg ( format ! ( "OpenBLAS-{}.tar.gz" , openblas_version ) )
168
+ . arg ( format ! ( "OpenBLAS-{}.tar.gz" , OPENBLAS_VERSION ) )
168
169
. current_dir ( env ! ( "CARGO_MANIFEST_DIR" ) )
169
170
. status ( )
170
171
. expect ( "tar command not found" ) ;
@@ -243,7 +244,10 @@ fn build() {
243
244
if source_tmp. exists ( ) {
244
245
fs:: remove_dir_all ( & source_tmp) . unwrap ( ) ;
245
246
}
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) ) ;
247
251
fs:: rename ( & source_tmp, & source) . unwrap ( ) ;
248
252
}
249
253
for name in & vec ! [ "CC" , "FC" , "HOSTCC" ] {
You can’t perform that action at this time.
0 commit comments