@@ -25,7 +25,7 @@ impl Version {
2525 }
2626
2727 pub fn parse ( s : & str ) -> Option < Self > {
28- let re = Regex :: new ( r"^(1)\.(8|10)\.(\d\d?)(_\d+)?(-patch\d+)?$" ) . ok ( ) ?;
28+ let re = Regex :: new ( r"^(1)\.(8|10|12 )\.(\d\d?)(_\d+)?(-patch\d+)?$" ) . ok ( ) ?;
2929 let captures = re. captures ( s) ?;
3030 Some ( Self {
3131 major : captures. get ( 1 ) . and_then ( |c| c. as_str ( ) . parse :: < u8 > ( ) . ok ( ) ) ?,
@@ -35,7 +35,10 @@ impl Version {
3535 }
3636
3737 pub fn is_valid ( self ) -> bool {
38- self . major == 1 && ( ( self . minor == 8 && self . micro >= 4 ) || ( self . minor == 10 ) )
38+ self . major == 1
39+ && ( ( self . minor == 8 && self . micro >= 4 )
40+ || ( self . minor == 10 )
41+ || ( self . minor == 12 && self . micro == 0 ) )
3942 }
4043}
4144
@@ -297,35 +300,55 @@ mod macos {
297300 }
298301 // We have to explicitly support homebrew since the HDF5 bottle isn't
299302 // packaged with pkg-config metadata.
300- let ( v18, v110) = if let Some ( version) = config. version {
301- ( version. major == 1 && version. minor == 8 , version. major == 1 && version. minor == 10 )
303+ let ( v18, v110, v112) = if let Some ( version) = config. version {
304+ (
305+ version. major == 1 && version. minor == 8 ,
306+ version. major == 1 && version. minor == 10 ,
307+ version. major == 1 && version. minor == 12 ,
308+ )
302309 } else {
303- ( false , false )
310+ ( false , false , false )
304311 } ;
305312 println ! (
306313 "Attempting to find HDF5 via Homebrew ({})..." ,
307314 if v18 {
308315 "1.8.*"
309316 } else if v110 {
310317 "1.10.*"
318+ } else if v112 {
319+ "1.12.*"
311320 } else {
312321 "any version"
313322 }
314323 ) ;
315- if !v18 {
324+ if !( v18 || v110) {
325+ if let Some ( out
) =
run_command ( "brew" , & [ "--prefix" , "[email protected] " ] ) { 326+ if is_root_dir ( & out) {
327+ config. inc_dir = Some ( PathBuf :: from ( out) . join ( "include" ) ) ;
328+ }
329+ }
330+ }
331+ if config. inc_dir . is_none ( ) && !v18 {
316332 if let Some ( out
) =
run_command ( "brew" , & [ "--prefix" , "[email protected] " ] ) { 317333 if is_root_dir ( & out) {
318334 config. inc_dir = Some ( PathBuf :: from ( out) . join ( "include" ) ) ;
319335 }
320336 }
321337 }
322- if config. inc_dir . is_none ( ) && !v110 {
338+ if config. inc_dir . is_none ( ) {
323339 if let Some ( out
) =
run_command ( "brew" , & [ "--prefix" , "[email protected] " ] ) { 324340 if is_root_dir ( & out) {
325341 config. inc_dir = Some ( PathBuf :: from ( out) . join ( "include" ) ) ;
326342 }
327343 }
328344 }
345+ if config. inc_dir . is_none ( ) {
346+ if let Some ( out) = run_command ( "brew" , & [ "--prefix" , "hdf5-mpi" ] ) {
347+ if is_root_dir ( & out) {
348+ config. inc_dir = Some ( PathBuf :: from ( out) . join ( "include" ) ) ;
349+ }
350+ }
351+ }
329352 if let Some ( ref inc_dir) = config. inc_dir {
330353 println ! ( "Found Homebrew HDF5 headers at:" ) ;
331354 println ! ( " {:?}" , inc_dir) ;
@@ -592,6 +615,7 @@ impl Config {
592615 assert ! ( version >= Version :: new( 1 , 8 , 4 ) , "required HDF5 version: >=1.8.4" ) ;
593616 let mut vs: Vec < _ > = ( 5 ..=21 ) . map ( |v| Version :: new ( 1 , 8 , v) ) . collect ( ) ; // 1.8.[5-21]
594617 vs. extend ( ( 0 ..=5 ) . map ( |v| Version :: new ( 1 , 10 , v) ) ) ; // 1.10.[0-5]
618+ vs. push ( Version :: new ( 1 , 12 , 0 ) ) ; // 1.12.0
595619 for v in vs. into_iter ( ) . filter ( |& v| version >= v) {
596620 println ! ( "cargo:rustc-cfg=hdf5_{}_{}_{}" , v. major, v. minor, v. micro) ;
597621 println ! ( "cargo:version_{}_{}_{}=1" , v. major, v. minor, v. micro) ;
0 commit comments