File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -758,7 +758,7 @@ fn configure_cmake(
758758
759759 cfg. build_arg ( "-j" ) . build_arg ( builder. jobs ( ) . to_string ( ) ) ;
760760 let mut cflags: OsString = builder
761- . cflags ( target, GitRepo :: Llvm , CLang :: C )
761+ . extra_cflags ( target, GitRepo :: Llvm , CLang :: C )
762762 . into_iter ( )
763763 . filter ( |flag| {
764764 !suppressed_compiler_flag_prefixes
@@ -778,7 +778,7 @@ fn configure_cmake(
778778 }
779779 cfg. define ( "CMAKE_C_FLAGS" , cflags) ;
780780 let mut cxxflags: OsString = builder
781- . cflags ( target, GitRepo :: Llvm , CLang :: Cxx )
781+ . extra_cflags ( target, GitRepo :: Llvm , CLang :: Cxx )
782782 . into_iter ( )
783783 . filter ( |flag| {
784784 !suppressed_compiler_flag_prefixes
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ impl Cargo {
307307 let cc = ccacheify ( & builder. cc ( target) ) ;
308308 self . command . env ( format ! ( "CC_{triple_underscored}" ) , & cc) ;
309309
310- let cflags = builder. cflags ( target, GitRepo :: Rustc , CLang :: C ) . join ( " " ) ;
310+ let cflags = builder. extra_cflags ( target, GitRepo :: Rustc , CLang :: C ) . join ( " " ) ;
311311 self . command . env ( format ! ( "CFLAGS_{triple_underscored}" ) , & cflags) ;
312312
313313 if let Some ( ar) = builder. ar ( target) {
@@ -319,7 +319,7 @@ impl Cargo {
319319
320320 if let Ok ( cxx) = builder. cxx ( target) {
321321 let cxx = ccacheify ( & cxx) ;
322- let cxxflags = builder. cflags ( target, GitRepo :: Rustc , CLang :: Cxx ) . join ( " " ) ;
322+ let cxxflags = builder. extra_cflags ( target, GitRepo :: Rustc , CLang :: Cxx ) . join ( " " ) ;
323323 self . command
324324 . env ( format ! ( "CXX_{triple_underscored}" ) , & cxx)
325325 . env ( format ! ( "CXXFLAGS_{triple_underscored}" ) , cxxflags) ;
Original file line number Diff line number Diff line change @@ -1207,6 +1207,18 @@ Executed at: {executed_at}"#,
12071207 . filter ( |s| !s. starts_with ( "-O" ) && !s. starts_with ( "/O" ) )
12081208 . collect :: < Vec < String > > ( ) ;
12091209
1210+ base. extend ( self . extra_cflags ( target, which, c) ) ;
1211+
1212+ base
1213+ }
1214+
1215+ /// Returns a list of flags to pass to the C compiler for the target
1216+ /// specified, tailored for invocations that will end up invoking `cc-rs`
1217+ /// or `cmake-rs` (if we were to use `.cflags()` for those, we'd end up
1218+ /// duplicating the flags).
1219+ fn extra_cflags ( & self , target : TargetSelection , which : GitRepo , c : CLang ) -> Vec < String > {
1220+ let mut base = Vec :: new ( ) ;
1221+
12101222 // If we're compiling C++ on macOS then we add a flag indicating that
12111223 // we want libc++ (more filled out than libstdc++), ensuring that
12121224 // LLVM/etc are all properly compiled.
You can’t perform that action at this time.
0 commit comments