@@ -7,8 +7,8 @@ extern crate num_cpus;
77extern crate pkg_config;
88extern crate regex;
99
10- use etrace:: some_or;
1110use etrace:: ok_or;
11+ use etrace:: some_or;
1212use itertools:: Itertools ;
1313use regex:: Regex ;
1414use std:: cmp:: Ordering ;
@@ -183,19 +183,22 @@ impl State {
183183 fn find_dpdk ( & mut self ) {
184184 // To find correct lib path of this platform.
185185
186- let dpdk: std:: result:: Result < pkg_config:: Library , pkg_config:: Error > = pkg_config:: Config :: new ( ) . statik ( true ) . probe ( "libdpdk" ) ;
187- let dpdk = ok_or ! ( dpdk, panic!( "DPDK is not installed on your system! (Cannot find libdpdk)" ) ) ;
188-
189-
190- for include_path in & dpdk. include_paths {
186+ let dpdk: std:: result:: Result < pkg_config:: Library , pkg_config:: Error > =
187+ pkg_config:: Config :: new ( ) . statik ( true ) . probe ( "libdpdk" ) ;
188+ let dpdk = ok_or ! (
189+ dpdk,
190+ panic!( "DPDK is not installed on your system! (Cannot find libdpdk)" )
191+ ) ;
192+
193+ for include_path in & dpdk. include_paths {
191194 let config_header = include_path. join ( "rte_config.h" ) ;
192- if config_header. exists ( ) {
195+ if config_header. exists ( ) {
193196 println ! ( "cargo:rerun-if-changed={}" , include_path. to_str( ) . unwrap( ) ) ;
194197 self . include_path = Some ( include_path. clone ( ) ) ;
195198 self . dpdk_config = Some ( config_header) ;
196199 }
197200 }
198- if self . dpdk_config . is_none ( ) || self . include_path . is_none ( ) {
201+ if self . dpdk_config . is_none ( ) || self . include_path . is_none ( ) {
199202 panic ! ( "DPDK is not installed on your system! (Cannot find rte_config.h)" ) ;
200203 }
201204
@@ -206,7 +209,7 @@ impl State {
206209 } ;
207210
208211 println ! ( "cargo:rerun-if-changed={}" , library_path. to_str( ) . unwrap( ) ) ;
209-
212+
210213 self . library_path = Some ( library_path) ;
211214 for entry in self
212215 . project_path
@@ -492,31 +495,33 @@ impl State {
492495 fs:: remove_file ( target_bin_path. clone ( ) ) . unwrap ( ) ;
493496 }
494497 let dpdk = self . dpdk . as_ref ( ) . unwrap ( ) ;
495- let includes = dpdk. include_paths . iter ( ) . map ( |x| format ! ( "-I{}" , x. to_str( ) . unwrap( ) ) ) ;
498+ let includes = dpdk
499+ . include_paths
500+ . iter ( )
501+ . map ( |x| format ! ( "-I{}" , x. to_str( ) . unwrap( ) ) ) ;
496502 let libs = dpdk. libs . iter ( ) . map ( |x| format ! ( "-l{}" , x) ) ;
497- let ret: std:: result:: Result < std:: process:: Output , Error > = Command :: new ( cc_name. clone ( ) )
498- . arg ( "-Wall" )
499- . arg ( "-Wextra" )
500- . arg ( "-std=gnu11" )
501- . args ( includes)
502- . arg ( format ! ( "-I{}" , output_include) )
503- . arg ( "-include" )
504- . arg ( dpdk_config_path)
505- . arg ( "-march=native" )
506- . arg ( format ! ( "-D__CHECK_FN={}" , name) )
507- . arg ( "-o" )
508- . arg ( target_bin_path. clone ( ) )
509- . args ( libs)
510- . arg ( test_template. clone ( ) )
511- . output ( ) ;
503+ let ret: std:: result:: Result < std:: process:: Output , Error > =
504+ Command :: new ( cc_name. clone ( ) )
505+ . arg ( "-Wall" )
506+ . arg ( "-Wextra" )
507+ . arg ( "-std=gnu11" )
508+ . args ( includes)
509+ . arg ( format ! ( "-I{}" , output_include) )
510+ . arg ( "-include" )
511+ . arg ( dpdk_config_path)
512+ . arg ( "-march=native" )
513+ . arg ( format ! ( "-D__CHECK_FN={}" , name) )
514+ . arg ( "-o" )
515+ . arg ( target_bin_path. clone ( ) )
516+ . args ( libs)
517+ . arg ( test_template. clone ( ) )
518+ . output ( ) ;
512519 if let Ok ( ret) = ret {
513520 if ret. status . success ( ) {
514521 success = true ;
515522 // println!("cargo:warning={} compile success {}", name, success);
516- } else {
517-
518- println ! ( "cargo:warning={:?} compile failed" , ret) ;
519- panic ! ( "@@@" ) ;
523+ } else {
524+ panic ! ( "cargo:warning={:?} compile failed" , ret) ;
520525 }
521526 }
522527 is_always_inline_fn. insert ( name. clone ( ) , success) ;
0 commit comments