@@ -221,7 +221,7 @@ public void SetupXcode()
221221 AddArguments ( "-stdlib=libc++" ) ;
222222 }
223223
224- private void GetUnixCompilerInfo ( out string compiler , out string version )
224+ private void GetUnixCompilerInfo ( out string compiler , out string longVersion , out string shortVersion )
225225 {
226226 var info = new ProcessStartInfo ( Environment . GetEnvironmentVariable ( "CXX" ) ?? "gcc" , "-v" ) ;
227227 info . RedirectStandardError = true ;
@@ -233,12 +233,13 @@ private void GetUnixCompilerInfo(out string compiler, out string version)
233233 process . WaitForExit ( ) ;
234234
235235 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 ]+)" ) ;
237237 if ( ! match . Success )
238238 throw new SystemException ( "GCC compiler was not found." ) ;
239239
240240 compiler = match . Groups [ 1 ] . ToString ( ) ;
241- version = match . Groups [ 2 ] . ToString ( ) ;
241+ longVersion = match . Groups [ 2 ] . ToString ( ) ;
242+ shortVersion = match . Groups [ 3 ] . ToString ( ) ;
242243 }
243244
244245 public void SetupLinux ( string headersPath = "" )
@@ -248,22 +249,28 @@ public void SetupLinux(string headersPath="")
248249 NoStandardIncludes = true ;
249250 Abi = CppAbi . Itanium ;
250251
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 } ;
254255 AddSystemIncludeDirs ( $ "{ headersPath } /usr/include") ;
255256 if ( compiler == "gcc" )
256257 {
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+ }
260264 }
261265 string [ ] tripples = { "x86_64-linux-gnu" , "x86_64-pc-linux-gnu" } ;
262266 foreach ( var tripple in tripples )
263267 {
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+ }
267274 AddSystemIncludeDirs ( $ "{ headersPath } /usr/include/{ tripple } ") ;
268275 }
269276 }
0 commit comments