Commits (5)
......@@ -27,6 +27,9 @@
#
###
# Path to Morse modules
get_filename_component(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} DIRECTORY CACHE)
# Global Morse options
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
......@@ -47,19 +50,6 @@ if (MORSE_ENABLE_COLOR_MESSAGE)
include(ColorizeMessage)
endif()
# To find headers and libs
include(FindHeadersAndLibs)
# To transform relative path from pkg-config into absolute
include(FindPkgconfigLibrariesAbsolutePath)
# To transform relative path into absolute for a list of libraries
include(LibrariesAbsolutePath)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
# Define some auxilary flags
include(AuxilaryFlags)
......@@ -69,6 +59,9 @@ include(Ressources)
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
# To load some macros used in Finds (could be useful for other projects)
include(FindInit)
##
## @end file MorseInit.cmake
##
......@@ -98,60 +98,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
## Some macros to print status when search for headers and libs
# This macro informs why the _lib_to_find file has not been found
macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
# save _libname upper/lower case
string(TOUPPER ${_libname} LIBNAME)
string(TOLOWER ${_libname} libname)
# print status
#message(" ")
if(${LIBNAME}_LIBDIR)
message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
else()
if(${LIBNAME}_DIR)
message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
else()
message("${Yellow}${_lib_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
if(_lib_env)
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
endif()
endif()
endif()
message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
"- Option 1: Provide the Installation directory of BLAS library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
"- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
endmacro()
# This macro informs why the _lib_to_find file has not been found
macro(Print_Find_Library_Blas_CheckFunc_Status _name)
# save _libname upper/lower case
string(TOUPPER ${_name} FUNCNAME)
string(TOLOWER ${_name} funcname)
# print status
#message(" ")
message("${Red}Libs have been found but check of symbol ${_name} failed "
"with following libraries ${ARGN}${ColourReset}")
message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log"
"to figure out why it fails${ColourReset}")
#message(" ")
endmacro()
# Common macros to use in finds
include(FindInit)
if (NOT BLAS_FOUND)
set(BLAS_DIR "" CACHE PATH "Installation directory of BLAS library")
......@@ -346,10 +294,11 @@ else ()
endif ()
set(ENV_BLAS_DIR "$ENV{BLAS_DIR}")
set(ENV_MKL_DIR "$ENV{MKLROOT}")
set(ENV_BLAS_INCDIR "$ENV{BLAS_INCDIR}")
set(ENV_BLAS_LIBDIR "$ENV{BLAS_LIBDIR}")
set(BLAS_GIVEN_BY_USER "FALSE")
if ( BLAS_DIR OR ( BLAS_INCDIR AND BLAS_LIBDIR) OR ENV_BLAS_DIR OR (ENV_BLAS_INCDIR AND ENV_BLAS_LIBDIR) )
if ( BLAS_DIR OR ( BLAS_INCDIR AND BLAS_LIBDIR) OR ENV_BLAS_DIR OR ENV_MKL_DIR OR (ENV_BLAS_INCDIR AND ENV_BLAS_LIBDIR) )
set(BLAS_GIVEN_BY_USER "TRUE")
endif()
......
......@@ -91,6 +91,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT CBLAS_FOUND)
set(CBLAS_DIR "" CACHE PATH "Installation directory of CBLAS library")
......@@ -151,10 +153,11 @@ if (BLAS_FOUND)
# try with pkg-config
set(ENV_CBLAS_DIR "$ENV{CBLAS_DIR}")
set(ENV_MKL_DIR "$ENV{MKLROOT}")
set(ENV_CBLAS_INCDIR "$ENV{CBLAS_INCDIR}")
set(ENV_CBLAS_LIBDIR "$ENV{CBLAS_LIBDIR}")
set(CBLAS_GIVEN_BY_USER "FALSE")
if ( CBLAS_DIR OR ( CBLAS_INCDIR AND CBLAS_LIBDIR) OR ENV_CBLAS_DIR OR (ENV_CBLAS_INCDIR AND ENV_CBLAS_LIBDIR) )
if ( CBLAS_DIR OR ( CBLAS_INCDIR AND CBLAS_LIBDIR) OR ENV_CBLAS_DIR OR ENV_MKL_DIR OR (ENV_CBLAS_INCDIR AND ENV_CBLAS_LIBDIR) )
set(CBLAS_GIVEN_BY_USER "TRUE")
endif()
......@@ -396,6 +399,7 @@ if (BLAS_FOUND)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -424,9 +428,6 @@ if (BLAS_FOUND)
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_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")
......
......@@ -86,6 +86,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT CHAMELEON_FOUND)
set(CHAMELEON_DIR "" CACHE PATH "Installation directory of CHAMELEON library")
......@@ -707,6 +709,7 @@ if(CHAMELEON_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -727,9 +730,6 @@ if(CHAMELEON_LIBRARIES)
set(CHAMELEON_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
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_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")
......
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file FindCommon.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 13-04-2018
#
###
# clean these variables before using them in CMAKE_REQUIRED_* variables in
# check_function_exists
macro(finds_remove_duplicates)
if (REQUIRED_DEFINITIONS)
list(REMOVE_DUPLICATES REQUIRED_DEFINITIONS)
endif()
if (REQUIRED_INCDIRS)
list(REMOVE_DUPLICATES REQUIRED_INCDIRS)
endif()
if (REQUIRED_FLAGS)
list(REMOVE_DUPLICATES REQUIRED_FLAGS)
endif()
if (REQUIRED_LDFLAGS)
list(REMOVE_DUPLICATES REQUIRED_LDFLAGS)
endif()
if (REQUIRED_LIBS)
list(REVERSE REQUIRED_LIBS)
list(REMOVE_DUPLICATES REQUIRED_LIBS)
list(REVERSE REQUIRED_LIBS)
endif()
endmacro()
##
## @end file FindCommon
##
......@@ -63,6 +63,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT EZTRACE_FOUND)
set(EZTRACE_DIR "" CACHE PATH "Installation directory of EZTRACE library")
if (NOT EZTRACE_FIND_QUIETLY)
......@@ -330,6 +333,7 @@ if(EZTRACE_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......
......@@ -64,6 +64,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT FABULOUS_FOUND)
set(FABULOUS_DIR "" CACHE PATH "Installation directory of FABULOUS library")
if (NOT FABULOUS_FIND_QUIETLY)
......@@ -374,6 +377,7 @@ if(FABULOUS_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -394,9 +398,6 @@ if(FABULOUS_LIBRARIES)
set(FABULOUS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(FABULOUS_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(FABULOUS_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES FABULOUS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES FABULOUS_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES FABULOUS_LDFLAGS_OTHER_DEP)
else()
if(NOT FABULOUS_FIND_QUIETLY)
message(STATUS "Looking for fabulous : test of fabulous_topology_init with fabulous library fails")
......
......@@ -80,6 +80,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT FFTW_FOUND)
set(FFTW_DIR "" CACHE PATH "Installation directory of FFTW library given by user")
......@@ -767,6 +769,7 @@ if(FFTW_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -792,9 +795,6 @@ if(FFTW_LIBRARIES)
set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
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_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")
......
......@@ -59,6 +59,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT FXT_FOUND)
set(FXT_DIR "" CACHE PATH "Installation directory of FXT library")
if (NOT FXT_FIND_QUIETLY)
......@@ -289,6 +292,7 @@ if(FXT_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......
......@@ -59,6 +59,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT GTG_FOUND)
set(GTG_DIR "" CACHE PATH "Installation directory of GTG library")
if (NOT GTG_FIND_QUIETLY)
......@@ -289,6 +292,7 @@ if(GTG_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......
......@@ -59,6 +59,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT HQR_FOUND)
set(HQR_DIR "" CACHE PATH "Installation directory of HQR library")
if (NOT HQR_FIND_QUIETLY)
......@@ -284,6 +287,7 @@ if(HQR_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......
......@@ -59,6 +59,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
include(CheckStructHasMember)
include(CheckCSourceCompiles)
......@@ -295,6 +298,7 @@ if(HWLOC_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......
......@@ -45,6 +45,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT HYPRE_FOUND)
set(HYPRE_DIR "" CACHE PATH "Installation directory of HYPRE library")
if (NOT HYPRE_FIND_QUIETLY)
......@@ -222,6 +225,7 @@ if(HYPRE_LIBRARIES)
set(REQUIRED_LIBS "${HYPRE_LIBRARIES}")
# set required libraries for link
finds_remove_duplicates()
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
......
......@@ -27,14 +27,9 @@
#
###
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
function(FindHeader _libname _header_to_find)
# save _libname upper and lower case
......
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file FindInit.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 24-04-2018
#
###
# This include is required to check symbols of libs
include(CheckFunctionExists)
# This include is required to check defines in headers
include(CheckIncludeFiles)
# Factorize some piece of code
include(FindCommon)
# To find headers and libs
include(FindHeadersAndLibs)
# To transform relative path into absolute for a list of libraries
include(LibrariesAbsolutePath)
include(FindPkgconfigLibrariesAbsolutePath)
# Some macros to print status when search for headers and libs
include(PrintFindStatus)
##
## @end file FindInit.cmake
##
......@@ -76,44 +76,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
## Some macros to print status when search for headers and libs
# This macro informs why the _lib_to_find file has not been found
macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
# save _libname upper/lower case
string(TOUPPER ${_libname} LIBNAME)
string(TOLOWER ${_libname} libname)
# print status
#message(" ")
if(${LIBNAME}_LIBDIR)
message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
else()
if(${LIBNAME}_DIR)
message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
else()
message("${Yellow}${_lib_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
if(_lib_env)
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
endif()
endif()
endif()
message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
"- Option 1: Provide the installation directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
"- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
endmacro()
# Common macros to use in finds
include(FindInit)
if (NOT LAPACK_FOUND)
set(LAPACK_DIR "" CACHE PATH "Installation directory of LAPACK library")
......@@ -381,10 +345,11 @@ if(BLAS_FOUND)
# if not lapack in blas libs, try to find lapack with pkg-config
set(ENV_LAPACK_DIR "$ENV{LAPACK_DIR}")
set(ENV_MKL_DIR "$ENV{MKLROOT}")
set(ENV_LAPACK_INCDIR "$ENV{LAPACK_INCDIR}")
set(ENV_LAPACK_LIBDIR "$ENV{LAPACK_LIBDIR}")
set(LAPACK_GIVEN_BY_USER "FALSE")
if ( LAPACK_DIR OR ( LAPACK_INCDIR AND LAPACK_LIBDIR) OR ENV_LAPACK_DIR OR (ENV_LAPACK_INCDIR AND ENV_LAPACK_LIBDIR) )
if ( LAPACK_DIR OR ( LAPACK_INCDIR AND LAPACK_LIBDIR) OR ENV_LAPACK_DIR OR ENV_MKL_DIR OR (ENV_LAPACK_INCDIR AND ENV_LAPACK_LIBDIR) )
set(LAPACK_GIVEN_BY_USER "TRUE")
endif()
......
......@@ -83,6 +83,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT LAPACKE_FOUND)
set(LAPACKE_DIR "" CACHE PATH "Installation directory of LAPACKE library")
if (NOT LAPACKE_FIND_QUIETLY)
......@@ -100,7 +103,16 @@ if( LAPACKE_FIND_COMPONENTS )
endforeach()
endif()
# LAPACKE depends on LAPACK anyway, try to find it
# LAPACKE may depend on TMG, try to find it
if (LAPACKE_WITH_TMG)
if(LAPACKE_FIND_REQUIRED)
find_package(TMG REQUIRED)
else()
find_package(TMG)
endif()
endif()
# LAPACKE depends on LAPACK, try to find it
if(LAPACKE_FIND_REQUIRED)
find_package(LAPACK REQUIRED)
else()
......@@ -139,10 +151,11 @@ if (LAPACK_FOUND)
# try with pkg-config
set(ENV_LAPACKE_DIR "$ENV{LAPACKE_DIR}")
set(ENV_MKL_DIR "$ENV{MKLROOT}")
set(ENV_LAPACKE_INCDIR "$ENV{LAPACKE_INCDIR}")
set(ENV_LAPACKE_LIBDIR "$ENV{LAPACKE_LIBDIR}")
set(LAPACKE_GIVEN_BY_USER "FALSE")
if ( LAPACKE_DIR OR ( LAPACKE_INCDIR AND LAPACKE_LIBDIR) OR ENV_LAPACKE_DIR OR (ENV_LAPACKE_INCDIR AND ENV_LAPACKE_LIBDIR) )
if ( LAPACKE_DIR OR ( LAPACKE_INCDIR AND LAPACKE_LIBDIR) OR ENV_LAPACKE_DIR OR ENV_MKL_DIR OR (ENV_LAPACKE_INCDIR AND ENV_LAPACKE_LIBDIR) )
set(LAPACKE_GIVEN_BY_USER "TRUE")
endif()
......@@ -355,6 +368,22 @@ if (LAPACK_FOUND)
set(REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${LAPACKE_LIBRARIES}")
# TMG
if (LAPACKE_WITH_TMG)
if (TMG_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS_DEP}")
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}")
endif()
list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES_DEP}")
endif()
# LAPACK
if (LAPACK_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${LAPACK_INCLUDE_DIRS_DEP}")
......@@ -369,28 +398,6 @@ if (LAPACK_FOUND)
list(APPEND REQUIRED_LIBDIRS "${LAPACK_LIBRARY_DIRS_DEP}")
endif()
list(APPEND REQUIRED_LIBS "${LAPACK_LIBRARIES_DEP}")
# Fortran
if (CMAKE_C_COMPILER_ID MATCHES "GNU")
find_library(
FORTRAN_gfortran_LIBRARY
NAMES gfortran
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_gfortran_LIBRARY)
if (FORTRAN_gfortran_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")
endif()
elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")
find_library(
FORTRAN_ifcore_LIBRARY
NAMES ifcore
HINTS ${_lib_env}
)
mark_as_advanced(FORTRAN_ifcore_LIBRARY)
if (FORTRAN_ifcore_LIBRARY)
list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")
endif()
endif()
# m
find_library(M_LIBRARY NAMES m HINTS ${_lib_env})
mark_as_advanced(M_LIBRARY)
......@@ -411,6 +418,7 @@ if (LAPACK_FOUND)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -435,9 +443,6 @@ if (LAPACK_FOUND)
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_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")
......
......@@ -63,6 +63,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if(NOT MAGMA_FOUND)
set(MAGMA_DIR "" CACHE PATH "Installation directory of MAGMA library")
......@@ -361,7 +363,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
list(APPEND REQUIRED_LIBDIRS "${CUDA_LIBRARY_DIRS}")
endif()
list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
finds_remove_duplicates()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -384,9 +386,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) O
set(MAGMA_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(MAGMA_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(MAGMA_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES MAGMA_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES MAGMA_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES MAGMA_LINKER_FLAGS)
else()
if(NOT MAGMA_FIND_QUIETLY)
message(STATUS "Looking for magma : test of magma_dgetrf with
......
......@@ -47,6 +47,9 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT METIS_FOUND)
set(METIS_DIR "" CACHE PATH "Installation directory of METIS library")
if (NOT METIS_FIND_QUIETLY)
......@@ -210,7 +213,7 @@ if(METIS_LIBRARIES)
if(M_LIBRARY)
list(APPEND REQUIRED_LIBS "${M_LIBRARY}")
endif()
finds_remove_duplicates()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
......
......@@ -69,6 +69,8 @@
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
# Common macros to use in finds
include(FindInit)
if (NOT MUMPS_FOUND)
set(MUMPS_DIR "" CACHE PATH "Installation directory of MUMPS library")
......@@ -712,6 +714,7 @@ if(MUMPS_LIBRARIES)
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
finds_remove_duplicates()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
......@@ -746,9 +749,6 @@ if(MUMPS_LIBRARIES)
set(MUMPS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(MUMPS_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(MUMPS_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES MUMPS_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES MUMPS_LDFLAGS_OTHER_DEP)
else()
if(NOT MUMPS_FIND_QUIETLY)
message(STATUS "Looking for MUMPS : test of [sdcz]mumps() fails")
......