File tree 3 files changed +16
-4
lines changed
3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -758,7 +758,7 @@ fn configure_cmake(
758
758
759
759
cfg. build_arg ( "-j" ) . build_arg ( builder. jobs ( ) . to_string ( ) ) ;
760
760
let mut cflags: OsString = builder
761
- . cflags ( target, GitRepo :: Llvm , CLang :: C )
761
+ . extra_cflags ( target, GitRepo :: Llvm , CLang :: C )
762
762
. into_iter ( )
763
763
. filter ( |flag| {
764
764
!suppressed_compiler_flag_prefixes
@@ -778,7 +778,7 @@ fn configure_cmake(
778
778
}
779
779
cfg. define ( "CMAKE_C_FLAGS" , cflags) ;
780
780
let mut cxxflags: OsString = builder
781
- . cflags ( target, GitRepo :: Llvm , CLang :: Cxx )
781
+ . extra_cflags ( target, GitRepo :: Llvm , CLang :: Cxx )
782
782
. into_iter ( )
783
783
. filter ( |flag| {
784
784
!suppressed_compiler_flag_prefixes
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ impl Cargo {
307
307
let cc = ccacheify ( & builder. cc ( target) ) ;
308
308
self . command . env ( format ! ( "CC_{triple_underscored}" ) , & cc) ;
309
309
310
- let cflags = builder. cflags ( target, GitRepo :: Rustc , CLang :: C ) . join ( " " ) ;
310
+ let cflags = builder. extra_cflags ( target, GitRepo :: Rustc , CLang :: C ) . join ( " " ) ;
311
311
self . command . env ( format ! ( "CFLAGS_{triple_underscored}" ) , & cflags) ;
312
312
313
313
if let Some ( ar) = builder. ar ( target) {
@@ -319,7 +319,7 @@ impl Cargo {
319
319
320
320
if let Ok ( cxx) = builder. cxx ( target) {
321
321
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 ( " " ) ;
323
323
self . command
324
324
. env ( format ! ( "CXX_{triple_underscored}" ) , & cxx)
325
325
. env ( format ! ( "CXXFLAGS_{triple_underscored}" ) , cxxflags) ;
Original file line number Diff line number Diff line change @@ -1207,6 +1207,18 @@ Executed at: {executed_at}"#,
1207
1207
. filter ( |s| !s. starts_with ( "-O" ) && !s. starts_with ( "/O" ) )
1208
1208
. collect :: < Vec < String > > ( ) ;
1209
1209
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
+
1210
1222
// If we're compiling C++ on macOS then we add a flag indicating that
1211
1223
// we want libc++ (more filled out than libstdc++), ensuring that
1212
1224
// LLVM/etc are all properly compiled.
You can’t perform that action at this time.
0 commit comments