fix(cpn): llvm clang dll filename change breaking libsimulator builds (#4775)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
from clang.cindex import *
|
from clang.cindex import *
|
||||||
|
|
||||||
@@ -87,7 +88,15 @@ def findLibClang():
|
|||||||
# print("trying " + path)
|
# print("trying " + path)
|
||||||
if os.path.exists(path + "/libclang" + libSuffix):
|
if os.path.exists(path + "/libclang" + libSuffix):
|
||||||
return path
|
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
|
return None
|
||||||
|
|
||||||
def initLibClang():
|
def initLibClang():
|
||||||
@@ -100,13 +109,16 @@ def initLibClang():
|
|||||||
Config.set_library_path(library_path)
|
Config.set_library_path(library_path)
|
||||||
else:
|
else:
|
||||||
Config.set_library_file(library_path)
|
Config.set_library_file(library_path)
|
||||||
|
else:
|
||||||
|
print("WARN (find_clang): libclang path not found", file=sys.stderr)
|
||||||
|
|
||||||
Config.set_compatibility_check(False)
|
Config.set_compatibility_check(False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
index = Index.create()
|
index = Index.create()
|
||||||
except Exception as e:
|
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
|
return False
|
||||||
|
|
||||||
global builtin_hdr_path
|
global builtin_hdr_path
|
||||||
|
|||||||
Reference in New Issue
Block a user