Commits (6)
......@@ -11,5 +11,5 @@ Find:
- cd modules/find/tests
- mkdir -p build
- cd build
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DCHAMELEON_COMPONENTS="MPI;FXT;STARPU"
- ctest -V
......@@ -23,18 +23,19 @@ See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
Installation
---------------------
We recommend to use this project as a `git submodule` of your project.
# Example if morse_cmake is defined as a git submodule in ./cmake_modules/
git submodule add https://gitlab.inria.fr/solverstack/morse_cmake.git cmake_modules/morse_cmake
To use MORSE modules you have to add the path to the modules in your
CMake project and include the MorseInit module:
# Define where are located module files on your system
set(MORSE_CMAKE_MODULE_PATH "/where/is/morse_cmake" CACHE PATH "Path to morse_cmake sources")
# Append this directory to the list of directories containing CMake modules
list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}/modules/" )
# Example if Morse CMake modules are located in ./cmake_modules/morse_cmake/modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules" )
# Include the init module
include(MorseInit)
We recommend to use this project as a `git submodule` of your project.
Testing
---------------------
......
......@@ -71,8 +71,17 @@ macro(FIND_PKGCONFIG_LIBRARIES_ABSOLUTE_PATH _prefix)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
# try static first
set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})
# if not found try dynamic
if (NOT _library_path)
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
endif()
if (_library_path)
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library_path})
else()
......
......@@ -18,12 +18,13 @@
# This module sets the following variables:
# BLAS_FOUND - set to true if a library implementing the BLAS interface
# is found
# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# BLAS_LDFLAGS_OTHER - list of required linker flags (excluding -l
# and -L).
# BLAS_COMPILER_FLAGS - uncached list of required compiler flags (including -I).
# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
# BLAS_CFLAGS_OTHER - list of required compiler flags (excluding -I).
# BLAS_INCLUDE_DIRS - include directories
# BLAS_LIBRARIES - list of libraries (using full path name) to
# link against to use BLAS
# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
# BLAS95_LIBRARIES - list of libraries (using full path name)
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
# is found
......@@ -294,7 +295,8 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
list(APPEND ${LIBRARIES} "-Wl,--end-group")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${_flags};${${LIBRARIES}};${_thread}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
set(CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_CFLAGS_OTHER}")
if (BLAS_VERBOSE)
message("${Cyan}BLAS libs found for BLA_VENDOR ${BLA_VENDOR}."
"Try to compile symbol ${_name} with following libraries:"
......@@ -331,7 +333,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
endmacro(Check_Fortran_Libraries)
set(BLAS_LINKER_FLAGS)
set(BLAS_LDFLAGS_OTHER)
set(BLAS_LIBRARIES)
set(BLAS95_LIBRARIES)
if ($ENV{BLA_VENDOR} MATCHES ".+")
......@@ -354,9 +356,27 @@ endif()
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER AND BLA_VENDOR STREQUAL "All")
if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER )
pkg_search_module(BLAS blas)
if (BLA_STATIC)
set(MKL_STR_BLA_STATIC "static")
else()
set(MKL_STR_BLA_STATIC "dynamic")
endif()
# try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(BLAS openblas)
elseif(BLA_VENDOR STREQUAL "Generic")
pkg_search_module(BLAS blas)
else()
pkg_search_module(BLAS blas)
pkg_search_module(BLAS openblas)
pkg_search_module(BLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
endif()
if (NOT BLAS_FIND_QUIETLY)
if (BLAS_FOUND AND BLAS_LIBRARIES)
......@@ -371,14 +391,6 @@ if( PKG_CONFIG_EXECUTABLE AND NOT BLAS_GIVEN_BY_USER AND BLA_VENDOR STREQUAL "Al
if (BLAS_FOUND AND BLAS_LIBRARIES)
set(BLAS_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(BLAS)
if (BLA_STATIC)
set(BLAS_LINKER_FLAGS "${BLAS_STATIC_LDFLAGS_OTHER}")
set(BLAS_COMPILER_FLAGS "${BLAS_STATIC_CFLAGS_OTHER}")
set(BLAS_LIBRARIES "${BLAS_STATIC_LIBRARIES}")
else()
set(BLAS_LINKER_FLAGS "${BLAS_LDFLAGS_OTHER}")
set(BLAS_COMPILER_FLAGS "${BLAS_CFLAGS_OTHER}")
endif()
else()
set(BLAS_FOUND_WITH_PKGCONFIG "FALSE")
endif()
......@@ -536,7 +548,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
set(LGFORTRAN "{FORTRAN_ifcore_LIBRARY}")
endif()
endif()
set(BLAS_COMPILER_FLAGS "")
set(BLAS_CFLAGS_OTHER "")
if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
if(BLAS_FIND_REQUIRED)
find_package(OpenMP REQUIRED)
......@@ -544,21 +556,18 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
find_package(OpenMP)
endif()
if(OPENMP_C_FLAGS)
list(APPEND BLAS_COMPILER_FLAGS "${OPENMP_C_FLAGS}")
list(APPEND BLAS_CFLAGS_OTHER "${OPENMP_C_FLAGS}")
endif()
endif()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
if (BLA_VENDOR STREQUAL "Intel10_32")
list(APPEND BLAS_COMPILER_FLAGS "-m32")
list(APPEND BLAS_CFLAGS_OTHER "-m32")
else()
list(APPEND BLAS_COMPILER_FLAGS "-m64")
list(APPEND BLAS_CFLAGS_OTHER "-m64")
endif()
if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")
list(APPEND OMP_LIB "-ldl")
endif()
if (ENV_MKLROOT)
list(APPEND BLAS_COMPILER_FLAGS "-I${ENV_MKLROOT}/include")
endif()
endif()
set(additional_flags "")
......@@ -744,7 +753,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
"${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(BLAS_LINKER_FLAGS "${additional_flags}")
set(BLAS_LDFLAGS_OTHER "${additional_flags}")
endif()
endif()
endforeach ()
......@@ -990,7 +999,7 @@ if( (NOT BLAS_FOUND_WITH_PKGCONFIG) OR BLAS_GIVEN_BY_USER )
""
)
if(BLAS_LIBRARIES)
set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
set(BLAS_LDFLAGS_OTHER "-xlic_lib=sunperf")
endif()
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
......
......@@ -18,20 +18,18 @@
#
# The following variables have been added to manage links with sequential or multithreaded
# versions:
# BLAS_INCLUDE_DIRS - BLAS include directories
# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries
# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
# BLAS_SEQ_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).
# BLAS_SEQ_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers)
# BLAS_PAR_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
# BLASEXT_LIBRARY_DIRS - Idem BLAS_LIBRARY_DIRS
# BLAS_INCLUDE_DIRS - BLAS include directories
# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries
# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
# BLAS_SEQ_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_SEQ_LDFLAGS_OTHER - linker flags without libraries
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_PAR_LDFLAGS_OTHER - linker flags without libraries
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
# BLASEXT_LIBRARY_DIRS - Idem BLAS_LIBRARY_DIRS
#=============================================================================
# Copyright 2012-2013 Inria
......@@ -90,11 +88,9 @@ if(NOT BLASEXT_FIND_QUIETLY)
"\n ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
endif()
if (NOT BLAS_FOUND)
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas(0)
endif ()
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas(0)
# detect the cases where SEQ and PAR libs are handled
if(BLA_VENDOR STREQUAL "All" AND
......@@ -206,11 +202,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
if (BLAS_COMPILER_FLAGS)
set (BLAS_SEQ_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
set (BLAS_SEQ_CFLAGS_OTHER "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
set (BLAS_SEQ_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
set (BLAS_SEQ_LDFLAGS_OTHER "${BLAS_LDFLAGS_OTHER}")
endif()
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
......@@ -224,11 +220,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
if (BLAS_COMPILER_FLAGS)
set (BLAS_PAR_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
set (BLAS_PAR_CFLAGS_OTHER "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
set (BLAS_PAR_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
set (BLAS_PAR_LDFLAGS_OTHER "${BLAS_LDFLAGS_OTHER}")
endif()
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
......@@ -301,8 +297,8 @@ endif()
# Reset pure BLAS cmake variables to the sequential case (arbitrary default)
if(BLAS_SEQ_LIBRARIES)
set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
set(BLAS_COMPILER_FLAGS "${BLAS_SEQ_COMPILER_FLAGS}")
set(BLAS_LINKER_FLAGS "${BLAS_SEQ_LINKER_FLAGS}")
set(BLAS_CFLAGS_OTHER "${BLAS_SEQ_CFLAGS_OTHER}")
set(BLAS_LDFLAGS_OTHER "${BLAS_SEQ_LDFLAGS_OTHER}")
endif()
# extract libs paths if not given by find_package(BLAS)
......
......@@ -20,14 +20,18 @@
#
# This module finds headers and cblas library.
# Results are reported in variables:
# CBLAS_FOUND - True if headers and requested libraries were found
# CBLAS_INCLUDE_DIRS - cblas include directories
# CBLAS_LIBRARY_DIRS - Link directories for cblas libraries
# CBLAS_LIBRARIES - cblas component libraries to be linked
# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories
# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories
# CBLAS_LIBRARIES_DEP - cblas libraries + dependencies
# CBLAS_HAS_ZGEMM3M - True if cblas contains zgemm3m fast complex mat-mat product
# CBLAS_FOUND - True if headers and requested libraries were found
# CBLAS_CFLAGS_OTHER - cblas compiler flags without headers paths
# CBLAS_LDFLAGS_OTHER - cblas linker flags without libraries
# CBLAS_INCLUDE_DIRS - cblas include directories
# CBLAS_LIBRARY_DIRS - cblas link directories
# CBLAS_LIBRARIES - cblas libraries to be linked (absolute path)
# CBLAS_CFLAGS_OTHER_DEP - cblas + dependencies compiler flags without headers paths
# CBLAS_LDFLAGS_OTHER_DEP - cblas + dependencies linker flags without libraries
# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories
# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories
# CBLAS_LIBRARIES_DEP - cblas + dependencies libraries
# CBLAS_HAS_ZGEMM3M - True if cblas contains zgemm3m fast complex mat-mat product
#
# CBLAS_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
......@@ -98,12 +102,10 @@ endif()
# CBLAS depends on BLAS anyway, try to find it
if (NOT BLAS_FOUND)
if(CBLAS_FIND_REQUIRED)
find_package(BLASEXT REQUIRED)
else()
find_package(BLASEXT)
endif()
if(CBLAS_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLAS)
endif()
......@@ -114,8 +116,9 @@ if (BLAS_FOUND)
# check if a cblas function exists in the BLAS lib
# this can be the case with libs such as MKL, ACML
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LINKER_FLAGS};${BLAS_LIBRARIES}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LDFLAGS_OTHER};${BLAS_LIBRARIES}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_CFLAGS_OTHER}")
set(CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}")
unset(CBLAS_WORKS CACHE)
check_function_exists(cblas_dscal CBLAS_WORKS)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
......@@ -135,15 +138,9 @@ if (BLAS_FOUND)
endif()
# test succeeds: CBLAS is in BLAS
set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}")
set(CBLAS_LIBRARIES_DEP "${BLAS_LIBRARIES}")
if (BLAS_LIBRARY_DIRS)
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
endif()
if(BLAS_INCLUDE_DIRS)
set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${BLAS_INCLUDE_DIRS_DEP}")
endif()
endif()
endif (NOT CBLAS_STANDALONE)
# test fails with blas: try to find CBLAS lib exterior to BLAS
......@@ -166,7 +163,25 @@ if (BLAS_FOUND)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT CBLAS_GIVEN_BY_USER)
pkg_search_module(CBLAS cblas)
if (BLA_STATIC)
set(MKL_STR_BLA_STATIC "static")
else()
set(MKL_STR_BLA_STATIC "dynamic")
endif()
# try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(CBLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(CBLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(CBLAS openblas)
elseif(BLA_VENDOR STREQUAL "Generic")
pkg_search_module(CBLAS cblas)
else()
pkg_search_module(CBLAS cblas)
pkg_search_module(CBLAS openblas)
pkg_search_module(CBLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
endif()
if (NOT CBLAS_FIND_QUIETLY)
if (CBLAS_FOUND AND CBLAS_LIBRARIES)
......@@ -336,6 +351,7 @@ if (BLAS_FOUND)
if(CBLAS_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -345,10 +361,10 @@ if (BLAS_FOUND)
set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
endif()
if (CBLAS_CFLAGS_OTHER)
list(APPEND REQUIRED_FLAGS "${CBLAS_CFLAGS_OTHER}")
set(REQUIRED_FLAGS "${CBLAS_CFLAGS_OTHER}")
endif()
if (CBLAS_LDFLAGS_OTHER)
list(APPEND REQUIRED_LDFLAGS "${CBLAS_LDFLAGS_OTHER}")
set(REQUIRED_LDFLAGS "${CBLAS_LDFLAGS_OTHER}")
endif()
if (CBLAS_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
......@@ -358,11 +374,11 @@ if (BLAS_FOUND)
if (BLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
endif()
if (BLAS_COMPILER_FLAGS)
list(APPEND REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
list(APPEND REQUIRED_FLAGS "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LDFLAGS_OTHER}")
endif()
if (BLAS_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
......@@ -371,12 +387,22 @@ if (BLAS_FOUND)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -399,13 +425,17 @@ if (BLAS_FOUND)
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CBLAS_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(CBLAS_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES CBLAS_LDFLAGS_OTHER_DEP)
else()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
......@@ -30,19 +30,22 @@
# - STARPU (default): to activate detection of Chameleon linked with StarPU
# - QUARK (STARPU will be deactivated): to activate detection of Chameleon linked with QUARK
# - CUDA (comes with cuBLAS): to activate detection of Chameleon linked with CUDA
# - MAGMA: to activate detection of Chameleon linked with MAGMA
# - MPI: to activate detection of Chameleon linked with MPI
# - FXT: to activate detection of Chameleon linked with StarPU+FXT
#
# This module finds headers and chameleon library.
# Results are reported in variables:
# CHAMELEON_FOUND - True if headers and requested libraries were found
# CHAMELEON_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# CHAMELEON_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries
# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
# CHAMELEON_LIBRARY_DIRS_DEP - chameleon + dependencies link directories
# CHAMELEON_LIBRARIES_DEP - chameleon libraries + dependencies
# CHAMELEON_FOUND - True if headers and requested libraries were found
# CHAMELEON_CFLAGS_OTHER - chameleon compiler flags without headers paths
# CHAMELEON_LDFLAGS_OTHER - chameleon linker flags without libraries
# CHAMELEON_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - chameleon link directories
# CHAMELEON_LIBRARIES - chameleon libraries to be linked (absolute path)
# CHAMELEON_CFLAGS_OTHER_DEP - chameleon + dependencies compiler flags without headers paths
# CHAMELEON_LDFLAGS_OTHER_DEP - chameleon + dependencies linker flags without libraries
# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
# CHAMELEON_LIBRARY_DIRS_DEP - chameleon + dependencies link directories
# CHAMELEON_LIBRARIES_DEP - chameleon + dependencies libraries
#
# CHAMELEON_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
......@@ -95,7 +98,6 @@ endif()
set(CHAMELEON_LOOK_FOR_STARPU ON)
set(CHAMELEON_LOOK_FOR_QUARK OFF)
set(CHAMELEON_LOOK_FOR_CUDA OFF)
set(CHAMELEON_LOOK_FOR_MAGMA OFF)
set(CHAMELEON_LOOK_FOR_MPI OFF)
set(CHAMELEON_LOOK_FOR_FXT OFF)
......@@ -115,10 +117,6 @@ if( CHAMELEON_FIND_COMPONENTS )
# means we look for Chameleon with CUDA
set(CHAMELEON_LOOK_FOR_CUDA ON)
endif()
if (${component} STREQUAL "MAGMA")
# means we look for Chameleon with MAGMA
set(CHAMELEON_LOOK_FOR_MAGMA ON)
endif()
if (${component} STREQUAL "MPI")
# means we look for Chameleon with MPI
set(CHAMELEON_LOOK_FOR_MPI ON)
......@@ -308,19 +306,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
endif()
endif()
# CHAMELEON may depend on MAGMA gpu kernels
# call our cmake module to test (in cmake_modules)
# change this call position if not appropriated
#-------------------------------------------------
if( CUDA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA )
set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired")
if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MAGMA)
find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} REQUIRED)
else()
find_package(MAGMA ${CHAMELEON_MAGMA_VERSION})
endif()
endif()
# CHAMELEON depends on MPI
#-------------------------
if( NOT MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI )
......@@ -496,6 +481,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
list(APPEND CHAMELEON_libs_to_find "chameleon_quark")
endif()
list(APPEND CHAMELEON_libs_to_find "coreblas")
if (CHAMELEON_LOOK_FOR_CUDA)
list(APPEND CHAMELEON_libs_to_find "cudablas")
endif()
# call cmake macro to find the lib path
if(CHAMELEON_LIBDIR)
......@@ -549,8 +537,9 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_F
# check a function to validate the find
if(CHAMELEON_LIBRARIES)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -574,42 +563,36 @@ if(CHAMELEON_LIBRARIES)
if (STARPU_FOUND AND CHAMELEON_LOOK_FOR_STARPU)
if (STARPU_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS_DEP}")
elseif (STARPU_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS}")
endif()
if (STARPU_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${STARPU_CFLAGS_OTHER_DEP}")
endif()
if (STARPU_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${STARPU_LDFLAGS_OTHER_DEP}")
endif()
if(STARPU_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS_DEP}")
elseif(STARPU_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS}")
endif()
if (STARPU_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}")
elseif (STARPU_LIBRARIES)
foreach(lib ${STARPU_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
endif()
# QUARK
if (QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK)
if (QUARK_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS_DEP}")
elseif(QUARK_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS}")
endif()
if (QUARK_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${QUARK_CFLAGS_OTHER_DEP}")
endif()
if (QUARK_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${QUARK_LDFLAGS_OTHER_DEP}")
endif()
if(QUARK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS_DEP}")
elseif(QUARK_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS}")
endif()
if (QUARK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBS "${QUARK_LIBRARIES_DEP}")
elseif (QUARK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBS "${QUARK_LIBRARIES}")
endif()
endif()
# CUDA
......@@ -624,30 +607,6 @@ if(CHAMELEON_LIBRARIES)
endforeach()
list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
endif()
# MAGMA
if (MAGMA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA)
if (MAGMA_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS_DEP}")
elseif(MAGMA_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}")
endif()
if (MAGMA_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS_DEP}")
elseif(MAGMA_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}")
endif()
if (MAGMA_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${MAGMA_LIBRARIES_DEP}")
elseif(MAGMA_LIBRARIES)
foreach(lib ${MAGMA_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
endif()
# MPI
if (MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI)
if (MPI_C_INCLUDE_PATH)
......@@ -666,80 +625,69 @@ if(CHAMELEON_LIBRARIES)
if (HWLOC_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")
endif()
foreach(libdir ${HWLOC_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
foreach(lib ${HWLOC_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
if (HWLOC_CFLAGS_OTHER)
list(APPEND REQUIRED_FLAGS "${HWLOC_CFLAGS_OTHER}")
endif()
if (HWLOC_LDFLAGS_OTHER)
list(APPEND REQUIRED_LDFLAGS "${HWLOC_LDFLAGS_OTHER}")
endif()
if (HWLOC_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}")
endif()
list(APPEND REQUIRED_LIBS "${HWLOC_LIBRARIES}")
endif()
# TMG
if (TMG_FOUND)
if (TMG_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS_DEP}")
elseif (TMG_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS}")
endif()
if (TMG_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${TMG_CFLAGS_OTHER_DEP}")
endif()
if (TMG_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${TMG_LDFLAGS_OTHER_DEP}")
endif()
if(TMG_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS_DEP}")
elseif(TMG_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS}")
endif()
if (TMG_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES_DEP}")
elseif(TMG_LIBRARIES)
list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES}")
endif()
if (TMG_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${TMG_LINKER_FLAGS}")
endif()
endif()
# LAPACKE
if (LAPACKE_FOUND)
if (LAPACKE_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS_DEP}")
elseif (LAPACKE_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}")
endif()
if (LAPACKE_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${LAPACKE_CFLAGS_OTHER_DEP}")
endif()
if (LAPACKE_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${LAPACKE_LDFLAGS_OTHER_DEP}")
endif()
if(LAPACKE_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS_DEP}")
elseif(LAPACKE_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}")
endif()
if (LAPACKE_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES_DEP}")
elseif(LAPACKE_LIBRARIES)
list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES}")
endif()
if (LAPACK_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
endif()
endif()
# CBLAS
if (CBLAS_FOUND)
if (CBLAS_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS_DEP}")
elseif (CBLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
endif()
if (CBLAS_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${CBLAS_CFLAGS_OTHER_DEP}")
endif()
if (CBLAS_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${CBLAS_LDFLAGS_OTHER_DEP}")
endif()
if(CBLAS_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS_DEP}")
elseif(CBLAS_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
endif()
if (CBLAS_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES_DEP}")
elseif(CBLAS_LIBRARIES)
list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES}")
endif()
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
# EXTRA LIBS such that pthread, m, rt
......@@ -747,12 +695,22 @@ if(CHAMELEON_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -767,18 +725,20 @@ if(CHAMELEON_LIBRARIES)
set(CHAMELEON_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CHAMELEON_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CHAMELEON_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CHAMELEON_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
set(CHAMELEON_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(CHAMELEON_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CHAMELEON_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CHAMELEON_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CHAMELEON_LINKER_FLAGS)
list(REMOVE_DUPLICATES CHAMELEON_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES CHAMELEON_LDFLAGS_OTHER_DEP)
else()
if(NOT CHAMELEON_FIND_QUIETLY)
message(STATUS "Looking for chameleon : test of MORSE_Init 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Maybe CHAMELEON is linked with specific libraries. "
"Have you tried with COMPONENTS (STARPU/QUARK, CUDA, MAGMA, MPI, FXT)? "
"Have you tried with COMPONENTS (STARPU/QUARK, CUDA, MPI, FXT)? "
"See the explanation in FindCHAMELEON.cmake.")
endif()
endif()
......
......@@ -321,12 +321,22 @@ if(EZTRACE_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -341,6 +351,7 @@ if(EZTRACE_LIBRARIES)
message(STATUS "Looking for eztrace : test of eztrace_topology_init with eztrace library 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
This diff is collapsed.
......@@ -28,13 +28,16 @@
# This module finds headers and fftw library.
# Results are reported in variables:
# FFTW_FOUND - True if headers and requested libraries were found
# FFTW_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# FFTW_INCLUDE_DIRS - fftw include directories
# FFTW_LIBRARY_DIRS - Link directories for fftw libraries
# FFTW_LIBRARIES - fftw component libraries to be linked
# FFTW_INCLUDE_DIRS_DEP - fftw + dependencies include directories
# FFTW_LIBRARY_DIRS_DEP - fftw + dependencies link directories
# FFTW_LIBRARIES_DEP - fftw libraries + dependencies
# FFTW_CFLAGS_OTHER - fftw compiler flags without headers paths
# FFTW_LDFLAGS_OTHER - fftw linker flags without libraries
# FFTW_INCLUDE_DIRS - fftw include directories
# FFTW_LIBRARY_DIRS - fftw link directories
# FFTW_LIBRARIES - fftw libraries to be linked (absolute path)
# FFTW_CFLAGS_OTHER_DEP - fftw + dependencies compiler flags without headers paths
# FFTW_LDFLAGS_OTHER_DEP - fftw + dependencies linker flags without libraries
# FFTW_INCLUDE_DIRS_DEP - fftw + dependencies include directories
# FFTW_LIBRARY_DIRS_DEP - fftw + dependencies link directories
# FFTW_LIBRARIES_DEP - fftw + dependencies libraries
#
# FFTW_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
......@@ -196,10 +199,10 @@ if (FFTW_LOOK_FOR_MKL)
endif()
if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
find_package(Threads REQUIRED)
find_package(BLASEXT REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(Threads)
find_package(BLASEXT)
find_package(BLAS)
endif()
endif()
......@@ -213,9 +216,9 @@ if (FFTW_LOOK_FOR_ESSL)
set(BLA_VENDOR "IBMESSL")
endif()
if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_ESSL)
find_package(BLASEXT REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLASEXT)
find_package(BLAS)
endif()
endif()
......@@ -749,12 +752,22 @@ if(FFTW_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -774,11 +787,11 @@ if(FFTW_LIBRARIES)
set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(FFTW_C_FLAGS "${REQUIRED_FLAGS}")
set(FFTW_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
set(FFTW_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(FFTW_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_LINKER_FLAGS)
list(REMOVE_DUPLICATES FFTW_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES FFTW_LDFLAGS_OTHER_DEP)
else()
if(NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
......
......@@ -16,10 +16,9 @@
# This module finds headers and fxt library.
# Results are reported in variables:
# FXT_FOUND - True if headers and requested libraries were found
# FXT_C_FLAGS - list of required compilation flags (excluding -I)
# FXT_INCLUDE_DIRS - fxt include directories
# FXT_LIBRARY_DIRS - Link directories for fxt libraries
# FXT_LIBRARIES - fxt component libraries to be linked
# FXT_LIBRARY_DIRS - fxt link directories
# FXT_LIBRARIES - fxt libraries to be linked (absolute path)
#
# FXT_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
......@@ -93,8 +92,6 @@ if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
endif()
endif()
set(FXT_C_FLAGS "${FXT_CFLAGS_OTHER}")
if (FXT_FOUND AND FXT_LIBRARIES)
set(FXT_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(FXT)
......@@ -260,6 +257,8 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND)
if(FXT_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -280,12 +279,22 @@ if(FXT_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -300,6 +309,7 @@ if(FXT_LIBRARIES)
message(STATUS "Looking for fxt : test of fut_keychange with fxt library 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
......@@ -257,6 +257,8 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT GTG_FOUND)
if(GTG_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -277,12 +279,22 @@ if(GTG_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -297,6 +309,7 @@ if(GTG_LIBRARIES)
message(STATUS "Looking for gtg : test of GTG_start with gtg library 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
......@@ -252,6 +252,8 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HQR_FOUND)
if(HQR_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -272,12 +274,22 @@ if(HQR_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -292,6 +304,7 @@ if(HQR_LIBRARIES)
message(STATUS "Looking for hqr : test of libhqr_hqr_init with hqr library 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
......@@ -263,6 +263,8 @@ endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND
if(HWLOC_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -283,12 +285,22 @@ if(HWLOC_LIBRARIES)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -303,6 +315,7 @@ if(HWLOC_LIBRARIES)
message(STATUS "Looking for hwloc : test of hwloc_topology_init with hwloc library 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
......@@ -18,14 +18,16 @@
# This module sets the following variables:
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
# is found
# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L).
# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
# link against to use LAPACK
# LAPACK95_LIBRARIES - uncached list of libraries (using full path name) to
# link against to use LAPACK95
# LAPACK95_FOUND - set to true if a library implementing the LAPACK f95
# interface is found
# LAPACK_CFLAGS_OTHER - lapack compiler flags without headers paths
# LAPACK_LDFLAGS_OTHER - lapack linker flags without libraries
# LAPACK_INCLUDE_DIRS - lapack include directories
# LAPACK_LIBRARY_DIRS - lapack link directories
# LAPACK_LIBRARIES - lapack libraries to be linked (absolute path)
# LAPACK_CFLAGS_OTHER_DEP - lapack + dependencies compiler flags without headers paths
# LAPACK_LDFLAGS_OTHER_DEP - lapack + dependencies linker flags without libraries
# LAPACK_INCLUDE_DIRS_DEP - lapack + dependencies include directories
# LAPACK_LIBRARY_DIRS_DEP - lapack + dependencies link directories
# LAPACK_LIBRARIES_DEP - lapack + dependencies libraries
# BLA_STATIC if set on this determines what kind of linkage we do (static)
# BLA_VENDOR if set checks only the specified vendor, if not set checks
# all the possibilities
......@@ -282,6 +284,8 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
else(UNIX AND BLA_STATIC)
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads})
endif(UNIX AND BLA_STATIC)
set(CMAKE_REQUIRED_INCLUDES "${LAPACK_INCLUDE_DIRS}")
set(CMAKE_REQUIRED_FLAGS "${LAPACK_CFLAGS_OTHER}")
if (LAPACK_VERBOSE)
message("${Cyan}LAPACK libs found. Try to compile symbol ${_name} with"
"following libraries: ${CMAKE_REQUIRED_LIBRARIES}")
......@@ -308,20 +312,18 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
endmacro(Check_Lapack_Libraries)
set(LAPACK_LINKER_FLAGS)
set(LAPACK_LDFLAGS_OTHER)
set(LAPACK_LIBRARIES)
set(LAPACK95_LIBRARIES)
if (NOT BLAS_FOUND)
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_package(BLASEXT)
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_package(BLASEXT REQUIRED)
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
endif ()
if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_package(BLAS)
else(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
find_package(BLAS REQUIRED)
endif(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)
if(BLAS_FOUND)
set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
set(LAPACK_INCLUDE_DIRS ${BLAS_INCLUDE_DIRS})
if ($ENV{BLA_VENDOR} MATCHES ".+")
set(BLA_VENDOR $ENV{BLA_VENDOR})
else ($ENV{BLA_VENDOR} MATCHES ".+")
......@@ -386,7 +388,25 @@ if(BLAS_FOUND)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT LAPACK_GIVEN_BY_USER AND BLA_VENDOR STREQUAL "All")
pkg_search_module(LAPACK lapack)
if (BLA_STATIC)
set(MKL_STR_BLA_STATIC "static")
else()
set(MKL_STR_BLA_STATIC "dynamic")
endif()
# try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(LAPACK openblas)
elseif(BLA_VENDOR STREQUAL "Generic")
pkg_search_module(LAPACK lapack)
else()
pkg_search_module(LAPACK lapack)
pkg_search_module(LAPACK openblas)
pkg_search_module(LAPACK mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
endif()
if (NOT LAPACK_FIND_QUIETLY)
if (LAPACK_FOUND AND LAPACK_LIBRARIES)
......@@ -401,14 +421,6 @@ if(BLAS_FOUND)
if (LAPACK_FOUND AND LAPACK_LIBRARIES)
set(LAPACK_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(LAPACK)
if (BLA_STATIC)
set(LAPACK_LINKER_FLAGS "${LAPACK_STATIC_LDFLAGS_OTHER}")
set(LAPACK_COMPILER_FLAGS "${LAPACK_STATIC_CFLAGS_OTHER}")
set(LAPACK_LIBRARIES "${LAPACK_STATIC_LIBRARIES}")
else()
set(LAPACK_LINKER_FLAGS "${LAPACK_LDFLAGS_OTHER}")
set(LAPACK_COMPILER_FLAGS "${LAPACK_CFLAGS_OTHER}")
endif()
else()
set(LAPACK_FOUND_WITH_PKGCONFIG "FALSE")
endif()
......@@ -473,7 +485,7 @@ if(BLAS_FOUND)
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(LAPACK_LINKER_FLAGS "${additional_flags}")
set(LAPACK_LDFLAGS_OTHER "${additional_flags}")
endif()
endif ()
# Then try the search libs
......@@ -489,7 +501,7 @@ if(BLAS_FOUND)
"${CMAKE_THREAD_LIBS_INIT};${LM}"
)
if(_LIBRARIES)
set(LAPACK_LINKER_FLAGS "${additional_flags}")
set(LAPACK_LDFLAGS_OTHER "${additional_flags}")
endif()
endif ()
endforeach ()
......@@ -789,6 +801,15 @@ if (LAPACK_FOUND)
else()
set(LAPACK_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of LAPACK library" FORCE)
endif()
set(LAPACK_CFLAGS_OTHER_DEP "${LAPACK_CFLAGS_OTHER}" "${BLAS_CFLAGS_OTHER}")
set(LAPACK_LDFLAGS_OTHER_DEP "${LAPACK_LDFLAGS_OTHER}" "${BLAS_LDFLAGS_OTHER}")
set(LAPACK_INCLUDE_DIRS_DEP "${LAPACK_INCLUDE_DIRS}" "${BLAS_INCLUDE_DIRS}")
set(LAPACK_LIBRARY_DIRS_DEP "${LAPACK_LIBRARY_DIRS}" "${BLAS_LIBRARY_DIRS}")
set(LAPACK_LIBRARIES_DEP "${LAPACK_LIBRARIES}" "${BLAS_LIBRARIES}")
list(REMOVE_DUPLICATES LAPACK_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES LAPACK_LDFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES LAPACK_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACK_LIBRARY_DIRS_DEP)
endif()
mark_as_advanced(LAPACK_DIR)
mark_as_advanced(LAPACK_DIR_FOUND)
......@@ -26,13 +26,16 @@
# This module finds headers and lapacke library.
# Results are reported in variables:
# LAPACKE_FOUND - True if headers and requested libraries were found
# LAPACKE_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# LAPACKE_INCLUDE_DIRS - lapacke include directories
# LAPACKE_LIBRARY_DIRS - Link directories for lapacke libraries
# LAPACKE_LIBRARIES - lapacke component libraries to be linked
# LAPACKE_INCLUDE_DIRS_DEP - lapacke + dependencies include directories
# LAPACKE_LIBRARY_DIRS_DEP - lapacke + dependencies link directories
# LAPACKE_LIBRARIES_DEP - lapacke libraries + dependencies
# LAPACKE_CFLAGS_OTHER - lapacke compiler flags without headers paths
# LAPACKE_LDFLAGS_OTHER - lapacke linker flags without libraries
# LAPACKE_INCLUDE_DIRS - lapacke include directories
# LAPACKE_LIBRARY_DIRS - lapacke link directories
# LAPACKE_LIBRARIES - lapacke libraries to be linked (absolute path)
# LAPACKE_CFLAGS_OTHER_DEP - lapacke + dependencies compiler flags without headers paths
# LAPACKE_LDFLAGS_OTHER_DEP - lapacke + dependencies linker flags without libraries
# LAPACKE_INCLUDE_DIRS_DEP - lapacke + dependencies include directories
# LAPACKE_LIBRARY_DIRS_DEP - lapacke + dependencies link directories
# LAPACKE_LIBRARIES_DEP - lapacke + dependencies libraries
#
# LAPACKE_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables may be set
......@@ -98,12 +101,10 @@ if( LAPACKE_FIND_COMPONENTS )
endif()
# LAPACKE depends on LAPACK anyway, try to find it
if (NOT LAPACK_FOUND)
if(LAPACKE_FIND_REQUIRED)
find_package(LAPACKEXT REQUIRED)
else()
find_package(LAPACKEXT)
endif()
if(LAPACKE_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
find_package(LAPACK)
endif()
# LAPACKE depends on LAPACK
......@@ -112,7 +113,9 @@ if (LAPACK_FOUND)
if (NOT LAPACKE_STANDALONE)
# check if a lapacke function exists in the LAPACK lib
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LINKER_FLAGS};${LAPACK_LIBRARIES}")
set(CMAKE_REQUIRED_LIBRARIES "${LAPACK_LDFLAGS_OTHER_DEP};${LAPACK_LIBRARIES_DEP}")
set(CMAKE_REQUIRED_INCLUDES "${LAPACK_INCLUDE_DIRS_DEP}")
set(CMAKE_REQUIRED_FLAGS "${LAPACK_CFLAGS_OTHER_DEP}")
unset(LAPACKE_WORKS CACHE)
check_function_exists(LAPACKE_dgeqrf LAPACKE_WORKS)
mark_as_advanced(LAPACKE_WORKS)
......@@ -124,17 +127,6 @@ if (LAPACK_FOUND)
endif()
# test succeeds: LAPACKE is in LAPACK
set(LAPACKE_LIBRARIES "${LAPACK_LIBRARIES}")
set(LAPACKE_LIBRARIES_DEP "${LAPACK_LIBRARIES}")
if (LAPACK_LIBRARY_DIRS)
set(LAPACKE_LIBRARY_DIRS "${LAPACK_LIBRARY_DIRS}")
endif()
if(LAPACK_INCLUDE_DIRS)
set(LAPACKE_INCLUDE_DIRS "${LAPACK_INCLUDE_DIRS}")
set(LAPACKE_INCLUDE_DIRS_DEP "${LAPACK_INCLUDE_DIRS}")
endif()
if (LAPACK_LINKER_FLAGS)
set(LAPACKE_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}")
endif()
endif()
endif (NOT LAPACKE_STANDALONE)
......@@ -158,7 +150,25 @@ if (LAPACK_FOUND)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT LAPACKE_GIVEN_BY_USER)
pkg_search_module(LAPACKE lapacke)
if (BLA_STATIC)
set(MKL_STR_BLA_STATIC "static")
else()
set(MKL_STR_BLA_STATIC "dynamic")
endif()
# try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(LAPACKE mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(LAPACKE mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(LAPACKE openblas)
elseif(BLA_VENDOR STREQUAL "Generic")
pkg_search_module(LAPACKE lapacke)
else()
pkg_search_module(LAPACKE lapacke)
pkg_search_module(LAPACKE openblas)
pkg_search_module(LAPACKE mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
endif()
if (NOT LAPACKE_FIND_QUIETLY)
if (LAPACKE_FOUND AND LAPACKE_LIBRARIES)
......@@ -327,8 +337,9 @@ if (LAPACK_FOUND)
# check a function to validate the find
if(LAPACKE_LIBRARIES)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -347,19 +358,19 @@ if (LAPACK_FOUND)
endif()
set(REQUIRED_LIBS "${LAPACKE_LIBRARIES}")
# LAPACK
if (LAPACK_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS}")
if (LAPACK_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS_DEP}")
endif()
if (LAPACK_COMPILER_FLAGS)
list(APPEND REQUIRED_FLAGS "${LAPACK_COMPILER_FLAGS}")
if (LAPACK_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${LAPACK_CFLAGS_OTHER_DEP}")
endif()
if (LAPACK_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
if (LAPACK_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${LAPACK_LDFLAGS_OTHER_DEP}")
endif()
if (LAPACK_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS}")
if (LAPACK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS_DEP}")
endif()
list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES}")
list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES_DEP}")
# Fortran
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
find_library(
......@@ -390,12 +401,22 @@ if (LAPACK_FOUND)
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -414,13 +435,17 @@ if (LAPACK_FOUND)
set(LAPACKE_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(LAPACKE_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(LAPACKE_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(LAPACKE_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(LAPACKE_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES LAPACKE_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES LAPACKE_LDFLAGS_OTHER_DEP)
else()
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke 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}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......
......@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2017 Inria. All rights reserved.
# @copyright (c) 2012-2018 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -28,11 +28,11 @@
# LAPACKEXT_LIBRARY_DIRS - Idem LAPACK_LIBRARY_DIRS
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2018 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013-2017 Florent Pruvost
# Copyright 2013-2018 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
......@@ -63,13 +63,11 @@ macro(find_package_lapack required)
endmacro()
# LAPACKEXT depends on BLAS
if (NOT BLAS_FOUND)
if(LAPACKEXT_FIND_QUIETLY)
find_package(BLAS QUIET)
else()
find_package(BLAS)
endif()
endif ()
if(LAPACKEXT_FIND_QUIETLY)
find_package(BLASEXT QUIET)
else()
find_package(BLASEXT)
endif()
if(NOT LAPACKEXT_FIND_QUIETLY)
message(STATUS "In FindLAPACKEXT")
......@@ -217,8 +215,6 @@ else()
# This module sets the following variables:
# LAPACK_FOUND - set to true if a library implementing the LAPACK interface
# is found
# LAPACK_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L).
# LAPACK_LIBRARIES - uncached list of libraries (using full path name) to
# link against to use LAPACK
# LAPACK95_LIBRARIES - uncached list of libraries (using full path name)
......