Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 9e7d5c40 authored by ESTERIE Pierre's avatar ESTERIE Pierre
Browse files

almost there with new cmake

parent 44337ea4
......@@ -2,41 +2,41 @@
# Blas options
# ------------
if(${CMAKE_PROJECT_NAME}_USE_BLAS)
if(NOT BLAS_FOUND OR NOT CBLAS_FOUND)
if( ${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS )
if( ${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS )
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS CBLAS)
list(APPEND FUSE_LIST BLAS CBLAS)
elseif()
message(ERROR "CBLAS and BLAS required for uniform interpolator.")
endif()
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS CBLAS)
list(APPEND FUSE_LIST BLAS CBLAS)
elseif()
message(ERROR "CBLAS and BLAS required for uniform interpolator.")
endif()
else()
else()
find_package(CBLAS REQUIRED)
if(CBLAS_FOUND)
list(APPEND CBLAS_TARGET MORSE::CBLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES CBLAS)
list(APPEND FUSE_LIST CBLAS)
elseif()
message(ERROR "CBLAS required for uniform interpolator.")
endif()
find_package(CBLAS REQUIRED)
if(CBLAS_FOUND)
list(APPEND CBLAS_TARGET MORSE::CBLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES CBLAS)
list(APPEND FUSE_LIST CBLAS)
elseif()
message(ERROR "CBLAS required for uniform interpolator.")
endif()
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
elseif()
message(ERROR "BLAS required for chebyshev interpolator.")
endif()
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
elseif()
message(ERROR "BLAS required for chebyshev interpolator.")
endif()
endif()
endif(NOT BLAS_FOUND OR NOT CBLAS_FOUND)
endif(${CMAKE_PROJECT_NAME}_USE_BLAS)
#message (STATUS "Check BLAS Fortran mangling")
......
#
# FFT options
# -----------
include(CMakeDependentOption)
if(${CMAKE_PROJECT_NAME}_USE_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW Configure:")
if(NOT FFTW_FOUND)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW Configure:")
# The package find_package(FFTW) can be used with the following COMPONENTS:
# MKL, ESSL, THREADS|OMP and/or SIMPLE|LONG|QUAD
# Default will find the real double precision fftw library version without THREADS|OMP
if(${CMAKE_PROJECT_NAME}_USE_MKL_AS_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from MKL")
find_package(FFTW REQUIRED COMPONENTS MKL)
elseif (${CMAKE_PROJECT_NAME}_USE_ESSL_AS_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from ESSL")
find_package(FFTW REQUIRED COMPONENTS ESSL)
else()
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW")
find_package(FFTW REQUIRED COMPONENTS SIMPLE LONG)
endif()
if(FFTW_FOUND)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES FFTW)
list(APPEND FUSE_LIST FFTW)
list(APPEND FFTW_TARGET MORSE::FFTW)
else(FFTW_FOUND)
message(WARNING "FFTW has not been found, ${CMAKE_PROJECT_NAME} will continue to compile but some applications will be disabled.")
message(WARNING "If you have FFTW set FFTW_LIBDIR, FFTW_INCDIR or FFTW_DIR (CMake variables using -D or environment variables).")
set(${CMAKE_PROJECT_NAME}_USE_FFT OFF)
endif(FFTW_FOUND)
# The package find_package(FFTW) can be used with the following COMPONENTS:
# MKL, ESSL, THREADS|OMP and/or SIMPLE|LONG|QUAD
# Default will find the real double precision fftw library version without THREADS|OMP
if(${CMAKE_PROJECT_NAME}_USE_MKL_AS_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from MKL")
find_package(FFTW REQUIRED COMPONENTS MKL)
elseif (${CMAKE_PROJECT_NAME}_USE_ESSL_AS_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from ESSL")
find_package(FFTW REQUIRED COMPONENTS ESSL)
else()
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW")
find_package(FFTW REQUIRED COMPONENTS SIMPLE LONG)
endif()
if(FFTW_FOUND)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES FFTW)
list(APPEND FUSE_LIST FFTW)
list(APPEND FFTW_TARGET MORSE::FFTW)
else(FFTW_FOUND)
message(WARNING "FFTW has not been found, ${CMAKE_PROJECT_NAME} will continue to compile but some applications will be disabled.")
message(WARNING "If you have FFTW set FFTW_LIBDIR, FFTW_INCDIR or FFTW_DIR (CMake variables using -D or environment variables).")
set(${CMAKE_PROJECT_NAME}_USE_FFT OFF)
endif(FFTW_FOUND)
endif(NOT FFTW_FOUND)
endif(${CMAKE_PROJECT_NAME}_USE_FFTW)
......@@ -13,6 +13,9 @@ install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/include
DESTINATION ${CMAKE_INSTALL_PREFIX}
PATTERN "scalfmm-config.hpp.cmake" EXCLUDE)
install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/cmake/morse/
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME})
install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/modules/internal/inria_tools/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
......@@ -32,33 +35,23 @@ install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/modules/internal/xtensor-f
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(EXPORT ${CMAKE_PROJECT_NAME}-targets
FILE ${CMAKE_PROJECT_NAME}Config.cmake
NAMESPACE ${CMAKE_PROJECT_NAME}::
DESTINATION ${CMAKE_BINARY_DIR}
)
include(CMakePackageConfigHelpers)
configure_file(${CMAKE_PROJECT_NAME}Config.cmake.in ${CMAKE_PROJECT_NAME}Config.cmake @ONLY)
FILE ${CMAKE_PROJECT_NAME}-targets.cmake
NAMESPACE ${CMAKE_PROJECT_NAME}::
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME}
)
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
VERSION ${${CMAKE_PROJECT_NAME}_VERSION}
COMPATIBILITY SameMajorVersion)
#configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}Config.cmake.in
# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
# INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/)
#install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
# "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
# DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/)
install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
foreach(file ${TOOLS_TO_INSTALL})
install(PROGRAMS "${CMAKE_BINARY_DIR}/tools/${file}"
......
......@@ -2,26 +2,5 @@
# Morse
# -----
if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/internal/morse_cmake")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/morse/)
# Add extra cmake module path and initialize morse cmake modules
# --------------------------------------------------------------
if(MORSE_DISTRIB_DIR)
list(APPEND CMAKE_MODULE_PATH ${MORSE_DISTRIB_DIR})
set(MORSE_CMAKE_MODULE_PATH ${MORSE_DISTRIB_DIR})
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/internal/morse_cmake")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules/internal/morse_cmake/modules)
set(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules/internal/morse_cmake/modules )
endif()
include(MorseInit)
else(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/internal/morse_cmake")
message(FATAL_ERROR "MORSE_DISTRIB_DIR is not set")
message(FATAL_ERROR "Please indicate where is located your MORSE distribution directory."
" This is necessary to find cmake_modules.")
message(FATAL_ERROR "If you are a MORSE developer, you normally have access to the svn repository of the MORSE_DISTRIB_DIR: "
"svn checkout svn+ssh://yourlogin@scm.gforge.inria.fr/svnroot/morse/trunk/morse_distrib")
endif(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/internal/morse_cmake")
###
#
# @copyright (c) 2012-2020 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
# Copyright 2021 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
###
#
# - Extension of FindBLAS in order to provide both sequential and multi-threaded libraries when possible (e.g. Intel MKL)
#
# Result variables:
#
# - ``BLASEXT_FOUND`` if BLAS is found
# - ``BLAS_SEQ_LINKER_FLAGS`` sequential version of BLAS_LINKER_FLAGS
# - ``BLAS_MT_LINKER_FLAGS`` multi-threaded version of BLAS_LINKER_FLAGS
# - ``BLAS_SEQ_LIBRARIES`` sequential version of BLAS_LIBRARIES
# - ``BLAS_MT_LIBRARIES`` multi-threaded version of BLAS_LIBRARIES
#
# This module defines the following :prop_tgt:`IMPORTED` target:
#
# ``BLAS::BLAS_SEQ``
# The libraries of sequential blas, if found.
#
# ``BLAS::BLAS_MT``
# The libraries of multi-threaded blas, if found.
#
#=============================================================================
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "FindBLASEXT: Try to find BLAS")
endif()
# BLASEXT first search for the main BLAS library available
if(BLASEXT_FIND_REQUIRED)
find_package(BLAS QUIET REQUIRED)
else()
find_package(BLAS QUIET)
endif()
set(BLA_VENDOR_COPY ${BLA_VENDOR})
macro(blasext_set_library VERSION)
if (BLAS_FOUND)
set(BLAS_${VERSION}_FOUND ${BLAS_FOUND})
if(NOT TARGET BLAS::BLAS_${VERSION})
add_library(BLAS::BLAS_${VERSION} INTERFACE IMPORTED)
endif()
if (BLAS_LINKER_FLAGS)
set(BLAS_${VERSION}_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
set_target_properties(BLAS::BLAS_${VERSION} PROPERTIES
INTERFACE_LINK_OPTIONS "${BLAS_LINKER_FLAGS}"
)
endif()
if (BLAS_LIBRARIES)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "FindBLASEXT: Found BLAS ${BLA_VENDOR}")
message(STATUS "FindBLASEXT: Store following libraries in BLAS_${VERSION}_LIBRARIES and target BLAS::BLAS_${VERSION} ${BLAS_LIBRARIES}")
endif()
set(BLAS_${VERSION}_LIBRARIES ${BLAS_LIBRARIES})
set_target_properties(BLAS::BLAS_${VERSION} PROPERTIES
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}"
)
endif()
endif()
endmacro()
if (BLAS_FOUND)
if(BLAS_LIBRARIES MATCHES "libmkl")
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "FindBLASEXT: BLAS_LIBRARIES matches mkl")
endif()
# Look for the sequential MKL
# ---------------------------
set(BLA_VENDOR "Intel10_64lp_seq")
unset(BLAS_FOUND)
unset(BLAS_LINKER_FLAGS)
unset(BLAS_LIBRARIES)
find_package(BLAS QUIET)
blasext_set_library( SEQ )
# Look for the multi-threaded MKL
# -------------------------------
set(BLA_VENDOR "Intel10_64lp")
unset(BLAS_FOUND)
unset(BLAS_LINKER_FLAGS)
unset(BLAS_LIBRARIES)
find_package(BLAS QUIET)
blasext_set_library( MT )
# Restore the original library to make sure BLAS_LIBRARIES is set
# ---------------------------------------------------------------
set(BLA_VENDOR ${BLA_VENDOR_COPY})
unset(BLAS_FOUND)
unset(BLAS_LINKER_FLAGS)
unset(BLAS_LIBRARIES)
find_package(BLAS QUIET)
else(BLAS_LIBRARIES MATCHES "libmkl")
blasext_set_library( SEQ )
endif(BLAS_LIBRARIES MATCHES "libmkl")
else(BLAS_FOUND)
if(NOT BLASEXT_FIND_QUIETLY)
message(STATUS "FindBLASEXT: BLAS not found or BLAS_LIBRARIES does not match mkl")
endif()
endif(BLAS_FOUND)
set(BLA_VENDOR ${BLA_VENDOR_COPY})
# check that BLASEXT has been found
# ---------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BLASEXT DEFAULT_MSG
BLAS_LIBRARIES)
###
#
# @copyright (c) 2012-2020 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013-2020 Florent Pruvost
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of Morse, substitute the full
# License text for the above reference.)
###
#
# - Find CBLAS include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(CBLAS
# [REQUIRED] # Fail with error if cblas is not found
# [COMPONENTS <comp1> <comp2> ...] # dependencies
# )
#
# CBLAS depends on the following libraries:
# - BLAS
#
# 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 the following variables are set
# CBLAS_PREFIX - installation path of the lib found
# <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
#
# Set CBLAS_STATIC to 1 to force using static libraries if exist.
# Set CBLAS_MT to TRUE to force using multi-threaded blas libraries if exists (Intel MKL).
# Set CBLAS_MT to FALSE to force using sequential blas libraries if exists (Intel MKL).
# If CBLAS_MT is undefined, then CBLAS is linked to the default BLAS.
#
# This module defines the following :prop_tgt:`IMPORTED` target:
#
# ``MORSE::CBLAS``
# The headers and libraries to use for CBLAS, if found.
#
# 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
# CBLAS_INCDIR - Where to find the header files
# CBLAS_LIBDIR - Where to find the library files
# The module can also look for the following environment variables if paths
# are not given as cmake variable: CBLAS_DIR, CBLAS_INCDIR, CBLAS_LIBDIR
#
# CBLAS could be directly embedded in BLAS library (ex: Intel MKL) so that
# we test a cblas function with the blas libraries found and set CBLAS
# variables to BLAS ones if test is successful. To skip this feature and
# look for a stand alone cblas, please set CBLAS_STANDALONE to TRUE
###
# We handle different modes to find the dependency
#
# - Detection if already installed on the system
# - CBLAS libraries can be detected from different ways
# Here is the order of precedence:
# 1) we look in cmake variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined
# 2) we look in environment variable CBLAS_LIBDIR or CBLAS_DIR (we guess the libdirs) if defined
#
#=============================================================================
# Common macros to use in finds
include(FindMorseInit)
# Set variables from environment if needed
# ----------------------------------------
morse_find_package_get_envdir(CBLAS)
# Duplicate blas informations into cblas
# --------------------------------------
macro(cblas_init_variables BLAS)
# This macro can be called for initialization and/or
# extension of cblas discovery
message( DEBUG "[CBLAS] ${BLAS}_LIBRARIES: ${${BLAS}_LIBRARIES}")
message( DEBUG "[CBLAS] ${BLAS}_LIBRARY_DIRS: ${${BLAS}_LIBRARY_DIRS}")
message( DEBUG "[CBLAS] ${BLAS}_INCLUDE_DIRS: ${${BLAS}_INCLUDE_DIRS}")
message( DEBUG "[CBLAS] ${BLAS}_CFLAGS_OTHER: ${${BLAS}_CFLAGS_OTHER}")
message( DEBUG "[CBLAS] ${BLAS}_LDFLAGS_OTHER: ${${BLAS}_LDFLAGS_OTHER}")
if (${BLAS}_LIBRARIES)
set(CBLAS_BLAS ${BLAS})
list(APPEND CBLAS_LIBRARIES "${${BLAS}_LIBRARIES}")
else()
set(CBLAS_BLAS "CBLAS_BLAS-NOTFOUND")
set(CBLAS_LIBRARIES "CBLAS_LIBRARIES-NOTFOUND")
endif()
if (${BLAS}_LINKER_FLAGS)
list(APPEND CBLAS_LIBRARIES "${${BLAS}_LINKER_FLAGS}")
endif()
if (${BLAS}_INCLUDE_DIRS)
list(APPEND CBLAS_INCLUDE_DIRS "${${BLAS}_INCLUDE_DIRS}")
endif()
if (${BLAS}_LIBRARY_DIRS)
list(APPEND CBLAS_LIBRARY_DIRS "${${BLAS}_LIBRARY_DIRS}")
endif()
if (${BLAS}_CFLAGS_OTHER)
list(APPEND CBLAS_CFLAGS_OTHER "${${BLAS}_CFLAGS_OTHER}")
endif()
if (${BLAS}_LDFLAGS_OTHER)
list(APPEND CBLAS_LDFLAGS_OTHER "${${BLAS}_LDFLAGS_OTHER}")
endif()
morse_cleanup_variables(CBLAS)
message( DEBUG "[CBLAS] CBLAS_BLAS: ${CBLAS_BLAS}")
message( DEBUG "[CBLAS] CBLAS_LIBRARIES: ${CBLAS_LIBRARIES}")
message( DEBUG "[CBLAS] CBLAS_LIBRARY_DIRS: ${CBLAS_LIBRARY_DIRS}")
message( DEBUG "[CBLAS] CBLAS_INCLUDE_DIRS: ${CBLAS_INCLUDE_DIRS}")
message( DEBUG "[CBLAS] CBLAS_CFLAGS_OTHER: ${CBLAS_CFLAGS_OTHER}")
message( DEBUG "[CBLAS] CBLAS_LDFLAGS_OTHER: ${CBLAS_LDFLAGS_OTHER}")
endmacro()
# Check if a cblas function exists in the lib, and check if the
# advanced complex gemm functions are available
# -------------------------------------------------------------
macro(cblas_check_library _verbose)
morse_cmake_required_set(CBLAS)
unset(CBLAS_WORKS CACHE)
unset(CBLAS_ZGEMM3M_FOUND CACHE)
unset(CBLAS_CGEMM3M_FOUND CACHE)
check_function_exists(cblas_dscal CBLAS_WORKS)
if (CBLAS_WORKS)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
check_function_exists(cblas_cgemm3m CBLAS_CGEMM3M_FOUND)
endif()
mark_as_advanced(CBLAS_WORKS)
if(${_verbose})
if((NOT CBLAS_WORKS) AND (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 "CMAKE_REQUIRED_DEFINITIONS: ${CMAKE_REQUIRED_DEFINITIONS}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
morse_cmake_required_unset()
endmacro()
# Look for the cblas header files
# ---------------------------------
function(cblas_check_include)
if ( CBLAS_INCLUDE_DIRS )
return()
endif()
# Try to find the cblas header in the given paths
# -------------------------------------------------
if (CBLAS_LIBRARIES MATCHES "libmkl")
set(CBLAS_hdrs_to_find "mkl.h")
else()
set(CBLAS_hdrs_to_find "cblas.h")
endif()
# call cmake macro to find the header path
# ----------------------------------------
morse_find_path(CBLAS
HEADERS ${CBLAS_hdrs_to_find}
SUFFIXES "include" "include/cblas")
endfunction()
# CBLAS depends on BLAS anyway, try to find it
if(CBLAS_FIND_REQUIRED)
find_package(BLASEXT QUIET REQUIRED)
else()
find_package(BLASEXT QUIET)
endif()
if(DEFINED CBLAS_MT)
if (CBLAS_MT)
cblas_init_variables("BLAS_MT")
else()
cblas_init_variables("BLAS_SEQ")
endif()
else()
cblas_init_variables("BLAS")
endif()
# find CBLAS
if (CBLAS_BLAS)
if (NOT CBLAS_STANDALONE)
# Check if the blas library includes cblas
cblas_check_library("FALSE")
# Blas lib includes cblas
if(CBLAS_WORKS)
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas: test with blas succeeded")
endif()
# Set the mkl library dirs for compatibility with former version
# --------------------------------------------------------------
if (CBLAS_LIBRARIES MATCHES "libmkl" AND DEFINED ENV{MKLROOT})
set(CBLAS_PREFIX "$ENV{MKLROOT}" CACHE PATH "Installation directory of CBLAS library" FORCE)
set(CBLAS_LIBRARY_DIRS "${CBLAS_PREFIX}/lib/intel64")
endif()
cblas_check_include()
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 failed or CBLAS_STANDALONE enabled")
endif()
# Make sure CBLAS is invalidated
unset(CBLAS_WORKS CACHE)
unset(CBLAS_LIBRARIES)
unset(CBLAS_INCLUDE_DIRS)
unset(CBLAS_LIBRARY_DIRS)
unset(CBLAS_CFLAGS_OTHER)
unset(CBLAS_LDFLAGS_OTHER)
# try with pkg-config
set(ENV_MKLROOT "$ENV{MKLROOT}")
set(CBLAS_GIVEN_BY_USER FALSE)
if ( CBLAS_DIR OR ( CBLAS_INCDIR AND CBLAS_LIBDIR ) OR ( ENV_MKLROOT ) )
set(CBLAS_GIVEN_BY_USER TRUE)
endif()
# Search for cblas with pkg-config
# --------------------------------
find_package(PkgConfig QUIET)
if( PKG_CONFIG_EXECUTABLE AND (NOT CBLAS_GIVEN_BY_USER) )
if (BLA_STATIC)