bindings: improve search of linked libraries and include directories

This commit is contained in:
Gabriel Ferreira
2022-11-16 02:23:47 -03:00
parent 9ac4410af2
commit f9eb5a7327

View File

@@ -74,6 +74,10 @@ def _search_libraries() -> dict:
library_search_paths += [os.path.dirname(library_search_paths[-1])]
library_search_paths += [os.path.dirname(library_search_paths[-1])]
# Filter unique search paths and those that are not part of system directories
library_search_paths = list(filter(lambda x: x not in SYSTEM_LIBRARY_DIRECTORIES,
set(library_search_paths)))
# Search for the core library in the search paths
libraries = []
for search_path in library_search_paths:
@@ -82,6 +86,7 @@ def _search_libraries() -> dict:
# Search system library directories (too slow for recursive search)
for search_path in SYSTEM_LIBRARY_DIRECTORIES:
libraries += glob.glob("%s/**/*.%s*" % (search_path, LIBRARY_EXTENSION), recursive=False)
libraries += glob.glob("%s/*.%s*" % (search_path, LIBRARY_EXTENSION), recursive=False)
del search_path, library_search_paths
@@ -343,7 +348,8 @@ def load_modules():
for linked_lib_include_dir in extract_library_include_dirs(library, prefix):
if linked_lib_include_dir not in known_include_dirs:
known_include_dirs.add(linked_lib_include_dir)
cppyy.add_include_path(linked_lib_include_dir)
if os.path.isdir(linked_lib_include_dir):
cppyy.add_include_path(linked_lib_include_dir)
for module in modules:
cppyy.include("ns3/%s-module.h" % module)