Commit c5c49994 authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Fix issue with additional libs in dynamic libraries detection

parent c4527805
......@@ -92,6 +92,12 @@ macro(cblas_init_variables BLAS)
# This macro can be called for initialization and/or
# extension of cblas discovery
message( DEBUG "[CBLAS] ${BLAS}_LIBRARIES: ${${BLAS}_LIBRARIES}")
message( DEBUG "[CBLAS] ${BLAS}_LIBRARY_DIRS: ${${BLAS}_LIBRARY_DIRS}")
message( DEBUG "[CBLAS] ${BLAS}_INCLUDE_DIRS: ${${BLAS}_INCLUDE_DIRS}")
message( DEBUG "[CBLAS] ${BLAS}_CFLAGS_OTHER: ${${BLAS}_CFLAGS_OTHER}")
message( DEBUG "[CBLAS] ${BLAS}_LDFLAGS_OTHER: ${${BLAS}_LDFLAGS_OTHER}")
if (${BLAS}_LIBRARIES)
set(CBLAS_BLAS ${BLAS})
list(APPEND CBLAS_LIBRARIES "${${BLAS}_LIBRARIES}")
......@@ -117,7 +123,7 @@ macro(cblas_init_variables BLAS)
morse_cleanup_variables(CBLAS)
message( DEBUG "[CBLAS] CBLAS_LAPACK: ${CBLAS_LAPACK}")
message( DEBUG "[CBLAS] CBLAS_BLAS: ${CBLAS_BLAS}")
message( DEBUG "[CBLAS] CBLAS_LIBRARIES: ${CBLAS_LIBRARIES}")
message( DEBUG "[CBLAS] CBLAS_LIBRARY_DIRS: ${CBLAS_LIBRARY_DIRS}")
message( DEBUG "[CBLAS] CBLAS_INCLUDE_DIRS: ${CBLAS_INCLUDE_DIRS}")
......@@ -328,11 +334,11 @@ if (CBLAS_BLAS)
# Need to add dependencies if not found with pkg-config
# -----------------------------------------------------
if (NOT CBLAS_FOUND_WITH_PKGCONFIG)
# Extend the discovered with lapack
cblas_init_variables(${CBLAS_LAPACK})
else()
if (CBLAS_STATIC OR BLA_STATIC)
if (CBLAS_STATIC OR BLA_STATIC)
if (NOT CBLAS_FOUND_WITH_PKGCONFIG)
# Extend the discovered library with the blas ones
cblas_init_variables(${CBLAS_BLAS})
else()
# save link with dependencies
set(CBLAS_LIBRARIES "${CBLAS_STATIC_LIBRARIES}")
endif()
......
......@@ -87,6 +87,12 @@ macro(lapacke_init_variables LAPACK)
# This macro can be called for initialization and/or
# extension of lapacke discovery
message( DEBUG "[LAPACKE] ${LAPACK}_LIBRARIES: ${${LAPACK}_LIBRARIES}")
message( DEBUG "[LAPACKE] ${LAPACK}_LIBRARY_DIRS: ${${LAPACK}_LIBRARY_DIRS}")
message( DEBUG "[LAPACKE] ${LAPACK}_INCLUDE_DIRS: ${${LAPACK}_INCLUDE_DIRS}")
message( DEBUG "[LAPACKE] ${LAPACK}_CFLAGS_OTHER: ${${LAPACK}_CFLAGS_OTHER}")
message( DEBUG "[LAPACKE] ${LAPACK}_LDFLAGS_OTHER: ${${LAPACK}_LDFLAGS_OTHER}")
if (${LAPACK}_LIBRARIES)
set(LAPACKE_LAPACK ${LAPACK})
list(APPEND LAPACKE_LIBRARIES "${${LAPACK}_LIBRARIES}")
......@@ -208,7 +214,10 @@ if (LAPACKE_WITH_TMG)
find_package(TMG)
endif()
# Lapacke depends only on TMG, which itself depends on the correct
# lapack. No need to look for the MT/SEQ one anymore
set( LAPACKE_dep TMG )
unset(LAPACKE_MT)
else()
# LAPACKE depends on LAPACK, try to find it
......@@ -362,11 +371,11 @@ if (LAPACKE_LAPACK)
# Need to add dependencies if not found with pkg-config
# -----------------------------------------------------
if (NOT LAPACKE_FOUND_WITH_PKGCONFIG)
# Extend the discovered with lapack
lapacke_init_variables(${LAPACKE_LAPACK})
else()
if (LAPACKE_STATIC OR CBLAS_STATIC OR BLA_STATIC)
if (LAPACKE_STATIC OR CBLAS_STATIC OR BLA_STATIC)
if (NOT LAPACKE_FOUND_WITH_PKGCONFIG)
# Extend the discovered library with the lapack ones
lapacke_init_variables(${LAPACKE_LAPACK})
else()
# save link with dependencies
set(LAPACKE_LIBRARIES "${LAPACKE_STATIC_LIBRARIES}")
endif()
......
......@@ -76,6 +76,12 @@ macro(tmg_init_variables LAPACK)
# This macro can be called for initialization and/or
# extension of tmg discovery
message( DEBUG "[TMG] ${LAPACK}_LIBRARIES: ${${LAPACK}_LIBRARIES}")
message( DEBUG "[TMG] ${LAPACK}_LIBRARY_DIRS: ${${LAPACK}_LIBRARY_DIRS}")
message( DEBUG "[TMG] ${LAPACK}_INCLUDE_DIRS: ${${LAPACK}_INCLUDE_DIRS}")
message( DEBUG "[TMG] ${LAPACK}_CFLAGS_OTHER: ${${LAPACK}_CFLAGS_OTHER}")
message( DEBUG "[TMG] ${LAPACK}_LDFLAGS_OTHER: ${${LAPACK}_LDFLAGS_OTHER}")
if (${LAPACK}_LIBRARIES)
set(TMG_LAPACK ${LAPACK})
list(APPEND TMG_LIBRARIES "${${LAPACK}_LIBRARIES}")
......@@ -116,13 +122,13 @@ macro(tmg_check_library _verbose)
morse_cmake_required_set(TMG)
unset(TMG_WORKS CACHE)
unset(TMG_dlarnv_WORKS CACHE)
unset(TMG_dlatms_WORKS CACHE)
unset(TMG_dlagsy_WORKS CACHE)
if (NOT _LANGUAGES_ MATCHES Fortran)
check_function_exists(dlarnv TMG_dlarnv_WORKS)
check_function_exists(dlatms TMG_dlatms_WORKS)
else (NOT _LANGUAGES_ MATCHES Fortran)
check_fortran_function_exists(dlarnv TMG_dlarnv_WORKS)
check_fortran_function_exists(dlatms TMG_dlatms_WORKS)
endif (NOT _LANGUAGES_ MATCHES Fortran)
if (NOT _LANGUAGES_ MATCHES Fortran)
......@@ -131,14 +137,14 @@ macro(tmg_check_library _verbose)
check_fortran_function_exists(dlagsy TMG_dlagsy_WORKS)
endif (NOT _LANGUAGES_ MATCHES Fortran)
if ( TMG_dlarnv_WORKS AND TMG_dlagsy_WORKS )
if ( TMG_dlatms_WORKS AND TMG_dlagsy_WORKS )
set(TMG_WORKS TRUE)
mark_as_advanced(TMG_WORKS)
endif()
if(${_verbose})
if((NOT TMG_WORKS) AND (NOT TMG_FIND_QUIETLY))
message(STATUS "Looking for tmg: test of dlarnv and dlagsy with tmg and lapack libraries fails")
message(STATUS "Looking for tmg: test of dlatms and dlagsy with tmg and lapack libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
......@@ -157,10 +163,6 @@ else()
find_package(LAPACKEXT QUIET)
endif()
message( DEBUG "LAPACK_LIBRARIES: ${LAPACK_LIBRARIES}" )
message( DEBUG "LAPACK_SEQ_LIBRARIES: ${LAPACK_SEQ_LIBRARIES}" )
message( DEBUG "LAPACK_MT_LIBRARIES: ${LAPACK_MT_LIBRARIES}" )
if(DEFINED TMG_MT)
if (TMG_MT)
tmg_init_variables("LAPACK_MT")
......@@ -229,7 +231,9 @@ if (TMG_LAPACK)
endif()
# Extend the tmg variables with the lapack ones
tmg_init_variables(${TMG_LAPACK})
if (LAPACKE_STATIC OR CBLAS_STATIC OR BLA_STATIC)
tmg_init_variables(${TMG_LAPACK})
endif()
# test link
tmg_check_library(TRUE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment