OpenCV and OpenBLAS: add external find support (#30240)

Added support for finding the OpenCV package via the find external
command. Included support for identifying variants based on available
shared libraries.

Added support to finding the OpenBLAS package via the find external
command.

Enabled packages to show that they can be discovered via the find
external command in the info message.

Updated the OpenCV and OpenBLAS packages to use the extensible search
mechanism for library extensions on multiple OS platforms.

Corrected how find externals works on Darwin for OpenCV and OpenBLAS
to accommodate that the version numbers are placed before the file
extension instead of after it, as on Linux.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Co-authored-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Brian Van Essen
2022-05-03 00:04:50 -07:00
committed by GitHub
parent 84611b5f29
commit 4576fbe648
5 changed files with 86 additions and 8 deletions

View File

@@ -64,6 +64,7 @@
'is_exe',
'join_path',
'last_modification_time_recursive',
'library_extensions',
'mkdirp',
'partition_path',
'prefixes',
@@ -109,12 +110,15 @@ def path_contains_subdirectory(path, root):
return norm_path.startswith(norm_root)
#: This generates the library filenames that may appear on any OS.
library_extensions = ['a', 'la', 'so', 'tbd', 'dylib']
def possible_library_filenames(library_names):
"""Given a collection of library names like 'libfoo', generate the set of
library filenames that may be found on the system (e.g. libfoo.so). This
generates the library filenames that may appear on any OS.
library filenames that may be found on the system (e.g. libfoo.so).
"""
lib_extensions = ['a', 'la', 'so', 'tbd', 'dylib']
lib_extensions = library_extensions
return set(
'.'.join((lib, extension)) for lib, extension in
itertools.product(library_names, lib_extensions))