fix(cpn): llvm clang dll filename change breaking libsimulator builds (#4775)

This commit is contained in:
Peter Feerick
2024-03-24 07:33:53 +10:00
committed by GitHub
parent 49c1cb8b73
commit 80f5d3ddc6
+14 -2
View File
@@ -4,6 +4,7 @@
#
import os
import sys
import re
from clang.cindex import *
@@ -82,12 +83,20 @@ def findLibClang():
else:
# Unsupported platform
return None
for path in knownPaths:
# print("trying " + path)
if os.path.exists(path + "/libclang" + libSuffix):
return path
elif (sys.platform == "win32" or sys.platform == "msys"):
# Check for versioned and non-versioned libclang.dll if on msys
pattern = re.compile(r'^libclang(-\d+(\.\d+)?)?\.dll$')
if os.path.exists(path):
for filename in os.listdir(path):
if pattern.match(filename):
return os.path.join(path, filename)
# If no known path is found
return None
def initLibClang():
@@ -100,13 +109,16 @@ def initLibClang():
Config.set_library_path(library_path)
else:
Config.set_library_file(library_path)
else:
print("WARN (find_clang): libclang path not found", file=sys.stderr)
Config.set_compatibility_check(False)
try:
index = Index.create()
except Exception as e:
print("ERROR: could not load libclang from '%s'." % library_path, file=sys.stderr)
print("ERROR (find_clang): could not load libclang from '%s'." % library_path, file=sys.stderr)
print(" : detected platform '%s'" % sys.platform, file=sys.stderr)
return False
global builtin_hdr_path