Commit 4ee7b8b5 authored by PRUVOST Florent's avatar PRUVOST Florent

adapt variables to use after morse_cmake update

parent c4c7bda7
......@@ -4,7 +4,7 @@
#
# @copyright 2009-2014 The University of Tennessee and The University of
# Tennessee Research Foundation. All rights reserved.
# @copyright 2012-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
# Univ. Bordeaux. All rights reserved.
#
###
......@@ -259,7 +259,16 @@ set(CHAMELEON_DEP "")
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
if( THREADS_FOUND )
list(APPEND EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
string(REGEX REPLACE "-l" "" THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}")
set(CMAKE_THREAD_LIBS_INIT)
foreach(_lib ${THREAD_LIBS})
find_library(THREADS_${_lib}_LIBRARY NAMES ${_lib}
HINTS ${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES} ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
if (THREADS_${_lib}_LIBRARY)
list(APPEND CMAKE_THREAD_LIBS_INIT ${THREADS_${_lib}_LIBRARY})
endif()
endforeach()
list(APPEND EXTRA_LIBRARIES ${THREADS_${_lib}_LIBRARY})
endif ()
# Add math library to the list of extra
......@@ -303,30 +312,22 @@ if(NOT CHAMELEON_SIMULATION)
# CHAMELEON depends on CBLAS
#---------------------------
find_package(CBLAS COMPONENTS BLASEXT)
if(BLAS_FOUND)
if (BLAS_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${BLAS_LIBRARY_DIRS}")
find_package(CBLAS REQUIRED)
if(CBLAS_FOUND)
if (CBLAS_INCLUDE_DIRS_DEP)
include_directories(${CBLAS_INCLUDE_DIRS_DEP})
endif()
if(BLAS_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if(CBLAS_CFLAGS_OTHER_DEP)
list(APPEND CMAKE_C_FLAGS "${CBLAS_CFLAGS_OTHER_DEP}")
endif()
else()
message(FATAL_ERROR "BLAS library has not been found")
endif()
if(CBLAS_FOUND)
include_directories(${CBLAS_INCLUDE_DIRS})
if(CBLAS_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS}")
if(CBLAS_LDFLAGS_OTHER_DEP)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${CBLAS_LDFLAGS_OTHER_DEP}")
endif()
if (CBLAS_LIBRARIES)
if (CBLAS_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${CBLAS_LIBRARIES_DEP})
else()
list(INSERT CHAMELEON_DEP 0 ${CBLAS_LIBRARIES})
endif()
if(CBLAS_LIBRARY_DIRS_DEP)
list(APPEND CMAKE_INSTALL_RPATH "${CBLAS_LIBRARY_DIRS_DEP}")
endif()
if (CBLAS_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${CBLAS_LIBRARIES_DEP})
endif()
else()
if(MORSE_VERBOSE_FIND_PACKAGE)
......@@ -347,32 +348,22 @@ if(NOT CHAMELEON_SIMULATION)
# CHAMELEON depends on LAPACKE
#-----------------------------
# standalone version of lapacke seems useless for now
# let the comment in case we meet some problems of non existing lapacke
# functions in lapack library such as mkl, acml, ...
#set(LAPACKE_STANDALONE TRUE)
find_package(LAPACKE COMPONENTS LAPACKEXT)
if(LAPACK_FOUND AND LAPACK_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${LAPACK_LIBRARY_DIRS}")
else()
message(FATAL_ERROR "A LAPACK library is required but has not been found")
endif()
find_package(LAPACKE)
if(LAPACKE_FOUND)
include_directories(${LAPACKE_INCLUDE_DIRS})
if(LAPACKE_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS}")
if (LAPACKE_INCLUDE_DIRS_DEP)
include_directories(${LAPACKE_INCLUDE_DIRS_DEP})
endif()
if(LAPACKE_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${LAPACKE_LINKER_FLAGS}")
if(LAPACKE_CFLAGS_OTHER_DEP)
list(APPEND CMAKE_C_FLAGS "${LAPACKE_CFLAGS_OTHER_DEP}")
endif()
if (LAPACKE_LIBRARIES)
if (LAPACKE_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${LAPACKE_LIBRARIES_DEP})
else()
list(INSERT CHAMELEON_DEP 0 ${LAPACKE_LIBRARIES})
endif()
if(LAPACKE_LDFLAGS_OTHER_DEP)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${LAPACKE_LDFLAGS_OTHER_DEP}")
endif()
if(LAPACKE_LIBRARY_DIRS_DEP)
list(APPEND CMAKE_INSTALL_RPATH "${LAPACKE_LIBRARY_DIRS_DEP}")
endif()
if (LAPACKE_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${LAPACKE_LIBRARIES_DEP})
endif()
else()
if(MORSE_VERBOSE_FIND_PACKAGE)
......@@ -395,21 +386,20 @@ if(NOT CHAMELEON_SIMULATION)
#-------------------------
if (CHAMELEON_ENABLE_TESTING OR CHAMELEON_ENABLE_TIMING)
find_package(TMG)
if(TMG_FOUND AND TMG_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${TMG_LIBRARY_DIRS}")
else()
message(FATAL_ERROR "A TMG library is required but has not been found")
if (TMG_INCLUDE_DIRS_DEP)
include_directories(${TMG_INCLUDE_DIRS_DEP})
endif()
if(TMG_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${TMG_LINKER_FLAGS}")
if(TMG_CFLAGS_OTHER_DEP)
list(APPEND CMAKE_C_FLAGS "${TMG_CFLAGS_OTHER_DEP}")
endif()
if (TMG_LIBRARIES)
if (TMG_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${TMG_LIBRARIES_DEP})
else()
list(INSERT CHAMELEON_DEP 0 ${TMG_LIBRARIES})
endif()
if(TMG_LDFLAGS_OTHER_DEP)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${TMG_LDFLAGS_OTHER_DEP}")
endif()
if(TMG_LIBRARY_DIRS_DEP)
list(APPEND CMAKE_INSTALL_RPATH "${TMG_LIBRARY_DIRS_DEP}")
endif()
if (TMG_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${TMG_LIBRARIES_DEP})
endif()
endif()
......@@ -642,19 +632,24 @@ if( CHAMELEON_SCHED_STARPU )
message("-- ${Blue}Add definition CHAMELEON_SCHED_STARPU"
" - Activate StarPU in Chameleon${ColourReset}")
set(CHAMELEON_SCHED_STARPU 1)
include_directories(${STARPU_INCLUDE_DIRS_DEP})
if(STARPU_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARPU_LINKER_FLAGS}")
if (STARPU_INCLUDE_DIRS_DEP)
include_directories(${STARPU_INCLUDE_DIRS_DEP})
set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS_DEP}")
endif()
set(CMAKE_REQUIRED_INCLUDES "${STARPU_INCLUDE_DIRS_DEP}")
foreach(libdir ${STARPU_LIBRARY_DIRS_DEP})
list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
endforeach()
set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
if (CHAMELEON_USE_MPI)
list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")
list(APPEND CMAKE_REQUIRED_FLAGS "${MPI_C_LINK_FLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}")
if(STARPU_CFLAGS_OTHER_DEP)
list(APPEND CMAKE_C_FLAGS "${STARPU_CFLAGS_OTHER_DEP}")
set(CMAKE_REQUIRED_FLAGS "${STARPU_CFLAGS_OTHER_DEP}")
endif()
if(STARPU_LDFLAGS_OTHER_DEP)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${STARPU_LDFLAGS_OTHER_DEP}")
set(CMAKE_REQUIRED_LDFLAGS "${STARPU_LDFLAGS_OTHER_DEP}")
endif()
if(STARPU_LIBRARY_DIRS_DEP)
list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS_DEP}")
endif()
if (STARPU_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${STARPU_LIBRARIES_DEP})
set(CMAKE_REQUIRED_LIBRARIES "${STARPU_LIBRARIES_DEP}")
endif()
if (CHAMELEON_SIMULATION)
list(APPEND CMAKE_REQUIRED_FLAGS "-include" "starpu_simgrid_wrap.h")
......@@ -721,32 +716,6 @@ if( CHAMELEON_SCHED_STARPU )
message("-- ${Blue}Add definition HAVE_STARPU_MPI_COMM_GET_ATTR${ColourReset}")
endif()
endif()
if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}")
endif()
if(FXT_FOUND AND FXT_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${FXT_LIBRARY_DIRS}")
endif()
if(SIMGRID_FOUND AND SIMGRID_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${SIMGRID_LIBRARY_DIRS}")
endif()
if(STARPU_FOUND AND STARPU_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${STARPU_LIBRARY_DIRS}")
endif()
if (STARPU_LIBRARIES)
if (STARPU_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${STARPU_LIBRARIES_DEP})
else()
list(INSERT CHAMELEON_DEP 0 ${STARPU_LIBRARIES})
endif()
endif()
unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
else ( STARPU_FOUND )
if(MORSE_VERBOSE_FIND_PACKAGE)
if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
......@@ -825,46 +794,34 @@ if( CHAMELEON_SCHED_PARSEC )
#if(CHAMELEON_WITH_PROFILING)
# list(APPEND PARSEC_COMPONENT_LIST "PAPI")
#endif()
find_package(PARSEC COMPONENTS ${PARSEC_COMPONENT_LIST})
# Add definition and include_dir if found
if(PARSEC_FOUND)
message("-- ${Blue}Add definition CHAMELEON_SCHED_PARSEC"
" - Activate PaRSEC in Chameleon${ColourReset}")
set(CHAMELEON_SCHED_PARSEC 1)
include_directories(${PARSEC_INCLUDE_DIRS_DEP})
include_directories(${PARSEC_INCLUDE_DIRS}/daguepp)
set(CMAKE_REQUIRED_INCLUDES "${PARSEC_INCLUDE_DIRS_DEP}")
if(PARSEC_LINKER_FLAGS)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${PARSEC_LINKER_FLAGS}")
if (PARSEC_INCLUDE_DIRS_DEP)
include_directories(${PARSEC_INCLUDE_DIRS_DEP})
include_directories(${PARSEC_INCLUDE_DIRS}/daguepp)
endif()
foreach(libdir ${PARSEC_LIBRARY_DIRS_DEP})
list(APPEND CMAKE_REQUIRED_FLAGS "-L${libdir}")
endforeach()
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES "${PARSEC_LIBRARIES_DEP}")
if(HWLOC_FOUND AND HWLOC_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${HWLOC_LIBRARY_DIRS}")
if(PARSEC_CFLAGS_OTHER_DEP)
list(APPEND CMAKE_C_FLAGS "${PARSEC_CFLAGS_OTHER_DEP}")
endif()
if(PARSEC_LDFLAGS_OTHER_DEP)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${PARSEC_LDFLAGS_OTHER_DEP}")
endif()
if(PARSEC_FOUND AND PARSEC_LIBRARY_DIRS_DEP)
# the RPATH to be used when installing
if(PARSEC_LIBRARY_DIRS_DEP)
list(APPEND CMAKE_INSTALL_RPATH "${PARSEC_LIBRARY_DIRS_DEP}")
endif()
if (PARSEC_LIBRARIES)
if (PARSEC_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${PARSEC_LIBRARIES_DEP})
else()
list(INSERT CHAMELEON_DEP 0 ${PARSEC_LIBRARIES})
endif()
if (PARSEC_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${PARSEC_LIBRARIES_DEP})
endif()
unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
# to test if symbols exist, e.g.
# set(CMAKE_REQUIRED_INCLUDES "${PARSEC_INCLUDE_DIRS_DEP}")
# set(CMAKE_REQUIRED_FLAGS "${PARSEC_CFLAGS_OTHER_DEP}")
# set(CMAKE_REQUIRED_LDFLAGS "${PARSEC_LDFLAGS_OTHER_DEP}")
# set(CMAKE_REQUIRED_LIBRARIES "${PARSEC_LIBRARIES_DEP}")
# check_function_exists(parsec_init HAVE_PARSEC_INIT)
else ( PARSEC_FOUND )
if(MORSE_VERBOSE_FIND_PACKAGE)
if(NOT HWLOC_FOUND OR NOT HWLOC_LIBRARIES)
......@@ -913,17 +870,20 @@ if( CHAMELEON_SCHED_QUARK )
message("-- ${Blue}Add definition CHAMELEON_SCHED_QUARK"
" - Activate QUARK in Chameleon${ColourReset}")
set(CHAMELEON_SCHED_QUARK 1)
include_directories(${QUARK_INCLUDE_DIRS})
if(QUARK_LIBRARY_DIRS)
# the RPATH to be used when installing
list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS}")
if (QUARK_INCLUDE_DIRS_DEP)
include_directories(${QUARK_INCLUDE_DIRS_DEP})
endif()
if (QUARK_LIBRARIES)
if (QUARK_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${QUARK_LIBRARIES_DEP})
else()
list(INSERT CHAMELEON_DEP 0 ${QUARK_LIBRARIES})
endif()
if(QUARK_CFLAGS_OTHER_DEP)
list(APPEND CMAKE_C_FLAGS "${QUARK_CFLAGS_OTHER_DEP}")
endif()
if(QUARK_LDFLAGS_OTHER_DEP)
list(APPEND CMAKE_EXE_LINKER_FLAGS "${QUARK_LDFLAGS_OTHER_DEP}")
endif()
if(QUARK_LIBRARY_DIRS_DEP)
list(APPEND CMAKE_INSTALL_RPATH "${QUARK_LIBRARY_DIRS_DEP}")
endif()
if (QUARK_LIBRARIES_DEP)
list(INSERT CHAMELEON_DEP 0 ${QUARK_LIBRARIES_DEP})
endif()
else(QUARK_FOUND)
if(MORSE_VERBOSE_FIND_PACKAGE)
......@@ -965,6 +925,8 @@ cmake_dependent_option(CHAMELEON_USE_CUBLAS_V2
"Enable cublas API v2" ON
"CHAMELEON_USE_CUDA;CHAMELEON_SCHED_STARPU" OFF)
list(REMOVE_DUPLICATES CMAKE_C_FLAGS)
string(REPLACE ";" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
list(REMOVE_DUPLICATES CMAKE_EXE_LINKER_FLAGS)
string(REPLACE ";" " " CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
# Fix a problem on Mac OS X when building shared libraries
......@@ -972,23 +934,12 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
endif()
#------------------------------------------------------------------------------
if(CHAMELEON_SCHED_STARPU)
link_directories(${STARPU_LIBRARY_DIRS_DEP})
elseif(CHAMELEON_SCHED_PARSEC)
link_directories(${PARSEC_LIBRARY_DIRS_DEP})
elseif(CHAMELEON_SCHED_QUARK)
link_directories(${QUARK_LIBRARY_DIRS})
endif()
if(NOT CHAMELEON_SIMULATION)
if(CHAMELEON_USE_CUDA)
link_directories(${CUDA_LIBRARY_DIRS})
endif()
endif()
# Save extra dependencies (all required links)
list(APPEND CHAMELEON_DEP ${EXTRA_LIBRARIES})
list(REMOVE_DUPLICATES CHAMELEON_DEP) # WARNING: is it safe, respect order?
# We remove duplicate dependencies ensuring that redundant libraries are placed last
list(REVERSE CHAMELEON_DEP)
list(REMOVE_DUPLICATES CHAMELEON_DEP)
list(REVERSE CHAMELEON_DEP)
# Check for the subdirectories
# ----------------------------
......
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