Commit 54c18ffc authored by Florent Pruvost's avatar Florent Pruvost
Browse files

_DEP variables are now always defined in Finds so that test on them are not useful anymore

parent 331d2196
...@@ -318,25 +318,11 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/") ...@@ -318,25 +318,11 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
# MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD # MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD
# Default is DOUBLE and without THREADS|OMP # Default is DOUBLE and without THREADS|OMP
find_package(FFTW REQUIRED COMPONENTS MKL) find_package(FFTW REQUIRED COMPONENTS MKL)
if(FFTW_LIBRARY_DIRS_DEP) set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags") foreach (fft_lib ${FFTW_LIBRARIES_DEP})
elseif(FFTW_LIBRARY_DIRS) set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS};" CACHE STRING "Set your MKL flags") endforeach()
endif() set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
endforeach()
elseif(FFTW_LIBRARIES)
foreach (fft_lib ${FFTW_LIBRARIES})
set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
endforeach()
endif()
if (FFTW_INCLUDE_DIRS_DEP)
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
elseif (FFTW_INCLUDE_DIRS)
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS}" )
endif()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${FFT_LIBRARIES}") set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${FFT_LIBRARIES}")
endif(ScalFMM_USE_MKL_AS_BLAS) endif(ScalFMM_USE_MKL_AS_BLAS)
...@@ -349,25 +335,11 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/") ...@@ -349,25 +335,11 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
# Default is DOUBLE and without THREADS|OMP # Default is DOUBLE and without THREADS|OMP
find_package(FFTW REQUIRED) find_package(FFTW REQUIRED)
if(FFTW_LIBRARY_DIRS_DEP) set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags") foreach (fft_lib ${FFTW_LIBRARIES_DEP})
elseif(FFTW_LIBRARY_DIRS) set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS};" CACHE STRING "Set your MKL flags") endforeach()
endif() set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
endforeach()
elseif(FFTW_LIBRARIES)
foreach (fft_lib ${FFTW_LIBRARIES})
set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
endforeach()
endif()
if (FFTW_INCLUDE_DIRS_DEP)
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS_DEP}" )
elseif (FFTW_INCLUDE_DIRS)
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS}" )
endif()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${FFT_LIBRARIES}") set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${FFT_LIBRARIES}")
endif(ScalFMM_USE_MKL_AS_FFTW) endif(ScalFMM_USE_MKL_AS_FFTW)
...@@ -451,45 +423,21 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/") ...@@ -451,45 +423,21 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
COMPONENTS ${STARPU_COMPONENT_LIST}) COMPONENTS ${STARPU_COMPONENT_LIST})
# Append list of libraries and include dirs # Append list of libraries and include dirs
if (STARPU_INCLUDE_DIRS_DEP) include_directories(${STARPU_INCLUDE_DIRS_DEP})
include_directories(${STARPU_INCLUDE_DIRS_DEP}) foreach (starpu_libdir ${STARPU_LIBRARY_DIRS_DEP})
elseif(STARPU_INCLUDE_DIRS) if (${starpu_libdir} MATCHES "^ *-L")
include_directories(${STARPU_INCLUDE_DIRS}) set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_libdir}")
endif() else()
if (STARPU_LIBRARY_DIRS_DEP) set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L${starpu_libdir}")
foreach (starpu_libdir ${STARPU_LIBRARY_DIRS_DEP}) endif()
if (${starpu_libdir} MATCHES "^ *-L") endforeach()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_libdir}") foreach (starpu_lib ${STARPU_LIBRARIES_DEP})
else() if (EXISTS ${starpu_lib} OR ${starpu_lib} MATCHES "^ *-")
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L${starpu_libdir}") set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_lib}")
endif() else()
endforeach() set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -l${starpu_lib}")
elseif(STARPU_LIBRARY_DIRS) endif()
foreach (starpu_libdir ${STARPU_LIBRARY_DIRS}) endforeach()
if (${starpu_libdir} MATCHES "^ *-L")
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_libdir}")
else()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L${starpu_libdir}")
endif()
endforeach()
endif()
if (STARPU_LIBRARIES_DEP)
foreach (starpu_lib ${STARPU_LIBRARIES_DEP})
if (EXISTS ${starpu_lib} OR ${starpu_lib} MATCHES "^ *-")
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_lib}")
else()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -l${starpu_lib}")
endif()
endforeach()
elseif(STARPU_LIBRARIES)
foreach (starpu_lib ${STARPU_LIBRARIES})
if (EXISTS ${starpu_lib} OR ${starpu_lib} MATCHES "^ *-")
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_lib}")
else()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -l${starpu_lib}")
endif()
endforeach()
endif()
if (CUDA_LIBRARIES) if (CUDA_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${CUDA_LIBRARIES}") set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${CUDA_LIBRARIES}")
...@@ -500,11 +448,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/") ...@@ -500,11 +448,10 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
if (STARPU_INCLUDE_DIRS) if (STARPU_INCLUDE_DIRS)
message(STATUS " STARPU_INCLUDES = ${STARPU_INCLUDE_DIRS}") message(STATUS " STARPU_INCLUDES = ${STARPU_INCLUDE_DIRS}")
endif() endif()
OPTION( ScalFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF ) OPTION( ScalFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF )
MESSAGE( STATUS "ScalFMM_USE_OPENCL = ${ScalFMM_USE_OPENCL}" ) MESSAGE( STATUS "ScalFMM_USE_OPENCL = ${ScalFMM_USE_OPENCL}" )
if(ScalFMM_USE_OPENCL) if(ScalFMM_USE_OPENCL)
include_directories($ENV{OPENCL_INC}) include_directories($ENV{OPENCL_INC})
SET(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L$ENV{OPENCL_LIB}; -lOpenCL") SET(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L$ENV{OPENCL_LIB}; -lOpenCL")
endif() endif()
......
...@@ -110,7 +110,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find) ...@@ -110,7 +110,7 @@ macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
endif() endif()
endif() endif()
message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n" message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
"- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\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 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 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}") "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
...@@ -135,14 +135,13 @@ macro(Print_Find_Library_Blas_CheckFunc_Status _name) ...@@ -135,14 +135,13 @@ macro(Print_Find_Library_Blas_CheckFunc_Status _name)
endmacro() endmacro()
if (NOT BLAS_FOUND) if (NOT BLAS_FOUND)
set(BLAS_DIR "" CACHE PATH "Root directory of BLAS library") set(BLAS_DIR "" CACHE PATH "Installation directory of BLAS library")
if (NOT BLAS_FIND_QUIETLY) if (NOT BLAS_FIND_QUIETLY)
message(STATUS "A cache variable, namely BLAS_DIR, has been set to specify the install directory of BLAS") message(STATUS "A cache variable, namely BLAS_DIR, has been set to specify the install directory of BLAS")
endif() endif()
endif() endif()
option(BLAS_VERBOSE "Print some additional information during BLAS option(BLAS_VERBOSE "Print some additional information during BLAS libraries detection" OFF)
libraries detection" OFF)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckFortranFunctionExists) include(CheckFortranFunctionExists)
...@@ -179,7 +178,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) ...@@ -179,7 +178,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
set(_libdir ${ARGN}) set(_libdir ${ARGN})
set(_libraries_work TRUE) set(_libraries_work TRUE)
set(${LIBRARIES} ${_flags}) set(${LIBRARIES})
set(_combined_name) set(_combined_name)
if (NOT _libdir) if (NOT _libdir)
if (BLAS_DIR) if (BLAS_DIR)
...@@ -192,20 +191,20 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) ...@@ -192,20 +191,20 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
list(APPEND _libdir "${BLAS_DIR}/lib32") list(APPEND _libdir "${BLAS_DIR}/lib32")
list(APPEND _libdir "${BLAS_DIR}/lib/ia32") list(APPEND _libdir "${BLAS_DIR}/lib/ia32")
endif() endif()
endif () elseif (BLAS_LIBDIR)
if (BLAS_LIBDIR)
list(APPEND _libdir "${BLAS_LIBDIR}") list(APPEND _libdir "${BLAS_LIBDIR}")
endif () else()
if (WIN32) if (WIN32)
string(REPLACE ":" ";" _libdir2 "$ENV{LIB}") string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")
elseif (APPLE) elseif (APPLE)
string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}") string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")
else () else ()
string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}") string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")
endif () endif ()
list(APPEND _libdir "${_libdir2}") list(APPEND _libdir "${_libdir2}")
list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
endif()
endif () endif ()
if (BLAS_VERBOSE) if (BLAS_VERBOSE)
...@@ -272,10 +271,10 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread) ...@@ -272,10 +271,10 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
endif() endif()
if(_libraries_work) if(_libraries_work)
set(${LIBRARIES} ${${LIBRARIES}} ${_thread}) set(${LIBRARIES} ${${LIBRARIES}} ${_thread})
else() else(_libraries_work)
set(${LIBRARIES} FALSE) set(${LIBRARIES} FALSE)
endif() endif(_libraries_work)
# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") # message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
...@@ -476,6 +475,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") ...@@ -476,6 +475,9 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
"${SEARCH_LIBS}" "${SEARCH_LIBS}"
"${CMAKE_THREAD_LIBS_INIT};${LM}" "${CMAKE_THREAD_LIBS_INIT};${LM}"
) )
if(_LIBRARIES)
set(BLAS_LINKER_FLAGS "${additional_flags}")
endif()
endif() endif()
endforeach () endforeach ()
...@@ -870,7 +872,7 @@ if(BLA_F95) ...@@ -870,7 +872,7 @@ if(BLA_F95)
else(BLAS95_FOUND) else(BLAS95_FOUND)
message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas 95 libraries could not be found or check of symbols failed." message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas 95 libraries could not be found or check of symbols failed."
"\nPlease indicate where to find blas libraries. You have three options:\n" "\nPlease indicate where to find blas libraries. You have three options:\n"
"- Option 1: Provide the root directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n" "- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure." "\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."
...@@ -890,6 +892,9 @@ if(BLA_F95) ...@@ -890,6 +892,9 @@ if(BLA_F95)
set(BLAS_FOUND TRUE) set(BLAS_FOUND TRUE)
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}") set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
if (NOT BLAS_LIBRARIES_DEP)
set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}")
endif()
else(BLA_F95) else(BLA_F95)
...@@ -906,7 +911,7 @@ else(BLA_F95) ...@@ -906,7 +911,7 @@ else(BLA_F95)
else(BLAS_FOUND) else(BLAS_FOUND)
message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas libraries could not be found or check of symbols failed." message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas libraries could not be found or check of symbols failed."
"\nPlease indicate where to find blas libraries. You have three options:\n" "\nPlease indicate where to find blas libraries. You have three options:\n"
"- Option 1: Provide the root directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n" "- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"
"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n" "- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n" "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure." "\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."
...@@ -927,3 +932,13 @@ else(BLA_F95) ...@@ -927,3 +932,13 @@ else(BLA_F95)
endif(BLA_F95) endif(BLA_F95)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
if (BLAS_FOUND AND NOT BLAS_DIR)
list(GET BLAS_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
set(BLAS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of BLAS library" FORCE)
endif()
endif()
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
# This module finds headers and cblas library. # This module finds headers and cblas library.
# Results are reported in variables: # Results are reported in variables:
# CBLAS_FOUND - True if headers and requested libraries were found # CBLAS_FOUND - True if headers and requested libraries were found
# CBLAS_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# CBLAS_INCLUDE_DIRS - cblas include directories # CBLAS_INCLUDE_DIRS - cblas include directories
# CBLAS_LIBRARY_DIRS - Link directories for cblas libraries # CBLAS_LIBRARY_DIRS - Link directories for cblas libraries
# CBLAS_LIBRARIES - cblas component libraries to be linked # CBLAS_LIBRARIES - cblas component libraries to be linked
...@@ -65,7 +66,7 @@ ...@@ -65,7 +66,7 @@
if (NOT CBLAS_FOUND) if (NOT CBLAS_FOUND)
set(CBLAS_DIR "" CACHE PATH "Root directory of CBLAS library") set(CBLAS_DIR "" CACHE PATH "Installation directory of CBLAS library")
if (NOT CBLAS_FIND_QUIETLY) if (NOT CBLAS_FIND_QUIETLY)
message(STATUS "A cache variable, namely CBLAS_DIR, has been set to specify the install directory of CBLAS") message(STATUS "A cache variable, namely CBLAS_DIR, has been set to specify the install directory of CBLAS")
endif() endif()
...@@ -107,7 +108,7 @@ if (BLAS_FOUND) ...@@ -107,7 +108,7 @@ if (BLAS_FOUND)
# check if a cblas function exists in the BLAS lib # check if a cblas function exists in the BLAS lib
# this can be the case with libs such as MKL, ACML # this can be the case with libs such as MKL, ACML
include(CheckFunctionExists) include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}") set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LINKER_FLAGS};${BLAS_LIBRARIES}")
unset(CBLAS_WORKS CACHE) unset(CBLAS_WORKS CACHE)
check_function_exists(cblas_dscal CBLAS_WORKS) check_function_exists(cblas_dscal CBLAS_WORKS)
mark_as_advanced(CBLAS_WORKS) mark_as_advanced(CBLAS_WORKS)
...@@ -119,10 +120,15 @@ if (BLAS_FOUND) ...@@ -119,10 +120,15 @@ if (BLAS_FOUND)
endif() endif()
# test succeeds: CBLAS is in BLAS # test succeeds: CBLAS is in BLAS
set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}") set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}")
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}") if (BLAS_LIBRARY_DIRS)
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
endif()
if(BLAS_INCLUDE_DIRS) if(BLAS_INCLUDE_DIRS)
set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}") set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}")
endif() endif()
if (BLAS_LINKER_FLAGS)
set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif() endif()
endif (NOT CBLAS_STANDALONE) endif (NOT CBLAS_STANDALONE)
...@@ -258,6 +264,7 @@ if (BLAS_FOUND) ...@@ -258,6 +264,7 @@ if (BLAS_FOUND)
if(CBLAS_LIBRARIES) if(CBLAS_LIBRARIES)
set(REQUIRED_INCDIRS) set(REQUIRED_INCDIRS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS) set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS) set(REQUIRED_LIBS)
...@@ -277,10 +284,14 @@ if (BLAS_FOUND) ...@@ -277,10 +284,14 @@ if (BLAS_FOUND)
list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}") list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
endif() endif()
list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}") list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
# set required libraries for link # set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}") set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS}) foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}") list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach() endforeach()
...@@ -297,8 +308,10 @@ if (BLAS_FOUND) ...@@ -297,8 +308,10 @@ if (BLAS_FOUND)
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}") set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}") set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}") set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CBLAS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP) list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP) list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
else() else()
if(NOT CBLAS_FIND_QUIETLY) if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails") message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails")
...@@ -323,6 +336,14 @@ else(BLAS_FOUND) ...@@ -323,6 +336,14 @@ else(BLAS_FOUND)
endif(BLAS_FOUND) endif(BLAS_FOUND)
if (CBLAS_LIBRARIES AND NOT CBLAS_DIR)
list(GET CBLAS_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH)
if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
set(CBLAS_DIR "${not_cached_dir}" CACHE PATH "Installation directory of CBLAS library" FORCE)
endif()
endif()
# check that CBLAS has been found # check that CBLAS has been found
# ------------------------------- # -------------------------------
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
# This module finds headers and chameleon library. # This module finds headers and chameleon library.
# Results are reported in variables: # Results are reported in variables:
# CHAMELEON_FOUND - True if headers and requested libraries were found # 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_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries # CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries
# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories # CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
...@@ -67,7 +68,7 @@ ...@@ -67,7 +68,7 @@
if (NOT CHAMELEON_FOUND) if (NOT CHAMELEON_FOUND)
set(CHAMELEON_DIR "" CACHE PATH "Root directory of CHAMELEON library") set(CHAMELEON_DIR "" CACHE PATH "Installation directory of CHAMELEON library")
if (NOT CHAMELEON_FIND_QUIETLY) if (NOT CHAMELEON_FIND_QUIETLY)
message(STATUS "A cache variable, namely CHAMELEON_DIR, has been set to specify the install directory of CHAMELEON") message(STATUS "A cache variable, namely CHAMELEON_DIR, has been set to specify the install directory of CHAMELEON")
endif() endif()
...@@ -155,9 +156,13 @@ if(PKG_CONFIG_EXECUTABLE) ...@@ -155,9 +156,13 @@ if(PKG_CONFIG_EXECUTABLE)
endif() endif()
endif() endif()
endif(PKG_CONFIG_EXECUTABLE) set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_INCLUDE_DIRS}")
set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_LIBRARY_DIRS}")
set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_LIBRARIES}")
if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) endif()
if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND OR CHAMELEON_DIR )
if (NOT CHAMELEON_FIND_QUIETLY) if (NOT CHAMELEON_FIND_QUIETLY)
message(STATUS "Looking for CHAMELEON - PkgConfig not used") message(STATUS "Looking for CHAMELEON - PkgConfig not used")
...@@ -265,7 +270,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -265,7 +270,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
# CHAMELEON may depend on CUDA/CUBLAS # CHAMELEON may depend on CUDA/CUBLAS
#------------------------------------ #------------------------------------
if (NOT CUDA_FOUND AND CHAMELEON_LOOK_FOR_CUDA) if (NOT CUDA_FOUND AND CHAMELEON_LOOK_FOR_CUDA)
if (CHAMELEON_FIND_REQUIRED) if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_CUDA)
find_package(CUDA REQUIRED) find_package(CUDA REQUIRED)
else() else()
find_package(CUDA) find_package(CUDA)
...@@ -285,7 +290,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -285,7 +290,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
#------------------------------------------------- #-------------------------------------------------
if( CUDA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA ) if( CUDA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA )
set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired") set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired")
if (CHAMELEON_FIND_REQUIRED) if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MAGMA)
find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} REQUIRED) find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} REQUIRED)
else() else()
find_package(MAGMA ${CHAMELEON_MAGMA_VERSION}) find_package(MAGMA ${CHAMELEON_MAGMA_VERSION})
...@@ -302,7 +307,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -302,7 +307,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
if(NOT MPI_C_COMPILER) if(NOT MPI_C_COMPILER)
set(MPI_C_COMPILER mpicc) set(MPI_C_COMPILER mpicc)
endif() endif()
if (CHAMELEON_FIND_REQUIRED) if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MPI)
find_package(MPI REQUIRED) find_package(MPI REQUIRED)
else() else()
find_package(MPI) find_package(MPI)
...@@ -338,7 +343,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -338,7 +343,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
if (CHAMELEON_LOOK_FOR_FXT) if (CHAMELEON_LOOK_FOR_FXT)
list(APPEND STARPU_COMPONENT_LIST "FXT") list(APPEND STARPU_COMPONENT_LIST "FXT")
endif() endif()
if (CHAMELEON_FIND_REQUIRED) if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_STARPU)
find_package(STARPU ${CHAMELEON_STARPU_VERSION} REQUIRED find_package(STARPU ${CHAMELEON_STARPU_VERSION} REQUIRED
COMPONENTS ${STARPU_COMPONENT_LIST}) COMPONENTS ${STARPU_COMPONENT_LIST})
else() else()
...@@ -351,7 +356,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -351,7 +356,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
if( NOT QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK ) if( NOT QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK )
# try to find quark runtime # try to find quark runtime
if (CHAMELEON_FIND_REQUIRED) if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_QUARK)
find_package(QUARK REQUIRED COMPONENTS HWLOC) find_package(QUARK REQUIRED COMPONENTS HWLOC)
else() else()
find_package(QUARK COMPONENTS HWLOC) find_package(QUARK COMPONENTS HWLOC)
...@@ -499,10 +504,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -499,10 +504,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
# check a function to validate the find # check a function to validate the find
if(CHAMELEON_LIBRARIES) if(CHAMELEON_LIBRARIES)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS) set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS) set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS) set(REQUIRED_LIBS)
set(REQUIRED_FLAGS)
# CHAMELEON # CHAMELEON
if (CHAMELEON_INCLUDE_DIRS) if (CHAMELEON_INCLUDE_DIRS)
...@@ -598,7 +603,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND ) ...@@ -598,7 +603,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}") list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")
endif() endif()
if (MPI_C_LINK_FLAGS) if (MPI_C_LINK_FLAGS)
list(APPEND REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}") list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")
endif() endif()
list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")