Commits (28)
......@@ -11,5 +11,5 @@ Find:
- cd modules/find/tests
- mkdir -p build
- cd build
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DPASTIX_COMPONENTS="PARSEC;STARPU"
- cmake .. -DENABLE_CTEST=ON -DLAPACKE_COMPONENTS="TMG" -DQUARK_COMPONENTS="HWLOC" -DCHAMELEON_COMPONENTS="MPI;FXT;STARPU"
- ctest -V
......@@ -23,18 +23,19 @@ See the file [morse_cmakefind_doc.org](modules/find/morse_cmakefind_doc.org).
Installation
---------------------
We recommend to use this project as a `git submodule` of your project.
# Example if morse_cmake is defined as a git submodule in ./cmake_modules/
git submodule add https://gitlab.inria.fr/solverstack/morse_cmake.git cmake_modules/morse_cmake
To use MORSE modules you have to add the path to the modules in your
CMake project and include the MorseInit module:
# Define where are located module files on your system
set(MORSE_CMAKE_MODULE_PATH "/where/is/morse_cmake" CACHE PATH "Path to morse_cmake sources")
# Append this directory to the list of directories containing CMake modules
list(APPEND CMAKE_MODULE_PATH "${MORSE_CMAKE_MODULE_PATH}/modules/" )
# Example if Morse CMake modules are located in ./cmake_modules/morse_cmake/modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/morse_cmake/modules" )
# Include the init module
include(MorseInit)
We recommend to use this project as a `git submodule` of your project.
Testing
---------------------
......
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file FindPkgconfigLibrariesAbsolutePath.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 06-04-2018
#
###
# Transform relative path into absolute path for libraries found with the
# pkg_search_module cmake macro
# _prefix: the name of the CMake variable used when pkg_search_module was called
# e.g. for pkg_search_module(BLAS blas) _prefix would be BLAS
macro(FIND_PKGCONFIG_LIBRARIES_ABSOLUTE_PATH _prefix)
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
elseif(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# non static case
set(${_prefix}_LIBRARIES_COPY "${${_prefix}_LIBRARIES}")
set(${_prefix}_LIBRARIES "")
foreach(_library ${${_prefix}_LIBRARIES_COPY})
if(EXISTS "${_library}")
list(APPEND ${_prefix}_LIBRARIES ${_library})
else()
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_LIBDIR} ${${_prefix}_LIBRARY_DIRS} ${_lib_env})
if (_library_path)
list(APPEND ${_prefix}_LIBRARIES ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
set (${_prefix}_LIBRARIES "${${_prefix}_LIBRARIES}" CACHE INTERNAL "" FORCE)
# static case
set(${_prefix}_STATIC_LIBRARIES_COPY "${${_prefix}_STATIC_LIBRARIES}")
set(${_prefix}_STATIC_LIBRARIES "")
foreach(_library ${${_prefix}_STATIC_LIBRARIES_COPY})
if(EXISTS "${_library}")
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library})
else()
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
# try static first
set (default_find_library_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
set (CMAKE_FIND_LIBRARY_SUFFIXES ${default_find_library_suffixes})
# if not found try dynamic
if (NOT _library_path)
find_library(_library_path NAMES ${_library}
HINTS ${${_prefix}_STATIC_LIBDIR} ${${_prefix}_STATIC_LIBRARY_DIRS} ${_lib_env})
endif()
if (_library_path)
list(APPEND ${_prefix}_STATIC_LIBRARIES ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
set (${_prefix}_STATIC_LIBRARIES "${${_prefix}_STATIC_LIBRARIES}" CACHE INTERNAL "" FORCE)
endmacro()
##
## @end file FindPkgconfigLibrariesAbsolutePath.cmake
##
###
#
# @copyright (c) 2018 Inria. All rights reserved.
#
###
#
# @file LibrariesAbsolutePath.cmake
#
# @project MORSE
# MORSE is a software package provided by:
# Inria Bordeaux - Sud-Ouest,
# Univ. of Tennessee,
# King Abdullah Univesity of Science and Technology
# Univ. of California Berkeley,
# Univ. of Colorado Denver.
#
# @version 1.0.0
# @author Florent Pruvost
# @date 13-04-2018
#
###
# Transform relative path into absolute path for libraries
# lib_list (input/output): the name of the CMake variable containing libraries, e.g. BLAS_LIBRARIES
# hints_paths (input): additional paths to add when looking for libraries
macro(LIBRARIES_ABSOLUTE_PATH lib_list hints_paths)
# collect environment paths to dig
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
elseif(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
# copy the lib list
set (${lib_list}_COPY "${${lib_list}}")
# reset the lib list to populate
set(${lib_list} "")
foreach(_library ${${lib_list}_COPY})
if(EXISTS "${_library}")
# if already an absolute path, nothing special to do
list(APPEND ${lib_list} ${_library})
else()
# replace pattern -lfoo -> foo
string(REGEX REPLACE "^-l" "" _library "${_library}")
# remove extensions if exist
get_filename_component(_ext "${_library}" EXT)
set(_lib_extensions ".so" ".a" ".dyld" ".dll")
list(FIND _lib_extensions "${_ext}" _index)
if (${_index} GREATER -1)
get_filename_component(_library "${_library}" NAME_WE)
endif()
# try to find the lib
find_library(_library_path NAMES ${_library} HINTS ${hints_paths} ${_lib_env})
if (_library_path)
list(APPEND ${lib_list} ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${lib_list} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endif()
endforeach()
endmacro()
##
## @end file LibrariesAbsolutePath.cmake
##
......@@ -50,6 +50,12 @@ endif()
# To find headers and libs
include(FindHeadersAndLibs)
# To transform relative path from pkg-config into absolute
include(FindPkgconfigLibrariesAbsolutePath)
# To transform relative path into absolute for a list of libraries
include(LibrariesAbsolutePath)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
......
......@@ -233,16 +233,21 @@ MACRO(precisions_rules_py)
# We generate a dependency only if a file will be generated
if( got_file )
set( _compile_flags "-DPRECISION_${_dependency_PREC}" )
set( _listtmp ${PREC_RULE_PRECISIONS})
list(REMOVE_ITEM _listtmp ${_dependency_PREC})
foreach( _prec ${_listtmp})
set( _compile_flags "${_compile_flags} -UPRECISION_${_prec}" )
endforeach()
if( generate_out )
# the custom command is executed in CMAKE_CURRENT_BINARY_DIR
ADD_CUSTOM_COMMAND(
OUTPUT ${_dependency_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E remove -f ${_dependency_OUTPUT} && ${pythoncmd} && chmod a-w ${_dependency_OUTPUT}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_dependency_INPUT} ${RP_CODEGEN} ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY})
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 1 IS_IN_BINARY_DIR 1 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 1 IS_IN_BINARY_DIR 1 )
else( generate_out )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS "-DPRECISION_${_dependency_PREC}" GENERATED 0 )
set_source_files_properties(${_dependency_OUTPUT} PROPERTIES COMPILE_FLAGS ${_compile_flags} GENERATED 0 )
endif( generate_out )
list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT})
......
This diff is collapsed.
......@@ -21,13 +21,11 @@
# BLAS_INCLUDE_DIRS - BLAS include directories
# BLAS_LIBRARY_DIRS - Link directories for BLAS libraries
# BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)
# BLAS_SEQ_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).
# BLAS_SEQ_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLAS_SEQ_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_SEQ_LDFLAGS_OTHER - linker flags without libraries
# BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)
# BLAS_PAR_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers)
# BLAS_PAR_LINKER_FLAGS - uncached list of required linker flags (excluding -l
# and -L)
# BLAS_PAR_CFLAGS_OTHER - compiler flags without headers paths
# BLAS_PAR_LDFLAGS_OTHER - linker flags without libraries
# BLASEXT_FOUND - if a BLAS has been found
# BLASEXT_LIBRARIES - Idem BLAS_LIBRARIES
# BLASEXT_INCLUDE_DIRS - Idem BLAS_INCLUDE_DIRS
......@@ -90,11 +88,9 @@ if(NOT BLASEXT_FIND_QUIETLY)
"\n ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")
endif()
if (NOT BLAS_FOUND)
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas(0)
endif ()
# First blas detection in order to decide if we should look for a
# multitheaded version
find_package_blas(0)
# detect the cases where SEQ and PAR libs are handled
if(BLA_VENDOR STREQUAL "All" AND
......@@ -206,11 +202,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")
if (BLAS_COMPILER_FLAGS)
set (BLAS_SEQ_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
set (BLAS_SEQ_CFLAGS_OTHER "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
set (BLAS_SEQ_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
set (BLAS_SEQ_LDFLAGS_OTHER "${BLAS_LDFLAGS_OTHER}")
endif()
else()
set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")
......@@ -224,11 +220,11 @@ if(BLA_VENDOR MATCHES "Intel*")
find_package_blas(0)
if(BLAS_FOUND)
set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")
if (BLAS_COMPILER_FLAGS)
set (BLAS_PAR_COMPILER_FLAGS "${BLAS_COMPILER_FLAGS}")
if (BLAS_CFLAGS_OTHER)
set (BLAS_PAR_CFLAGS_OTHER "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LINKER_FLAGS)
set (BLAS_PAR_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
if (BLAS_LDFLAGS_OTHER)
set (BLAS_PAR_LDFLAGS_OTHER "${BLAS_LDFLAGS_OTHER}")
endif()
else()
set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")
......@@ -301,15 +297,15 @@ endif()
# Reset pure BLAS cmake variables to the sequential case (arbitrary default)
if(BLAS_SEQ_LIBRARIES)
set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")
set(BLAS_COMPILER_FLAGS "${BLAS_SEQ_COMPILER_FLAGS}")
set(BLAS_LINKER_FLAGS "${BLAS_SEQ_LINKER_FLAGS}")
set(BLAS_CFLAGS_OTHER "${BLAS_SEQ_CFLAGS_OTHER}")
set(BLAS_LDFLAGS_OTHER "${BLAS_SEQ_LDFLAGS_OTHER}")
endif()
# extract libs paths
# remark: because it is not given by find_package(BLAS)
set(BLAS_LIBRARY_DIRS "")
string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")
foreach(blas_lib ${BLAS_LIBRARIES})
# extract libs paths if not given by find_package(BLAS)
if (NOT BLAS_LIBRARY_DIRS)
set(BLAS_LIBRARY_DIRS "")
string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")
foreach(blas_lib ${BLAS_LIBRARIES})
if (EXISTS "${blas_lib}")
get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)
list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )
......@@ -324,10 +320,11 @@ foreach(blas_lib ${BLAS_LIBRARIES})
endif()
endif()
endif()
endforeach()
if (BLAS_LIBRARY_DIRS)
endforeach()
if (BLAS_LIBRARY_DIRS)
list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)
endif ()
endif ()
endif(NOT BLAS_LIBRARY_DIRS)
# check that BLASEXT has been found
# ---------------------------------
......
......@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2016 Inria. All rights reserved.
# @copyright (c) 2012-2018 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
......@@ -21,15 +21,32 @@
# This module finds headers and cblas library.
# Results are reported in variables:
# CBLAS_FOUND - True if headers and requested libraries were found
# CBLAS_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# CBLAS_CFLAGS_OTHER - cblas compiler flags without headers paths
# CBLAS_LDFLAGS_OTHER - cblas linker flags without libraries
# CBLAS_INCLUDE_DIRS - cblas include directories
# CBLAS_LIBRARY_DIRS - Link directories for cblas libraries
# CBLAS_LIBRARIES - cblas component libraries to be linked
# CBLAS_LIBRARY_DIRS - cblas link directories
# CBLAS_LIBRARIES - cblas libraries to be linked (absolute path)
# CBLAS_CFLAGS_OTHER_DEP - cblas + dependencies compiler flags without headers paths
# CBLAS_LDFLAGS_OTHER_DEP - cblas + dependencies linker flags without libraries
# CBLAS_INCLUDE_DIRS_DEP - cblas + dependencies include directories
# CBLAS_LIBRARY_DIRS_DEP - cblas + dependencies link directories
# CBLAS_LIBRARIES_DEP - cblas libraries + dependencies
# CBLAS_LIBRARIES_DEP - cblas + dependencies libraries
# CBLAS_HAS_ZGEMM3M - True if cblas contains zgemm3m fast complex mat-mat product
#
# CBLAS_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = CBLAS
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DCBLAS_DIR=path/to/cblas):
# CBLAS_DIR - Where to find the base directory of cblas
......@@ -59,11 +76,11 @@
#
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2018 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013-2016 Florent Pruvost
# Copyright 2013-2018 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
......@@ -85,12 +102,10 @@ endif()
# CBLAS depends on BLAS anyway, try to find it
if (NOT BLAS_FOUND)
if(CBLAS_FIND_REQUIRED)
find_package(BLASEXT REQUIRED)
else()
find_package(BLASEXT)
endif()
if(CBLAS_FIND_REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLAS)
endif()
......@@ -101,8 +116,9 @@ if (BLAS_FOUND)
# check if a cblas function exists in the BLAS lib
# this can be the case with libs such as MKL, ACML
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LINKER_FLAGS};${BLAS_LIBRARIES}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LDFLAGS_OTHER};${BLAS_LIBRARIES}")
set(CMAKE_REQUIRED_FLAGS "${BLAS_CFLAGS_OTHER}")
set(CMAKE_REQUIRED_INCLUDES "${BLAS_INCLUDE_DIRS}")
unset(CBLAS_WORKS CACHE)
check_function_exists(cblas_dscal CBLAS_WORKS)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
......@@ -122,27 +138,71 @@ if (BLAS_FOUND)
endif()
# test succeeds: CBLAS is in BLAS
set(CBLAS_LIBRARIES "${BLAS_LIBRARIES}")
set(CBLAS_LIBRARIES_DEP "${BLAS_LIBRARIES}")
if (BLAS_LIBRARY_DIRS)
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
endif()
if(BLAS_INCLUDE_DIRS)
set(CBLAS_INCLUDE_DIRS "${BLAS_INCLUDE_DIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${BLAS_INCLUDE_DIRS_DEP}")
endif()
if (BLAS_LINKER_FLAGS)
set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
endif (NOT CBLAS_STANDALONE)
# test fails with blas: try to find CBLAS lib exterior to BLAS
if (CBLAS_STANDALONE OR NOT CBLAS_WORKS)
if(NOT CBLAS_WORKS AND NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test with blas fails")
endif()
# test fails: try to find CBLAS lib exterior to BLAS
# try with pkg-config
set(ENV_CBLAS_DIR "$ENV{CBLAS_DIR}")
set(ENV_CBLAS_INCDIR "$ENV{CBLAS_INCDIR}")
set(ENV_CBLAS_LIBDIR "$ENV{CBLAS_LIBDIR}")
set(CBLAS_GIVEN_BY_USER "FALSE")
if ( CBLAS_DIR OR ( CBLAS_INCDIR AND CBLAS_LIBDIR) OR ENV_CBLAS_DIR OR (ENV_CBLAS_INCDIR AND ENV_CBLAS_LIBDIR) )
set(CBLAS_GIVEN_BY_USER "TRUE")
endif()
include(FindPkgConfig)
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT CBLAS_GIVEN_BY_USER)
if (BLA_STATIC)
set(MKL_STR_BLA_STATIC "static")
else()
set(MKL_STR_BLA_STATIC "dynamic")
endif()
# try different blas
if (BLA_VENDOR STREQUAL "Intel10_64lp")
pkg_search_module(CBLAS mkl-${MKL_STR_BLA_STATIC}-lp64-iomp)
elseif(BLA_VENDOR STREQUAL "Intel10_64lp_seq")
pkg_search_module(CBLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
elseif(BLA_VENDOR STREQUAL "Open")
pkg_search_module(CBLAS openblas)
elseif(BLA_VENDOR STREQUAL "Generic")
pkg_search_module(CBLAS cblas)
else()
pkg_search_module(CBLAS cblas)
pkg_search_module(CBLAS openblas)
pkg_search_module(CBLAS mkl-${MKL_STR_BLA_STATIC}-lp64-seq)
endif()
if (NOT CBLAS_FIND_QUIETLY)
if (CBLAS_FOUND AND CBLAS_LIBRARIES)
message(STATUS "Looking for CBLAS - found using PkgConfig")
else()
message(STATUS "${Magenta}Looking for CBLAS - not found using PkgConfig."
"\n Perhaps you should add the directory containing cblas.pc to"
"\n the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
endif()
if (CBLAS_FOUND AND CBLAS_LIBRARIES)
set(CBLAS_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(CBLAS)
else()
set(CBLAS_FOUND_WITH_PKGCONFIG "FALSE")
endif()
endif()
if (NOT CBLAS_FOUND_WITH_PKGCONFIG OR CBLAS_GIVEN_BY_USER)
# Try to find CBLAS lib
#######################
......@@ -283,11 +343,15 @@ if (BLAS_FOUND)
message(STATUS "Looking for cblas -- lib cblas not found")
endif()
endif ()
endif (NOT CBLAS_FOUND_WITH_PKGCONFIG OR CBLAS_GIVEN_BY_USER)
endif (CBLAS_STANDALONE OR NOT CBLAS_WORKS)
# check a function to validate the find
if(CBLAS_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -296,6 +360,12 @@ if (BLAS_FOUND)
if (CBLAS_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
endif()
if (CBLAS_CFLAGS_OTHER)
set(REQUIRED_FLAGS "${CBLAS_CFLAGS_OTHER}")
endif()
if (CBLAS_LDFLAGS_OTHER)
set(REQUIRED_LDFLAGS "${CBLAS_LDFLAGS_OTHER}")
endif()
if (CBLAS_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
endif()
......@@ -304,21 +374,35 @@ if (BLAS_FOUND)
if (BLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
endif()
if (BLAS_CFLAGS_OTHER)
list(APPEND REQUIRED_FLAGS "${BLAS_CFLAGS_OTHER}")
endif()
if (BLAS_LDFLAGS_OTHER)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LDFLAGS_OTHER}")
endif()
if (BLAS_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${BLAS_LIBRARY_DIRS}")
endif()
list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -341,15 +425,17 @@ if (BLAS_FOUND)
set(CBLAS_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CBLAS_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CBLAS_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CBLAS_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
set(CBLAS_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(CBLAS_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
list(REMOVE_DUPLICATES CBLAS_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES CBLAS_LDFLAGS_OTHER_DEP)
else()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas : test of cblas_dscal with cblas and blas libraries fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
......@@ -358,8 +444,6 @@ if (BLAS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES)
endif(CBLAS_LIBRARIES)
endif (CBLAS_STANDALONE OR NOT CBLAS_WORKS)
else(BLAS_FOUND)
if (NOT CBLAS_FIND_QUIETLY)
......
......@@ -30,21 +30,37 @@
# - STARPU (default): to activate detection of Chameleon linked with StarPU
# - QUARK (STARPU will be deactivated): to activate detection of Chameleon linked with QUARK
# - CUDA (comes with cuBLAS): to activate detection of Chameleon linked with CUDA
# - MAGMA: to activate detection of Chameleon linked with MAGMA
# - MPI: to activate detection of Chameleon linked with MPI
# - FXT: to activate detection of Chameleon linked with StarPU+FXT
#
# This module finds headers and chameleon library.
# Results are reported in variables:
# CHAMELEON_FOUND - True if headers and requested libraries were found
# CHAMELEON_C_FLAGS - list of required compilation flags (excluding -I)
# CHAMELEON_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# CHAMELEON_CFLAGS_OTHER - chameleon compiler flags without headers paths
# CHAMELEON_LDFLAGS_OTHER - chameleon linker flags without libraries
# CHAMELEON_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries
# CHAMELEON_LIBRARY_DIRS - chameleon link directories
# CHAMELEON_LIBRARIES - chameleon libraries to be linked (absolute path)
# CHAMELEON_CFLAGS_OTHER_DEP - chameleon + dependencies compiler flags without headers paths
# CHAMELEON_LDFLAGS_OTHER_DEP - chameleon + dependencies linker flags without libraries
# CHAMELEON_INCLUDE_DIRS_DEP - chameleon + dependencies include directories
# CHAMELEON_LIBRARY_DIRS_DEP - chameleon + dependencies link directories
# CHAMELEON_LIBRARIES_DEP - chameleon libraries + dependencies
# CHAMELEON_LIBRARIES_DEP - chameleon + dependencies libraries
#
# CHAMELEON_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = CHAMELEON
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DCHAMELEON_DIR=path/to/chameleon):
# CHAMELEON_DIR - Where to find the base directory of chameleon
......@@ -82,7 +98,6 @@ endif()
set(CHAMELEON_LOOK_FOR_STARPU ON)
set(CHAMELEON_LOOK_FOR_QUARK OFF)
set(CHAMELEON_LOOK_FOR_CUDA OFF)
set(CHAMELEON_LOOK_FOR_MAGMA OFF)
set(CHAMELEON_LOOK_FOR_MPI OFF)
set(CHAMELEON_LOOK_FOR_FXT OFF)
......@@ -102,10 +117,6 @@ if( CHAMELEON_FIND_COMPONENTS )
# means we look for Chameleon with CUDA
set(CHAMELEON_LOOK_FOR_CUDA ON)
endif()
if (${component} STREQUAL "MAGMA")
# means we look for Chameleon with MAGMA
set(CHAMELEON_LOOK_FOR_MAGMA ON)
endif()
if (${component} STREQUAL "MPI")
# means we look for Chameleon with MPI
set(CHAMELEON_LOOK_FOR_MPI ON)
......@@ -132,6 +143,7 @@ find_package(PkgConfig QUIET)
if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
pkg_search_module(CHAMELEON chameleon)
if (NOT CHAMELEON_FIND_QUIETLY)
if (CHAMELEON_FOUND AND CHAMELEON_LIBRARIES)
message(STATUS "Looking for CHAMELEON - found using PkgConfig")
......@@ -163,13 +175,9 @@ if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
endif()
endif()
set(CHAMELEON_C_FLAGS "${CHAMELEON_CFLAGS_OTHER}")
set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_STATIC_INCLUDE_DIRS}")
set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_STATIC_LIBRARY_DIRS}")
set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_STATIC_LIBRARIES}")
if (CHAMELEON_FOUND AND CHAMELEON_LIBRARIES)
set(CHAMELEON_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(CHAMELEON)
else()
set(CHAMELEON_FOUND_WITH_PKGCONFIG "FALSE")
endif()
......@@ -195,6 +203,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
endif()
set(CHAMELEON_EXTRA_LIBRARIES "")
if( THREADS_FOUND )
libraries_absolute_path(CMAKE_THREAD_LIBS_INIT "")
list(APPEND CHAMELEON_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif ()
......@@ -295,19 +304,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
mark_as_advanced(CUDA_SDK_ROOT_DIR)
mark_as_advanced(CUDA_TOOLKIT_ROOT_DIR)
mark_as_advanced(CUDA_VERBOSE_BUILD)
endif()
endif()
# CHAMELEON may depend on MAGMA gpu kernels
# call our cmake module to test (in cmake_modules)
# change this call position if not appropriated
#-------------------------------------------------
if( CUDA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA )
set(CHAMELEON_MAGMA_VERSION "1.4" CACHE STRING "oldest MAGMA version desired")
if (CHAMELEON_FIND_REQUIRED AND CHAMELEON_FIND_REQUIRED_MAGMA)
find_package(MAGMA ${CHAMELEON_MAGMA_VERSION} REQUIRED)
else()
find_package(MAGMA ${CHAMELEON_MAGMA_VERSION})
libraries_absolute_path(CUDA_LIBRARIES "$ENV{CUDA_ROOT}/lib64")
endif()
endif()
......@@ -486,6 +483,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
list(APPEND CHAMELEON_libs_to_find "chameleon_quark")
endif()
list(APPEND CHAMELEON_libs_to_find "coreblas")
if (CHAMELEON_LOOK_FOR_CUDA)
list(APPEND CHAMELEON_libs_to_find "cudablas")
endif()
# call cmake macro to find the lib path
if(CHAMELEON_LIBDIR)
......@@ -534,11 +534,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
endforeach(chameleon_lib ${CHAMELEON_libs_to_find})
# check a function to validate the find
if(CHAMELEON_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_GIVEN_BY_USER) )
# check a function to validate the find
if(CHAMELEON_LIBRARIES)
set(REQUIRED_LDFLAGS)
set(REQUIRED_INCDIRS)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
set(REQUIRED_LIBDIRS)
set(REQUIRED_LIBS)
......@@ -546,6 +549,12 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
if (CHAMELEON_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${CHAMELEON_INCLUDE_DIRS}")
endif()
if (CHAMELEON_CFLAGS_OTHER)
list(APPEND REQUIRED_FLAGS "${CHAMELEON_CFLAGS_OTHER}")
endif()
if (CHAMELEON_LDFLAGS_OTHER)
list(APPEND REQUIRED_LDFLAGS "${CHAMELEON_LDFLAGS_OTHER}")
endif()
foreach(libdir ${CHAMELEON_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
......@@ -556,42 +565,36 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
if (STARPU_FOUND AND CHAMELEON_LOOK_FOR_STARPU)
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_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${STARPU_CFLAGS_OTHER_DEP}")
endif()
if (STARPU_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${STARPU_LDFLAGS_OTHER_DEP}")
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()
endif()
# QUARK
if (QUARK_FOUND AND CHAMELEON_LOOK_FOR_QUARK)
if (QUARK_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS_DEP}")
elseif(QUARK_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${QUARK_INCLUDE_DIRS}")
endif()
if (QUARK_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${QUARK_CFLAGS_OTHER_DEP}")
endif()
if (QUARK_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${QUARK_LDFLAGS_OTHER_DEP}")
endif()
if(QUARK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS_DEP}")
elseif(QUARK_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${QUARK_LIBRARY_DIRS}")
endif()
if (QUARK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBS "${QUARK_LIBRARIES_DEP}")
elseif (QUARK_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBS "${QUARK_LIBRARIES}")
endif()
endif()
# CUDA
......@@ -606,30 +609,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
endforeach()
list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")
endif()
# MAGMA
if (MAGMA_FOUND AND CHAMELEON_LOOK_FOR_MAGMA)
if (MAGMA_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS_DEP}")
elseif(MAGMA_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${MAGMA_INCLUDE_DIRS}")
endif()
if (MAGMA_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS_DEP}")
elseif(MAGMA_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${MAGMA_LIBRARY_DIRS}")
endif()
if (MAGMA_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${MAGMA_LIBRARIES_DEP}")
elseif(MAGMA_LIBRARIES)
foreach(lib ${MAGMA_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
endif()
endforeach()
endif()
endif()
# MPI
if (MPI_FOUND AND CHAMELEON_LOOK_FOR_MPI)
if (MPI_C_INCLUDE_PATH)
......@@ -648,80 +627,69 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
if (HWLOC_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")
endif()
foreach(libdir ${HWLOC_LIBRARY_DIRS})
if (libdir)
list(APPEND REQUIRED_LIBDIRS "${libdir}")
if (HWLOC_CFLAGS_OTHER)
list(APPEND REQUIRED_FLAGS "${HWLOC_CFLAGS_OTHER}")
endif()
endforeach()
foreach(lib ${HWLOC_LIBRARIES})
if (EXISTS ${lib} OR ${lib} MATCHES "^-")
list(APPEND REQUIRED_LIBS "${lib}")
else()
list(APPEND REQUIRED_LIBS "-l${lib}")
if (HWLOC_LDFLAGS_OTHER)
list(APPEND REQUIRED_LDFLAGS "${HWLOC_LDFLAGS_OTHER}")
endif()
endforeach()
if (HWLOC_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}")
endif()
list(APPEND REQUIRED_LIBS "${HWLOC_LIBRARIES}")
endif()
# TMG
if (TMG_FOUND)
if (TMG_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS_DEP}")
elseif (TMG_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${TMG_INCLUDE_DIRS}")
endif()
if (TMG_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${TMG_CFLAGS_OTHER_DEP}")
endif()
if (TMG_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${TMG_LDFLAGS_OTHER_DEP}")
endif()
if(TMG_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS_DEP}")
elseif(TMG_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${TMG_LIBRARY_DIRS}")
endif()
if (TMG_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES_DEP}")
elseif(TMG_LIBRARIES)
list(APPEND REQUIRED_LIBS "${TMG_LIBRARIES}")
endif()
if (TMG_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${TMG_LINKER_FLAGS}")
endif()
endif()
# LAPACKE
if (LAPACKE_FOUND)
if (LAPACKE_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS_DEP}")
elseif (LAPACKE_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${LAPACKE_INCLUDE_DIRS}")
endif()
if (LAPACKE_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${LAPACKE_CFLAGS_OTHER_DEP}")
endif()
if (LAPACKE_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${LAPACKE_LDFLAGS_OTHER_DEP}")
endif()
if(LAPACKE_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS_DEP}")
elseif(LAPACKE_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${LAPACKE_LIBRARY_DIRS}")
endif()
if (LAPACKE_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES_DEP}")
elseif(LAPACKE_LIBRARIES)
list(APPEND REQUIRED_LIBS "${LAPACKE_LIBRARIES}")
endif()
if (LAPACK_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${LAPACK_LINKER_FLAGS}")
endif()
endif()
# CBLAS
if (CBLAS_FOUND)
if (CBLAS_INCLUDE_DIRS_DEP)
list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS_DEP}")
elseif (CBLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
endif()
if (CBLAS_CFLAGS_OTHER_DEP)
list(APPEND REQUIRED_FLAGS "${CBLAS_CFLAGS_OTHER_DEP}")
endif()
if (CBLAS_LDFLAGS_OTHER_DEP)
list(APPEND REQUIRED_LDFLAGS "${CBLAS_LDFLAGS_OTHER_DEP}")
endif()
if(CBLAS_LIBRARY_DIRS_DEP)
list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS_DEP}")
elseif(CBLAS_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
endif()
if (CBLAS_LIBRARIES_DEP)
list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES_DEP}")
elseif(CBLAS_LIBRARIES)
list(APPEND REQUIRED_LIBS "${CBLAS_LIBRARIES}")
endif()
if (BLAS_LINKER_FLAGS)
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
# EXTRA LIBS such that pthread, m, rt
......@@ -729,11 +697,22 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -748,27 +727,27 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUN
set(CHAMELEON_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(CHAMELEON_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(CHAMELEON_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(CHAMELEON_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
set(CHAMELEON_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(CHAMELEON_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES CHAMELEON_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CHAMELEON_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CHAMELEON_LINKER_FLAGS)
list(REMOVE_DUPLICATES CHAMELEON_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES CHAMELEON_LDFLAGS_OTHER_DEP)
else()
if(NOT CHAMELEON_FIND_QUIETLY)
message(STATUS "Looking for chameleon : test of MORSE_Init fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
message(STATUS "Maybe CHAMELEON is linked with specific libraries. "
"Have you tried with COMPONENTS (STARPU/QUARK, CUDA, MAGMA, MPI, FXT)? "
"Have you tried with COMPONENTS (STARPU/QUARK, CUDA, MPI, FXT)? "
"See the explanation in FindCHAMELEON.cmake.")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(CHAMELEON_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_FOUND) OR (CHAMELEON_GIVEN_BY_USER) )
endif(CHAMELEON_LIBRARIES)
if (CHAMELEON_LIBRARIES)
if (CHAMELEON_LIBRARY_DIRS)
......@@ -795,11 +774,6 @@ mark_as_advanced(CHAMELEON_DIR_FOUND)
# check that CHAMELEON has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
if (PKG_CONFIG_EXECUTABLE AND CHAMELEON_FOUND)
find_package_handle_standard_args(CHAMELEON DEFAULT_MSG
CHAMELEON_LIBRARIES)
else()
find_package_handle_standard_args(CHAMELEON DEFAULT_MSG
find_package_handle_standard_args(CHAMELEON DEFAULT_MSG
CHAMELEON_LIBRARIES
CHAMELEON_WORKS)
endif()
......@@ -20,11 +20,23 @@
# This module finds headers and eztrace library.
# Results are reported in variables:
# EZTRACE_FOUND - True if headers and requested libraries were found
# EZTRACE_C_FLAGS - list of required compilation flags (excluding -I)
# EZTRACE_INCLUDE_DIRS - eztrace include directories
# EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries
# EZTRACE_LIBRARIES - eztrace component libraries to be linked
#
# EZTRACE_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = EZTRACE
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DEZTRACE_DIR=path/to/eztrace):
......@@ -73,14 +85,10 @@ find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
pkg_search_module(EZTRACE eztrace)
if (NOT EZTRACE_FIND_QUIETLY)
if (EZTRACE_FOUND AND EZTRACE_LIBRARIES)
message(STATUS "Looking for EZTRACE - found using PkgConfig")
#if(NOT EZTRACE_INCLUDE_DIRS)
# message("${Magenta}EZTRACE_INCLUDE_DIRS is empty using PkgConfig."
# "Perhaps the path to eztrace headers is already present in your"
# "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")
#endif()
else()
message(STATUS "${Magenta}Looking for EZTRACE - not found using PkgConfig."
"\n Perhaps you should add the directory containing eztrace.pc to"
......@@ -88,13 +96,12 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
endif()
if (EZTRACE_FOUND AND EZTRACE_LIBRARIES)
set(EZTRACE_FOUND_WITH_PKGCONFIG "TRUE")
find_pkgconfig_libraries_absolute_path(EZTRACE)
else()
set(EZTRACE_FOUND_WITH_PKGCONFIG "FALSE")
endif()
endif()
set(EZTRACE_C_FLAGS "${EZTRACE_CFLAGS_OTHER}")
endif( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
......@@ -288,8 +295,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
list(REMOVE_DUPLICATES EZTRACE_LIBRARY_DIRS)
endif ()
# check a function to validate the find
if(EZTRACE_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
# check a function to validate the find
if(EZTRACE_LIBRARIES)
set(REQUIRED_INCDIRS)
set(REQUIRED_LIBDIRS)
......@@ -299,6 +308,12 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
if (EZTRACE_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${EZTRACE_INCLUDE_DIRS}")
endif()
if (EZTRACE_CFLAGS_OTHER)
set(REQUIRED_FLAGS "${EZTRACE_CFLAGS_OTHER}")
endif()
if (EZTRACE_LDFLAGS_OTHER)
set(REQUIRED_LDFLAGS "${EZTRACE_LDFLAGS_OTHER}")
endif()
if (EZTRACE_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${EZTRACE_LIBRARY_DIRS}")
endif()
......@@ -306,10 +321,22 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
set(CMAKE_REQUIRED_LIBRARIES)
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -324,15 +351,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
message(STATUS "Looking for eztrace : test of eztrace_topology_init with eztrace library fails")
message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "CMAKE_REQUIRED_FLAGS: ${CMAKE_REQUIRED_FLAGS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(EZTRACE_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) OR (EZTRACE_GIVEN_BY_USER) )
endif(EZTRACE_LIBRARIES)
if (EZTRACE_LIBRARIES)
if (EZTRACE_LIBRARY_DIRS)
......@@ -355,11 +381,6 @@ mark_as_advanced(EZTRACE_DIR_FOUND)
# check that EZTRACE has been found
# -------------------------------
include(FindPackageHandleStandardArgs)
if (PKG_CONFIG_EXECUTABLE AND EZTRACE_FOUND)
find_package_handle_standard_args(EZTRACE DEFAULT_MSG
EZTRACE_LIBRARIES)
else()
find_package_handle_standard_args(EZTRACE DEFAULT_MSG
find_package_handle_standard_args(EZTRACE DEFAULT_MSG
EZTRACE_LIBRARIES
EZTRACE_WORKS)
endif()
This diff is collapsed.
......@@ -28,15 +28,30 @@
# This module finds headers and fftw library.
# Results are reported in variables:
# FFTW_FOUND - True if headers and requested libraries were found
# FFTW_C_FLAGS - list of required compilation flags (excluding -I)
# FFTW_LINKER_FLAGS - list of required linker flags (excluding -l and -L)
# FFTW_CFLAGS_OTHER - fftw compiler flags without headers paths
# FFTW_LDFLAGS_OTHER - fftw linker flags without libraries
# FFTW_INCLUDE_DIRS - fftw include directories
# FFTW_LIBRARY_DIRS - Link directories for fftw libraries
# FFTW_LIBRARIES - fftw component libraries to be linked
# FFTW_LIBRARY_DIRS - fftw link directories
# FFTW_LIBRARIES - fftw libraries to be linked (absolute path)
# FFTW_CFLAGS_OTHER_DEP - fftw + dependencies compiler flags without headers paths
# FFTW_LDFLAGS_OTHER_DEP - fftw + dependencies linker flags without libraries
# FFTW_INCLUDE_DIRS_DEP - fftw + dependencies include directories
# FFTW_LIBRARY_DIRS_DEP - fftw + dependencies link directories
# FFTW_LIBRARIES_DEP - fftw libraries + dependencies
# FFTW_LIBRARIES_DEP - fftw + dependencies libraries
#
# FFTW_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# if found with pkg-config the following variables are set
# <PREFIX> = FFTW3F or FFTW3 or FFTW3L or FFTW3Q
# <XPREFIX> = <PREFIX> for common case
# <XPREFIX> = <PREFIX>_STATIC for static linking
# <XPREFIX>_FOUND ... set to 1 if module(s) exist
# <XPREFIX>_LIBRARIES ... only the libraries (w/o the '-l')
# <XPREFIX>_LIBRARY_DIRS ... the paths of the libraries (w/o the '-L')
# <XPREFIX>_LDFLAGS ... all required linker flags
# <XPREFIX>_LDFLAGS_OTHER ... all other linker flags
# <XPREFIX>_INCLUDE_DIRS ... the '-I' preprocessor flags (w/o the '-I')
# <XPREFIX>_CFLAGS ... all required cflags
# <XPREFIX>_CFLAGS_OTHER ... the other compiler flags
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DFFTW_DIR=path/to/fftw):
......@@ -184,10 +199,10 @@ if (FFTW_LOOK_FOR_MKL)
endif()
if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_MKL)
find_package(Threads REQUIRED)
find_package(BLASEXT REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(Threads)
find_package(BLASEXT)
find_package(BLAS)
endif()
endif()
......@@ -201,12 +216,17 @@ if (FFTW_LOOK_FOR_ESSL)
set(BLA_VENDOR "IBMESSL")
endif()
if (FFTW_FIND_REQUIRED AND FFTW_FIND_REQUIRED_ESSL)
find_package(BLASEXT REQUIRED)
find_package(BLAS REQUIRED)
else()
find_package(BLASEXT)
find_package(BLAS)
endif()
endif()
if( THREADS_FOUND )
libraries_absolute_path(CMAKE_THREAD_LIBS_INIT "")
endif ()
set(ENV_FFTW_DIR "$ENV{FFTW_DIR}")
set(ENV_FFTW_INCDIR "$ENV{FFTW_INCDIR}")
set(ENV_FFTW_LIBDIR "$ENV{FFTW_LIBDIR}")
......@@ -231,11 +251,11 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3F fftw3f)
pkg_search_module(FFTW3 fftw3)
if (FFTW3F_FOUND)
set(FFTW_C_FLAGS "${FFTW3F_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3F - found using PkgConfig")
endif()
if (FFTW3F_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3F)
list(APPEND FFTW_LIBRARIES "${FFTW3F_LIBRARIES}")
endif()
if(FFTW3F_INCLUDE_DIRS)
......@@ -261,11 +281,11 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3L fftw3l)
pkg_search_module(FFTW3 fftw3)
if (FFTW3L_FOUND)
set(FFTW_C_FLAGS "${FFTW3L_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3L - found using PkgConfig")
endif()
if (FFTW3L_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3L)
list(APPEND FFTW_LIBRARIES "${FFTW3L_LIBRARIES}")
endif()
if(FFTW3L_INCLUDE_DIRS)
......@@ -291,11 +311,11 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
pkg_search_module(FFTW3Q fftw3q)
pkg_search_module(FFTW3 fftw3)
if (FFTW3Q_FOUND)
set(FFTW_C_FLAGS "${FFTW3Q_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3Q - found using PkgConfig")
endif()
if (FFTW3Q_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3Q)
list(APPEND FFTW_LIBRARIES "${FFTW3Q_LIBRARIES}")
endif()
if(FFTW3Q_INCLUDE_DIRS)
......@@ -319,13 +339,16 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
endif(FFTW3Q_FOUND)
else()
pkg_search_module(FFTW3 fftw3)
if (FFTW3_FOUND AND FFTW3_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3)
endif()
endif()
if (FFTW3_FOUND)
set(FFTW_C_FLAGS "${FFTW3_CFLAGS_OTHER}")
if (NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW3 - found using PkgConfig")
endif()
if (FFTW3_LIBRARIES)
find_pkgconfig_libraries_absolute_path(FFTW3)
list(APPEND FFTW_LIBRARIES "${FFTW3_LIBRARIES}")
endif()
if(FFTW3_INCLUDE_DIRS)
......@@ -348,14 +371,6 @@ if (NOT FFTW_LOOK_FOR_MKL AND NOT FFTW_LOOK_FOR_ESSL)
endif()
endif(FFTW3_FOUND)
set(FFTW_INCLUDE_DIRS_DEP "${FFTW_STATIC_INCLUDE_DIRS}")
set(FFTW_LIBRARY_DIRS_DEP "${FFTW_STATIC_LIBRARY_DIRS}")
set(FFTW_LIBRARIES_DEP "${FFTW_STATIC_LIBRARIES}" )
if (FFTW_LIBRARIES)
set(FFTW_WORKS TRUE)
endif()
if (FFTW_FOUND AND FFTW_LIBRARIES)
set(FFTW_FOUND_WITH_PKGCONFIG "TRUE")
else()
......@@ -688,8 +703,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
endif()
endforeach()
# check a function to validate the find
if(FFTW_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR
(PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR
FFTW_GIVEN_BY_USER OR
FFTW_LOOK_FOR_MKL OR
FFTW_LOOK_FOR_ESSL
)
# check a function to validate the find
if(FFTW_LIBRARIES)
set(REQUIRED_FLAGS)
set(REQUIRED_LDFLAGS)
......@@ -701,6 +723,12 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
if (FFTW_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${FFTW_INCLUDE_DIRS}")
endif()
if (FFTW_CFLAGS_OTHER)
set(REQUIRED_FLAGS "${FFTW_CFLAGS_OTHER}")
endif()
if (FFTW_LDFLAGS_OTHER)
set(REQUIRED_LDFLAGS "${FFTW_LDFLAGS_OTHER}")
endif()
if (FFTW_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${FFTW_LIBRARY_DIRS}")
endif()
......@@ -712,14 +740,6 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
# OMP
if(FFTW_LOOK_FOR_OMP)
list(APPEND REQUIRED_FLAGS "${OPENMP_C_FLAGS}")
#if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
# # either gomp ...
# list(APPEND REQUIRED_LIBS "-lgomp")
# # or iomp5
# list(APPEND REQUIRED_LIBS "-liomp5")
#elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel")
# list(APPEND REQUIRED_LIBS "-liomp5")
#endif()
endif()
# MKL
if(FFTW_LOOK_FOR_MKL)
......@@ -737,11 +757,22 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
# set required libraries for link
set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")
if (REQUIRED_FLAGS)
set(REQUIRED_FLAGS_COPY "${REQUIRED_FLAGS}")
set(REQUIRED_FLAGS)
set(REQUIRED_DEFINITIONS)
foreach(_flag ${REQUIRED_FLAGS_COPY})
if (_flag MATCHES "^-D")
list(APPEND REQUIRED_DEFINITIONS "${_flag}")
endif()
string(REGEX REPLACE "^-D.*" "" _flag "${_flag}")
list(APPEND REQUIRED_FLAGS "${_flag}")
endforeach()
endif()
set(CMAKE_REQUIRED_DEFINITIONS "${REQUIRED_DEFINITIONS}")
set(CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
endforeach()
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")
list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")
string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
......@@ -761,11 +792,11 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
set(FFTW_LIBRARIES_DEP "${REQUIRED_LIBS}")
set(FFTW_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")
set(FFTW_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")
set(FFTW_C_FLAGS "${REQUIRED_FLAGS}")
set(FFTW_LINKER_FLAGS "${REQUIRED_LDFLAGS}")
set(FFTW_CFLAGS_OTHER_DEP "${REQUIRED_FLAGS}")
set(FFTW_LDFLAGS_OTHER_DEP "${REQUIRED_LDFLAGS}")
list(REMOVE_DUPLICATES FFTW_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES FFTW_LINKER_FLAGS)
list(REMOVE_DUPLICATES FFTW_CFLAGS_OTHER_DEP)
list(REMOVE_DUPLICATES FFTW_LDFLAGS_OTHER_DEP)
else()
if(NOT FFTW_FIND_QUIETLY)
message(STATUS "Looking for FFTW : test of ${FFTW_PREC_TESTFUNC}fftw_execute_ with fftw library fails")
......@@ -778,14 +809,7 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
set(CMAKE_REQUIRED_LIBRARIES)
endif(FFTW_LIBRARIES)
endif( (NOT PKG_CONFIG_EXECUTABLE) OR
(PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR
FFTW_GIVEN_BY_USER OR
FFTW_LOOK_FOR_MKL OR
FFTW_LOOK_FOR_ESSL
)
endif(FFTW_LIBRARIES)
if (FFTW_LIBRARIES)
list(GET FFTW_LIBRARIES 0 first_lib)
......@@ -806,13 +830,6 @@ mark_as_advanced(FFTW_DIR_FOUND)
# check that FFTW has been found
# -------------------------------
include(FindPackageHandleStandardArgs)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FFTW_FOUND) OR (FFTW_GIVEN_BY_USER) )
find_package_handle_standard_args(FFTW DEFAULT_MSG
find_package_handle_standard_args(FFTW DEFAULT_MSG
FFTW_LIBRARIES
FFTW_INCLUDE_DIRS