Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
5408b17f
Unverified
Commit
5408b17f
authored
Sep 25, 2020
by
aviezab
Committed by
GitHub
Sep 25, 2020
Browse files
Linux Distro Detection to fix issue number #2159 #154 (#2169)
Check if the blas found by pkgconfig is valid before using it.
parent
0419b816
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
dlib/cmake_utils/find_blas.cmake
dlib/cmake_utils/find_blas.cmake
+7
-6
No files found.
dlib/cmake_utils/find_blas.cmake
View file @
5408b17f
...
@@ -30,6 +30,7 @@ SET(lapack_with_underscore 0)
...
@@ -30,6 +30,7 @@ SET(lapack_with_underscore 0)
SET
(
lapack_without_underscore 0
)
SET
(
lapack_without_underscore 0
)
message
(
STATUS
"Searching for BLAS and LAPACK"
)
message
(
STATUS
"Searching for BLAS and LAPACK"
)
INCLUDE
(
CheckFunctionExists
)
if
(
UNIX OR MINGW
)
if
(
UNIX OR MINGW
)
message
(
STATUS
"Searching for BLAS and LAPACK"
)
message
(
STATUS
"Searching for BLAS and LAPACK"
)
...
@@ -62,11 +63,15 @@ if (UNIX OR MINGW)
...
@@ -62,11 +63,15 @@ if (UNIX OR MINGW)
return
()
return
()
endif
()
endif
()
# First, search for libraries via pkg-config, which is the cleanest path
# First, search for libraries via pkg-config, which is the cleanest path
find_package
(
PkgConfig
)
find_package
(
PkgConfig
)
pkg_check_modules
(
BLAS_REFERENCE cblas
)
pkg_check_modules
(
BLAS_REFERENCE cblas
)
pkg_check_modules
(
LAPACK_REFERENCE lapack
)
pkg_check_modules
(
LAPACK_REFERENCE lapack
)
if
(
BLAS_REFERENCE_FOUND AND LAPACK_REFERENCE_FOUND
)
# Make sure the cblas found by pkgconfig actually has cblas symbols.
SET
(
CMAKE_REQUIRED_LIBRARIES
"
${
BLAS_REFERENCE_LDFLAGS
}
"
)
CHECK_FUNCTION_EXISTS
(
cblas_ddot HAVE_CBLAS
)
if
(
BLAS_REFERENCE_FOUND AND LAPACK_REFERENCE_FOUND AND HAVE_CBLAS
)
set
(
blas_libraries
"
${
BLAS_REFERENCE_LDFLAGS
}
"
)
set
(
blas_libraries
"
${
BLAS_REFERENCE_LDFLAGS
}
"
)
set
(
lapack_libraries
"
${
LAPACK_REFERENCE_LDFLAGS
}
"
)
set
(
lapack_libraries
"
${
LAPACK_REFERENCE_LDFLAGS
}
"
)
set
(
blas_found 1
)
set
(
blas_found 1
)
...
@@ -189,8 +194,6 @@ if (UNIX OR MINGW)
...
@@ -189,8 +194,6 @@ if (UNIX OR MINGW)
$ENV{OPENBLAS_HOME}/lib
$ENV{OPENBLAS_HOME}/lib
)
)
INCLUDE
(
CheckFunctionExists
)
if
(
NOT blas_found
)
if
(
NOT blas_found
)
find_library
(
cblas_lib NAMES openblasp openblas PATHS
${
extra_paths
}
)
find_library
(
cblas_lib NAMES openblasp openblas PATHS
${
extra_paths
}
)
if
(
cblas_lib
)
if
(
cblas_lib
)
...
@@ -337,7 +340,6 @@ elseif(WIN32 AND NOT MINGW)
...
@@ -337,7 +340,6 @@ elseif(WIN32 AND NOT MINGW)
find_library
(
mkl_intel mkl_intel_c
${
mkl_search_path
}
)
find_library
(
mkl_intel mkl_intel_c
${
mkl_search_path
}
)
endif
()
endif
()
INCLUDE
(
CheckFunctionExists
)
# Get mkl_include_dir
# Get mkl_include_dir
set
(
mkl_include_search_path
set
(
mkl_include_search_path
...
@@ -432,7 +434,6 @@ endif()
...
@@ -432,7 +434,6 @@ endif()
# If using lapack, determine whether to mangle functions
# If using lapack, determine whether to mangle functions
if
(
lapack_found
)
if
(
lapack_found
)
include
(
CheckFunctionExists
)
include
(
CheckFortranFunctionExists
)
include
(
CheckFortranFunctionExists
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
lapack_libraries
}
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
lapack_libraries
}
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment