Commit 9b9fb589 authored by Florent Pruvost's avatar Florent Pruvost
Browse files

use either libs + dependencies or only libs for starpu and fftw - improve...

use either libs + dependencies or only libs for starpu and fftw - improve cmake modules: remove duplicates dirs
parent 1cc4f505
......@@ -318,13 +318,23 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
# MKL, THREADS|OMP and/or SIMPLE|DOUBLE|LONG|QUAD
# Default is DOUBLE and without THREADS|OMP
find_package(FFTW REQUIRED COMPONENTS MKL)
if(FFTW_LIBRARY_DIRS)
if(FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
elseif(FFTW_LIBRARY_DIRS)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS};" CACHE STRING "Set your MKL flags")
endif()
foreach (fft_lib ${FFTW_LIBRARIES})
if (FFTW_LIBRARIES_DEP)
foreach (fft_lib ${FFTW_LIBRARIES_DEP})
set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
endforeach()
if (FFTW_INCLUDE_DIRS)
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}")
......@@ -339,14 +349,24 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
# Default is DOUBLE and without THREADS|OMP
find_package(FFTW REQUIRED)
if(FFTW_LIBRARY_DIRS)
if(FFTW_LIBRARY_DIRS_DEP)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS_DEP};" CACHE STRING "Set your MKL flags")
elseif(FFTW_LIBRARY_DIRS)
set(FFT_LIBRARIES "-L${FFTW_LIBRARY_DIRS};" CACHE STRING "Set your MKL flags")
endif()
foreach (fft_lib ${FFTW_LIBRARIES})
set(FFT_LIBRARIES "${FFT_LIBRARIES} ${fft_lib};")
endforeach()
if (FFTW_INCLUDE_DIRS)
set(FFT_INCLUDES "${FFTW_INCLUDE_DIRS}" )
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}")
......@@ -431,23 +451,45 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_SOURCE_DIR}/CMakeModules/morse/")
COMPONENTS ${STARPU_COMPONENT_LIST})
# Append list of libraries and include dirs
if (STARPU_INCLUDE_DIRS)
if (STARPU_INCLUDE_DIRS_DEP)
include_directories(${STARPU_INCLUDE_DIRS_DEP})
elseif(STARPU_INCLUDE_DIRS)
include_directories(${STARPU_INCLUDE_DIRS})
endif()
foreach (starpu_libdir ${STARPU_LIBRARY_DIRS})
if (${starpu_libdir} MATCHES "^-L")
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_libdir}")
else()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L${starpu_libdir}")
endif()
endforeach()
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()
if (STARPU_LIBRARY_DIRS_DEP)
foreach (starpu_libdir ${STARPU_LIBRARY_DIRS_DEP})
if (${starpu_libdir} MATCHES "^ *-L")
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${starpu_libdir}")
else()
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; -L${starpu_libdir}")
endif()
endforeach()
elseif(STARPU_LIBRARY_DIRS)
foreach (starpu_libdir ${STARPU_LIBRARY_DIRS})
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)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}; ${CUDA_LIBRARIES}")
......
......@@ -297,6 +297,8 @@ if (BLAS_FOUND)
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
else()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails")
......
......@@ -701,6 +701,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR NOT CHAMELEON_FOUND )
endif()
set(CHAMELEON_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CHAMELEON_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES CHAMELEON_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CHAMELEON_INCLUDE_DIRS_DEP)
else()
if(NOT CHAMELEON_FIND_QUIETLY)
message(STATUS "Looking for chameleon : test of MORSE_Init fails")
......
......@@ -390,6 +390,8 @@ if( NOT FFTW_FOUND )
set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS_DEP)
else()
if(NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
......
......@@ -300,6 +300,8 @@ if (LAPACK_FOUND)
set(LAPACKE_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(LAPACKE_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(LAPACKE_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES LAPACKE_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES LAPACKE_INCLUDE_DIRS_DEP)
else()
if(NOT LAPACKE_FIND_QUIETLY)
message(STATUS "Looking for lapacke: test of LAPACKE_dgeqrf with lapacke and lapack libraries fails")
......
......@@ -342,6 +342,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT MAGMA_FOUND) OR NOT MAGMA_FOUND )
set(MAGMA_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(MAGMA_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(MAGMA_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES MAGMA_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES MAGMA_INCLUDE_DIRS_DEP)
else()
if(NOT MAGMA_FIND_QUIETLY)
message(STATUS "Looking for magma : test of magma_dgetrf with
......
......@@ -299,6 +299,7 @@ else ()
endif()
endif()
# Looking for lib
# ---------------
......@@ -405,7 +406,7 @@ else ()
message(STATUS "Looking for mumps -- libzmumps.a not found")
endif()
endif()
list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS)
# check that one precision arithmetic at least has been discovered
if (NOT MUMPS_PREC_S AND NOT MUMPS_PREC_D AND NOT MUMPS_PREC_C AND NOT MUMPS_PREC_S)
if (MUMPS_FIND_REQUIRED)
......@@ -439,6 +440,7 @@ if (MUMPS_mpiseq_LIBRARY)
list(APPEND MUMPS_LIBRARIES "${MUMPS_mpiseq_LIBRARY}")
get_filename_component(mpiseq_lib_path ${MUMPS_mpiseq_LIBRARY} PATH)
list(APPEND MUMPS_LIBRARY_DIRS "${mpiseq_lib_path}")
list(APPEND MUMPS_INCLUDE_DIRS "${mpiseq_lib_path}")
endif()
else ()
if (MUMPS_FIND_REQUIRED AND MUMPS_LOOK_FOR_SEQ)
......@@ -465,6 +467,8 @@ else ()
endif()
endif()
endif()
list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS)
list(REMOVE_DUPLICATES MUMPS_INCLUDE_DIRS)
# check a function to validate the find
if(MUMPS_LIBRARIES)
......@@ -583,6 +587,8 @@ if(MUMPS_LIBRARIES)
set(MUMPS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(MUMPS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(MUMPS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES MUMPS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES MUMPS_INCLUDE_DIRS_DEP)
else()
if(NOT MUMPS_FIND_QUIETLY)
message(STATUS "Looking for MUMPS : test of [sdcz]mumps() fails")
......
......@@ -95,8 +95,8 @@ if( PASTIX_FIND_COMPONENTS )
endif()
if (${component} STREQUAL "MPI")
# means we look for the MPI version of PaStiX (default)
set(PASTIX_LOOK_FOR_SEQ ON)
set(PASTIX_LOOK_FOR_MPI OFF)
set(PASTIX_LOOK_FOR_SEQ OFF)
set(PASTIX_LOOK_FOR_MPI ON)
endif()
if (${component} STREQUAL "STARPU")
# means we look for PaStiX with StarPU
......@@ -480,13 +480,25 @@ if(PASTIX_LIBRARIES)
if (PASTIX_LOOK_FOR_STARPU AND STARPU_FOUND)
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_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()
foreach(libdir ${STARPU_LIBRARY_DIRS_DEP})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
endif()
endforeach()
list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}")
endif()
# CUDA
if (PASTIX_LOOK_FOR_STARPU_CUDA AND CUDA_FOUND)
......@@ -603,6 +615,8 @@ if(PASTIX_LIBRARIES)
endif()
set(PASTIX_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(PASTIX_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES PASTIX_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES PASTIX_INCLUDE_DIRS_DEP)
else()
if(NOT PASTIX_FIND_QUIETLY)
message(STATUS "Looking for PASTIX : test of pastix() fails")
......
......@@ -264,6 +264,8 @@ if(PTSCOTCH_LIBRARIES)
endif()
set(PTSCOTCH_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(PTSCOTCH_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS_DEP)
else()
if(NOT PTSCOTCH_FIND_QUIETLY)
message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH library fails")
......
......@@ -265,6 +265,8 @@ if(QUARK_LIBRARIES)
set(QUARK_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(QUARK_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(QUARK_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES QUARK_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES QUARK_INCLUDE_DIRS_DEP)
else()
if(NOT QUARK_FIND_QUIETLY)
message(STATUS "Looking for QUARK : test of QUARK_New with QUARK library fails")
......
......@@ -227,7 +227,7 @@ if(SCOTCH_LIBRARIES)
check_function_exists(SCOTCH_graphInit SCOTCH_WORKS)
mark_as_advanced(SCOTCH_WORKS)
if(NOT SCOTCH_WORKS)
if(SCOTCH_WORKS)
# save link with dependencies
set(SCOTCH_LIBRARIES "${REQUIRED_LIBS}")
else()
......
......@@ -33,9 +33,9 @@
# STARPU_LIBRARIES - starpu libraries
# STARPU_SHM_LIBRARIES - starpu libraries without libstarpumpi
# STARPU_MPI_LIBRARIES - starpu libraries with libstarpumpi
# MAGMA_INCLUDE_DIRS_DEP - starpu + dependencies include directories
# MAGMA_LIBRARY_DIRS_DEP - starpu + dependencies link directories
# MAGMA_LIBRARIES_DEP - starpu libraries + dependencies
# STARPU_INCLUDE_DIRS_DEP - starpu + dependencies include directories
# STARPU_LIBRARY_DIRS_DEP - starpu + dependencies link directories
# STARPU_LIBRARIES_DEP - starpu libraries + dependencies
# STARPU_VERSION_STRING - A human-readable string containing the version of the package found
# STARPU_VERSION_MAJOR - The major version of the package found
# STARPU_VERSION_MINOR - The minor version of the package found
......@@ -736,6 +736,8 @@ if( (NOT PKG_CONFIG_EXECUTABLE AND NOT STARPU_FOUND) OR
endif()
set(STARPU_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(STARPU_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES STARPU_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES STARPU_INCLUDE_DIRS_DEP)
else()
if(NOT STARPU_FIND_QUIETLY)
message(STATUS "Looking for starpu : test of starpu_init fails")
......
......@@ -141,19 +141,19 @@ if (LAPACK_FOUND)
if(TMG_LIBDIR)
set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND")
find_library(TMG_tmg_LIBRARY
NAMES tmg
NAMES tmglib
HINTS ${TMG_LIBDIR} )
else()
if(TMG_DIR)
set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND")
find_library(TMG_tmg_LIBRARY
NAMES tmg
NAMES tmglib
HINTS ${TMG_DIR}
PATH_SUFFIXES lib lib32 lib64 )
else()
set(TMG_tmg_LIBRARY "TMG_tmg_LIBRARY-NOTFOUND")
find_library(TMG_tmg_LIBRARY
NAMES tmg
NAMES tmglib
HINTS ${_lib_env} )
endif()
endif()
......@@ -234,6 +234,8 @@ if (LAPACK_FOUND)
set(TMG_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(TMG_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(TMG_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
list(REMOVE_DUPLICATES TMG_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES TMG_INCLUDE_DIRS_DEP)
else()
if(NOT TMG_FIND_QUIETLY)
message(STATUS "Looking for tmg: test of dlarnv and dlagsy with tmg and lapack libraries fails")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment