diff --git a/cmake_modules/morse/find/FindCBLAS.cmake b/cmake_modules/morse/find/FindCBLAS.cmake index 8e620e0eee31efada1cc7726694a1ac7045749ba..748651359cc2c22c48ac5cd9d0172643b0081d35 100644 --- a/cmake_modules/morse/find/FindCBLAS.cmake +++ b/cmake_modules/morse/find/FindCBLAS.cmake @@ -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) diff --git a/cmake_modules/morse/find/FindCHAMELEON.cmake b/cmake_modules/morse/find/FindCHAMELEON.cmake index d4995a23806a3c42a2df47d3192bd9a82766ea38..c4bab85f0b4993ec266bd3128969edd8918d22cb 100644 --- a/cmake_modules/morse/find/FindCHAMELEON.cmake +++ b/cmake_modules/morse/find/FindCHAMELEON.cmake @@ -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) diff --git a/cmake_modules/morse/find/FindFXT.cmake b/cmake_modules/morse/find/FindFXT.cmake index abe0f2bf0dfe362ceff10412c0f483f3a20322cd..3bd1f86e751915db4337a8f2928a4f10bc815bd9 100644 --- a/cmake_modules/morse/find/FindFXT.cmake +++ b/cmake_modules/morse/find/FindFXT.cmake @@ -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}") diff --git a/cmake_modules/morse/find/FindHWLOC.cmake b/cmake_modules/morse/find/FindHWLOC.cmake index 04b2a9aa051b2c1073e28426a5fa8ba60767c534..7038e1ca7de3db5b937bdcb5d94a0429df58cd55 100644 --- a/cmake_modules/morse/find/FindHWLOC.cmake +++ b/cmake_modules/morse/find/FindHWLOC.cmake @@ -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}") diff --git a/cmake_modules/morse/find/FindLAPACKE.cmake b/cmake_modules/morse/find/FindLAPACKE.cmake index 533a1d3496e2b93dfc545152cd1cd71113af724a..fe79fc8f0c3d62c0e8f0fcb45106dc1702afc08d 100644 --- a/cmake_modules/morse/find/FindLAPACKE.cmake +++ b/cmake_modules/morse/find/FindLAPACKE.cmake @@ -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) diff --git a/cmake_modules/morse/find/FindMAGMA.cmake b/cmake_modules/morse/find/FindMAGMA.cmake index 721855d924a4141d399b7ac37c42b167b1506131..2ea5d48a8bed0adaecef0f07df814c9e63883379 100644 --- a/cmake_modules/morse/find/FindMAGMA.cmake +++ b/cmake_modules/morse/find/FindMAGMA.cmake @@ -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) diff --git a/cmake_modules/morse/find/FindMETIS.cmake b/cmake_modules/morse/find/FindMETIS.cmake index e62bac7c96b57d8253fbe5f813f29011f44f3be5..bee2f57530907c504da8820a4f2741892e8b1448 100644 --- a/cmake_modules/morse/find/FindMETIS.cmake +++ b/cmake_modules/morse/find/FindMETIS.cmake @@ -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}") diff --git a/cmake_modules/morse/find/FindPARMETIS.cmake b/cmake_modules/morse/find/FindPARMETIS.cmake index 15407aeadaee8caab95eb76a521fd1906221520a..f599725ce757604b63103d02b52037b626d2b1bd 100644 --- a/cmake_modules/morse/find/FindPARMETIS.cmake +++ b/cmake_modules/morse/find/FindPARMETIS.cmake @@ -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}") diff --git a/cmake_modules/morse/find/FindPTSCOTCH.cmake b/cmake_modules/morse/find/FindPTSCOTCH.cmake index a5f0d9fecd4a0150d957b932c49e662447da9da5..f8dca7c96ecca90ee4d9161f39ba1b8f7d31863f 100644 --- a/cmake_modules/morse/find/FindPTSCOTCH.cmake +++ b/cmake_modules/morse/find/FindPTSCOTCH.cmake @@ -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() diff --git a/cmake_modules/morse/find/FindQUARK.cmake b/cmake_modules/morse/find/FindQUARK.cmake index c96b4ddd079a269133a07cf646e6ebeecab22c5f..59757448e209e7d7bae5902a197165cd1a5a825e 100644 --- a/cmake_modules/morse/find/FindQUARK.cmake +++ b/cmake_modules/morse/find/FindQUARK.cmake @@ -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}") diff --git a/cmake_modules/morse/find/FindSCOTCH.cmake b/cmake_modules/morse/find/FindSCOTCH.cmake index 1726e4db970f1fdeddb77eaacdedbc2d1f6d92c4..0fdee25dd5482cbe2854d944621e285bcfef64e9 100644 --- a/cmake_modules/morse/find/FindSCOTCH.cmake +++ b/cmake_modules/morse/find/FindSCOTCH.cmake @@ -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}") diff --git a/cmake_modules/morse/find/FindSTARPU.cmake b/cmake_modules/morse/find/FindSTARPU.cmake index d5319fa41cf18404bc40cbed9a5a8431c6671f29..1aadecbe1d07ad089f2f5527b7ad98cb12d07bc8 100644 --- a/cmake_modules/morse/find/FindSTARPU.cmake +++ b/cmake_modules/morse/find/FindSTARPU.cmake @@ -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) ) ) diff --git a/cmake_modules/morse/find/FindTMG.cmake b/cmake_modules/morse/find/FindTMG.cmake index eaea7816b9c8d2db524d74505c0ae8100d27e52b..3b3f532d23763bec62ddb8aca2733a9ea53d6507 100644 --- a/cmake_modules/morse/find/FindTMG.cmake +++ b/cmake_modules/morse/find/FindTMG.cmake @@ -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)