Explorar o código

GetGCCRoot() for usual toolchain dir structures

So don't depend on any special assumptions. See comments in the codes.
hollylee %!s(int64=5) %!d(string=hai) anos
pai
achega
723ca994e7
Modificáronse 1 ficheiros con 18 adicións e 0 borrados
  1. 18 0
      tools/gcc.py

+ 18 - 0
tools/gcc.py

@@ -37,6 +37,24 @@ def GetGCCRoot(rtconfig):
     else:
         root_path = os.path.join(exec_path, '..', prefix)
 
+    # Usually the cross compiling gcc toolchain has directory as:
+    #
+    # bin
+    # lib
+    # share
+    # arm-none-eabi
+    #    bin
+    #    include
+    #    lib
+    #    share
+    prefix = rtconfig.PREFIX
+    if prefix.endswith('-'):
+        prefix = prefix[:-1]
+
+    fn = os.path.join(root, prefix, 'include', filename)
+    if os.path.isfile(fn):
+        return True
+    
     return root_path
 
 def CheckHeader(rtconfig, filename):