Commit 9366d252 authored by PRUVOST Florent's avatar PRUVOST Florent

Avoid to add empty directories when checking a function in Finds - Fix errors...

Avoid to add empty directories when checking a function in Finds - Fix errors in FindCHAMELEON.cmake
parent 314d3651
......@@ -242,13 +242,18 @@ if (BLAS_FOUND)
if(CBLAS_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS};${BLAS_INCLUDE_DIRS}")
if (CBLAS_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}")
endif()
if (BLAS_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${CBLAS_LIBRARIES};${BLAS_LIBRARIES}")
if (CBLAS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${CBLAS_LIBRARY_DIRS}")
if (BLAS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${BLAS_LIBRARY_DIRS}")
endif()
endif()
if (BLAS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${BLAS_LIBRARY_DIRS}")
endif()
unset(CBLAS_WORKS CACHE)
......
......@@ -262,7 +262,7 @@ if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES)
endif (NOT MPI_FOUND)
if( NOT STARPU_FOUND )
if( NOT STARPU_FOUND AND NOT QUARK_FOUND )
set(CHAMELEON_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")
......@@ -293,9 +293,9 @@ if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES)
COMPONENTS ${STARPU_COMPONENT_LIST}
OPTIONAL_COMPONENTS ${STARPU_OPTIONAL_COMPONENT_LIST})
endif( NOT STARPU_FOUND )
endif()
if( NOT STARPU_FOUND AND NOT QUARK_FOUND)
if( NOT STARPU_FOUND AND NOT QUARK_FOUND )
# try to find quark runtime
find_package(QUARK COMPONENTS HWLOC)
......@@ -305,7 +305,7 @@ if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES)
"runtimes have been found while at least one of them should be installed")
endif()
endif( NOT STARPU_FOUND AND NOT QUARK_FOUND)
endif()
# Looking for include
# -------------------
......@@ -446,79 +446,106 @@ if(NOT CHAMELEON_FOUND OR NOT CHAMELEON_LIBRARIES)
if(CHAMELEON_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${CHAMELEON_INCLUDE_DIRS}")
if (CHAMELEON_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${CHAMELEON_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_FLAGS)
foreach(libdir ${CHAMELEON_LIBRARY_DIRS})
if (libdir)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
set(CMAKE_REQUIRED_LIBRARIES "${CHAMELEON_LIBRARIES}")
if (STARPU_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}")
if(STARPU_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${STARPU_LIBRARY_DIRS}")
if (STARPU_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}")
endif()
foreach(libdir ${STARPU_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES}")
endif()
if (QUARK_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "$QUARK_INCLUDE_DIRS}")
if (QUARK_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "$QUARK_INCLUDE_DIRS}")
endif()
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${QUARK_LIBRARY_DIRS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${QUARK_LIBRARY_DIRS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${QUARK_LIBRARIES}")
endif()
if (CUDA_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${CUDA_LIBRARY_DIRS}")
if (CUDA_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}")
endif()
foreach(libdir ${CUDA_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
endif()
if (MAGMA_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${MAGMA_LIBRARY_DIRS}")
if (EXISTS MAGMA_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}")
endif()
foreach(libdir ${MAGMA_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${${MAGMA_LIBRARIES}}")
endif()
if (MPI_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${MPI_C_LINK_FLAGS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
endif()
if (HWLOC_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${HWLOC_LIBRARY_DIRS}")
if (HWLOC_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
endif()
foreach(libdir ${HWLOC_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}")
endif()
if (TMG_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${TMG_INCLUDE_DIRS}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${TMG_LIBRARY_DIRS}")
if (TMG_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${TMG_INCLUDE_DIRS}")
endif()
foreach(libdir ${TMG_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${TMG_LIBRARIES}")
endif()
if (LAPACKE_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACKE_INCLUDE_DIRS}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${LAPACKE_LIBRARY_DIRS}")
if (LAPACKE_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACKE_INCLUDE_DIRS}")
endif()
foreach(libdir ${LAPACKE_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${LAPACKE_LIBRARIES}")
endif()
if (CBLAS_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}")
if(QUARK_LIBRARY_DIRS)
list(APPEND CMAKE_REQUIRED_FLAGS "-L${CBLAS_LIBRARY_DIRS}")
if (CBLAS_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}")
endif()
foreach(libdir ${CBLAS_LIBRARY_DIRS})
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${CBLAS_LIBRARIES}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${CHAMELEON_EXTRA_LIBRARIES})
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
unset(CHAMELEON_WORKS CACHE)
include(CheckFunctionExists)
......
......@@ -205,7 +205,9 @@ if(NOT FXT_FOUND OR NOT FXT_LIBRARIES)
if(FXT_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${FXT_INCLUDE_DIRS}")
if (FXT_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${FXT_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${FXT_LIBRARIES}")
if (FXT_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${FXT_LIBRARY_DIRS}")
......
......@@ -212,7 +212,9 @@ if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
if(HWLOC_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
if (HWLOC_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}")
if (HWLOC_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${HWLOC_LIBRARY_DIRS}")
......
......@@ -237,7 +237,12 @@ if (LAPACK_FOUND)
if(LAPACKE_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${LAPACKE_INCLUDE_DIRS};${LAPACK_INCLUDE_DIRS}")
if (LAPACKE_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${LAPACKE_INCLUDE_DIRS}")
endif()
if (LAPACK_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACK_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${LAPACKE_LIBRARIES};${LAPACK_LIBRARIES};-lm")
if (CMAKE_Fortran_COMPILER MATCHES ".+gfortran.*")
list(APPEND CMAKE_REQUIRED_LIBRARIES "-lgfortran")
......@@ -246,9 +251,9 @@ if (LAPACK_FOUND)
endif()
if (LAPACKE_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${LAPACKE_LIBRARY_DIRS}")
if(LAPACK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}")
endif()
endif()
if (LAPACK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}")
endif()
unset(LAPACKE_WORKS CACHE)
......
......@@ -279,19 +279,27 @@ if(NOT MAGMA_FOUND OR NOT MAGMA_LIBRARIES)
if (MAGMA_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS};${CBLAS_INCLUDE_DIRS};${CUDA_INCLUDE_DIRS}")
if (MAGMA_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}")
endif()
if (CBLAS_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CBLAS_INCLUDE_DIRS}")
endif()
if (CUDA_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${MAGMA_LIBRARIES};${CBLAS_LIBRARIES};${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES};${LAPACK_LIBRARIES}")
if (MAGMA_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${MAGMA_LIBRARY_DIRS}")
if (CBLAS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CBLAS_LIBRARY_DIRS}")
if(CUDA_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CUDA_LIBRARY_DIRS}")
if(LAPACK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}")
endif()
endif()
endif()
endif()
if (CBLAS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CBLAS_LIBRARY_DIRS}")
endif()
if(CUDA_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CUDA_LIBRARY_DIRS}")
endif()
if(LAPACK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}")
endif()
unset(MAGMA_WORKS CACHE)
......
......@@ -171,7 +171,9 @@ endif ()
if(METIS_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}")
if (METIS_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${METIS_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${METIS_LIBRARIES}")
if (METIS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${METIS_LIBRARY_DIRS}")
......
......@@ -193,7 +193,9 @@ endif ()
if(PARMETIS_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${PARMETIS_INCLUDE_DIRS}")
if (PARMETIS_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${PARMETIS_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${PARMETIS_LIBRARIES}")
if (PARMETIS_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${PARMETIS_LIBRARY_DIRS}")
......
......@@ -223,7 +223,9 @@ endforeach()
if(PTSCOTCH_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${PTSCOTCH_INCLUDE_DIRS}")
if (PTSCOTCH_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${PTSCOTCH_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${PTSCOTCH_LIBRARIES}")
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
......@@ -232,10 +234,6 @@ if(PTSCOTCH_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS "-L${PTSCOTCH_LIBRARY_DIRS}")
endif()
if (MPI_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
if (MPI_C_LINK_FLAGS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${MPI_C_LINK_FLAGS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
endif()
......
......@@ -68,10 +68,16 @@ if( QUARK_FIND_COMPONENTS )
endforeach()
endif()
# QUARK may depend on Threads, try to find it
if (NOT Threads_FOUND)
find_package(Threads REQUIRED)
endif()
# QUARK may depend on HWLOC, try to find it
if (NOT HWLOC_FOUND)
find_package(HWLOC)
endif()
# Looking for include
# -------------------
......@@ -192,13 +198,17 @@ endif ()
if(QUARK_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${QUARK_INCLUDE_DIRS}")
if (QUARK_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${QUARK_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${QUARK_LIBRARIES};${CMAKE_THREAD_LIBS_INIT}")
if (QUARK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${QUARK_LIBRARY_DIRS}")
endif()
if (HWLOC_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
if (HWLOC_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}")
if (HWLOC_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${HWLOC_LIBRARY_DIRS}")
......
......@@ -211,7 +211,9 @@ endforeach()
if(SCOTCH_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}")
if (SCOTCH_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${SCOTCH_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${SCOTCH_LIBRARIES}")
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
......
......@@ -100,6 +100,26 @@ if( STARPU_FIND_COMPONENTS )
endforeach()
endif()
# STARPU may depend on CUDA, try to find it
if (NOT CUDA_FOUND)
find_package(CUDA)
endif()
# STARPU may depend on MPI, try to find it
if (NOT MPI_FOUND)
find_package(MPI)
endif()
# STARPU may depend on HWLOC, try to find it
if (NOT HWLOC_FOUND)
find_package(HWLOC)
endif()
# STARPU may depend on MAGMA, try to find it
if (NOT MAGMA_FOUND)
find_package(MAGMA)
endif()
# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)
# -------------------------------------------------------------------------------------
include(FindPkgConfig)
......@@ -110,7 +130,7 @@ if(PKG_CONFIG_EXECUTABLE)
pkg_search_module(STARPU_SHM libstarpu)
set(STARPU_INCLUDE_DIRS "${STARPU_SHM_INCLUDE_DIRS}")
set(STARPU_LIBRARY_DIRS "${STARPU_SHM_LIBRARY_DIRS}")
if(STARPU_LOOK_FOR_MPI)
if(STARPU_LOOK_FOR_MPI OR MPI_FOUND)
pkg_search_module(STARPU_MPI libstarpumpi)
endif()
if (NOT STARPU_FIND_QUIETLY)
......@@ -169,19 +189,8 @@ if(PKG_CONFIG_EXECUTABLE)
endif(PKG_CONFIG_EXECUTABLE)
# STARPU may depend on CUDA, try to find it
if (NOT CUDA_FOUND)
find_package(CUDA)
endif()
# STARPU may depend on MPI, try to find it
if (NOT MPI_FOUND)
find_package(MPI)
endif()
if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
( STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) )
( MPI_FOUND AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) )
)
# Looking for include
......@@ -308,10 +317,10 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
# create list of headers to find
list(APPEND STARPU_hdrs_to_find "starpu.h;starpu_profiling.h")
if(STARPU_LOOK_FOR_MPI)
if(STARPU_LOOK_FOR_MPI OR MPI_FOUND)
list(APPEND STARPU_hdrs_to_find "starpu_mpi.h")
endif()
if(STARPU_LOOK_FOR_CUDA)
if(STARPU_LOOK_FOR_CUDA OR CUDA_FOUND)
list(APPEND STARPU_hdrs_to_find "starpu_cuda.h;starpu_scheduler.h")
endif()
......@@ -406,7 +415,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
# create list of libs to find
set(STARPU_libs_to_find "starpu-${STARPU_VERSION_STRING}")
set(STARPU_SHM_libs_to_find "starpu-${STARPU_VERSION_STRING}")
if (STARPU_LOOK_FOR_MPI)
if (STARPU_LOOK_FOR_MPI OR MPI_FOUND)
list(APPEND STARPU_libs_to_find "starpumpi-${STARPU_VERSION_STRING}")
set(STARPU_MPI_libs_to_find "${STARPU_libs_to_find}")
endif()
......@@ -456,7 +465,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
endif()
endif()
endforeach()
if (STARPU_LOOK_FOR_MPI)
if (STARPU_LOOK_FOR_MPI OR MPI_FOUND)
foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find})
if(starpu_mpi_lib STREQUAL starpu_lib)
if (STARPU_MPI_LIBRARIES)
......@@ -495,7 +504,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
endif()
endif()
endforeach()
if (STARPU_LOOK_FOR_MPI)
if (STARPU_LOOK_FOR_MPI OR MPI_FOUND)
foreach(starpu_mpi_lib ${STARPU_MPI_libs_to_find})
if(starpu_mpi_lib STREQUAL starpu_lib)
if (STARPU_MPI_LIBRARIES)
......@@ -543,41 +552,45 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
if(STARPU_LIBRARIES)
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}")
if (STARPU_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_FLAGS)
foreach(libdir ${STARPU_LIBRARY_DIRS})
if(libdir)
if (libdir)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${libdir}")
endif()
endforeach()
set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES}")
if (HWLOC_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
if (HWLOC_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${HWLOC_INCLUDE_DIRS}")
endif()
if (HWLOC_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${HWLOC_LIBRARY_DIRS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${HWLOC_LIBRARIES}")
endif()
if (MPI_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
if (MPI_C_LINK_FLAGS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${MPI_C_LINK_FLAGS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
endif()
if (CUDA_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}")
if (CUDA_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${CUDA_INCLUDE_DIRS}")
endif()
if (CUDA_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${CUDA_LIBRARY_DIRS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
endif()
if (MAGMA_FOUND)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}")
if (MAGMA_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MAGMA_INCLUDE_DIRS}")
endif()
if (MAGMA_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${MAGMA_LIBRARY_DIRS}")
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${${MAGMA_LIBRARIES}}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MAGMA_LIBRARIES}")
endif()
unset(STARPU_WORKS CACHE)
......@@ -605,7 +618,7 @@ if( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
endif(STARPU_LIBRARIES)
endif( (NOT STARPU_SHM_FOUND) OR (NOT STARPU_SHM_LIBRARIES) OR
( STARPU_LOOK_FOR_MPI AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) )
( MPI_FOUND AND (NOT STARPU_MPI_FOUND OR NOT STARPU_MPI_LIBRARIES) )
)
......
......@@ -192,13 +192,18 @@ if (LAPACK_FOUND)
endif ()
# check a function to validate the find
set(CMAKE_REQUIRED_INCLUDES "${TMG_INCLUDE_DIRS};${LAPACK_INCLUDE_DIRS}")
if (TMG_INCLUDE_DIRS)
set(CMAKE_REQUIRED_INCLUDES "${TMG_INCLUDE_DIRS}")
endif()
if (LAPACK_INCLUDE_DIRS)
list(APPEND CMAKE_REQUIRED_INCLUDES "${LAPACK_INCLUDE_DIRS}")
endif()
set(CMAKE_REQUIRED_LIBRARIES "${TMG_LIBRARIES};${LAPACK_LIBRARIES}")
if (TMG_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "-L${TMG_LIBRARY_DIRS}")
if (LAPACK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}")
endif()
endif()
if (LAPACK_LIBRARY_DIRS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -L${LAPACK_LIBRARY_DIRS}")
endif()
if(TMG_LIBRARIES)
......
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