File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -400,14 +400,22 @@ impl Default for Config {
400
400
}
401
401
}
402
402
403
+ /// Convert from a preconfigured [`cc::Build`] object to [`Config`].
404
+ /// Note that this will ensure C++ is enabled and add the proper include
405
+ /// directories to work with `cpp`.
406
+ impl From < cc:: Build > for Config {
407
+ fn from ( mut cc : cc:: Build ) -> Self {
408
+ cc. cpp ( true ) . include ( & * CARGO_MANIFEST_DIR ) ;
409
+ Self { cc, std_flag_set : false }
410
+ }
411
+ }
412
+
403
413
impl Config {
404
414
/// Create a new `Config` object. This object will hold the configuration
405
415
/// options which control the build. If you don't need to make any changes,
406
416
/// `cpp_build::build` is a wrapper function around this interface.
407
417
pub fn new ( ) -> Config {
408
- let mut cc = cc:: Build :: new ( ) ;
409
- cc. cpp ( true ) . include ( & * CARGO_MANIFEST_DIR ) ;
410
- Config { cc, std_flag_set : false }
418
+ cc:: Build :: new ( ) . into ( )
411
419
}
412
420
413
421
/// Add a directory to the `-I` or include path for headers
You can’t perform that action at this time.
0 commit comments