@@ -221,7 +221,7 @@ public void SetupXcode()
221
221
AddArguments ( "-stdlib=libc++" ) ;
222
222
}
223
223
224
- private void GetUnixCompilerInfo ( out string compiler , out string version )
224
+ private void GetUnixCompilerInfo ( out string compiler , out string longVersion , out string shortVersion )
225
225
{
226
226
var info = new ProcessStartInfo ( Environment . GetEnvironmentVariable ( "CXX" ) ?? "gcc" , "-v" ) ;
227
227
info . RedirectStandardError = true ;
@@ -233,12 +233,13 @@ private void GetUnixCompilerInfo(out string compiler, out string version)
233
233
process . WaitForExit ( ) ;
234
234
235
235
var output = process . StandardError . ReadToEnd ( ) ;
236
- var match = Regex . Match ( output , "(gcc|clang) version ([0-9\\ .]+)" ) ;
236
+ var match = Regex . Match ( output , "(gcc|clang) version (( [0-9]+ \\ .[0-9]+) \\ .[0-9 ]+)" ) ;
237
237
if ( ! match . Success )
238
238
throw new SystemException ( "GCC compiler was not found." ) ;
239
239
240
240
compiler = match . Groups [ 1 ] . ToString ( ) ;
241
- version = match . Groups [ 2 ] . ToString ( ) ;
241
+ longVersion = match . Groups [ 2 ] . ToString ( ) ;
242
+ shortVersion = match . Groups [ 3 ] . ToString ( ) ;
242
243
}
243
244
244
245
public void SetupLinux ( string headersPath = "" )
@@ -248,22 +249,28 @@ public void SetupLinux(string headersPath="")
248
249
NoStandardIncludes = true ;
249
250
Abi = CppAbi . Itanium ;
250
251
251
- string compiler , version ;
252
- GetUnixCompilerInfo ( out compiler , out version ) ;
253
- Console . WriteLine ( $ "Compiler version: { compiler } / { version } " ) ;
252
+ string compiler , longVersion , shortVersion ;
253
+ GetUnixCompilerInfo ( out compiler , out longVersion , out shortVersion ) ;
254
+ string [ ] versions = { longVersion , shortVersion } ;
254
255
AddSystemIncludeDirs ( $ "{ headersPath } /usr/include") ;
255
256
if ( compiler == "gcc" )
256
257
{
257
- AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/c++/{ version } ") ;
258
- AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/x86_64-linux-gnu/c++/{ version } ") ;
259
- AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/c++/{ version } /backward") ;
258
+ foreach ( var version in versions )
259
+ {
260
+ AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/c++/{ version } ") ;
261
+ AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/x86_64-linux-gnu/c++/{ version } ") ;
262
+ AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/c++/{ version } /backward") ;
263
+ }
260
264
}
261
265
string [ ] tripples = { "x86_64-linux-gnu" , "x86_64-pc-linux-gnu" } ;
262
266
foreach ( var tripple in tripples )
263
267
{
264
- AddSystemIncludeDirs ( $ "{ headersPath } /usr/lib/{ compiler } /{ tripple } /{ version } /include") ;
265
- AddSystemIncludeDirs ( $ "{ headersPath } /usr/lib/{ compiler } /{ tripple } /{ version } /include/c++") ;
266
- AddSystemIncludeDirs ( $ "{ headersPath } /usr/lib/{ compiler } /{ tripple } /{ version } /include/c++/{ tripple } ") ;
268
+ foreach ( var version in versions )
269
+ {
270
+ AddSystemIncludeDirs ( $ "{ headersPath } /usr/lib/{ compiler } /{ tripple } /{ version } /include") ;
271
+ AddSystemIncludeDirs ( $ "{ headersPath } /usr/lib/{ compiler } /{ tripple } /{ version } /include/c++") ;
272
+ AddSystemIncludeDirs ( $ "{ headersPath } /usr/lib/{ compiler } /{ tripple } /{ version } /include/c++/{ tripple } ") ;
273
+ }
267
274
AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/{ tripple } ") ;
268
275
}
269
276
}
0 commit comments