Commit 8e7b5246 authored by PRUVOST Florent's avatar PRUVOST Florent Committed by COULAUD Olivier

update Morse CMake finds

parent 71dcc79f
......@@ -30,6 +30,7 @@
# BLA_STATIC if set on this determines what kind of linkage we do (static)
# BLA_VENDOR if set checks only the specified vendor, if not set checks
# all the possibilities
# BLAS_VENDOR_FOUND stores the BLAS vendor found
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DBLAS_DIR=path/to/blas):
......@@ -687,18 +688,18 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
endforeach ()
if(NOT BLAS_FIND_QUIETLY)
if(${_LIBRARIES})
message(STATUS "Looking for MKL BLAS: found")
else()
message(STATUS "Looking for MKL BLAS: not found")
endif()
endif()
if (${_LIBRARIES} AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Intel MKL")
endif()
endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
endif(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")
if(NOT BLAS_FIND_QUIETLY)
if(${_LIBRARIES})
message(STATUS "Looking for MKL BLAS: found")
else()
message(STATUS "Looking for MKL BLAS: not found")
endif()
endif()
endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
......@@ -722,6 +723,9 @@ if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Goto")
endif()
endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
......@@ -747,6 +751,9 @@ if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Openblas")
endif()
endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")
......@@ -765,7 +772,7 @@ if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
""
)
if(NOT BLAS_FIND_QUIETLY)
if(BLAS_LIBRARIES)
if(BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
message(STATUS "Looking for Eigen BLAS: found")
else()
message(STATUS "Looking for Eigen BLAS: not found")
......@@ -791,6 +798,9 @@ if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Eigen")
endif()
endif (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")
......@@ -816,6 +826,10 @@ if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Atlas")
endif()
endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
......@@ -840,6 +854,10 @@ if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "PhiPACK")
endif()
endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
......@@ -864,6 +882,10 @@ if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "CXML")
endif()
endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
......@@ -888,6 +910,10 @@ if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "DXML")
endif()
endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
......@@ -915,6 +941,10 @@ if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "SunPerf")
endif()
endif ()
......@@ -939,6 +969,10 @@ if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "SunPerf")
endif()
endif ()
......@@ -963,6 +997,10 @@ if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "SGIMATH")
endif()
endif ()
......@@ -987,6 +1025,10 @@ if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "IBM ESSL")
endif()
endif ()
# BLAS in IBM ESSL_MT library (requires generic BLAS lib, too)
......@@ -1010,6 +1052,10 @@ if (BLA_VENDOR STREQUAL "IBMESSLMT" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "IBM ESSL MT")
endif()
endif ()
......@@ -1179,6 +1225,10 @@ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "ACML")
endif()
endif (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") # ACML
......@@ -1203,6 +1253,10 @@ if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
endif()
endif()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Apple Accelerate")
endif()
endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
......@@ -1226,6 +1280,9 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
endif()
endif ()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "NAS")
endif()
endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
......@@ -1255,6 +1312,10 @@ if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
endif()
endforeach ()
if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)
set (BLAS_VENDOR_FOUND "Netlib or other Generic libblas")
endif()
endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
......@@ -1293,9 +1354,6 @@ if(BLA_F95)
set(BLAS_FOUND TRUE)
set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
if (NOT BLAS_LIBRARIES_DEP)
set(BLAS_LIBRARIES_DEP "${BLAS95_LIBRARIES}")
endif()
else(BLA_F95)
......
......@@ -114,22 +114,24 @@ if (BLAS_FOUND)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas: test with blas succeeds")
message(STATUS "Looking for cblas: test with blas succeeds")
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}")
set(CBLAS_LIBRARY_DIRS "${BLAS_LIBRARY_DIRS}")
endif()
if(BLAS_INCLUDE_DIRS)
set(CBLAS_INCLUDE_DIRS "${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}")
set(CBLAS_LINKER_FLAGS "${BLAS_LINKER_FLAGS}")
endif()
endif()
endif (NOT CBLAS_STANDALONE)
......@@ -160,17 +162,17 @@ if (BLAS_FOUND)
list(APPEND _inc_env "${ENV_CBLAS_DIR}/include/cblas")
else()
if(WIN32)
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
else()
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{CPATH}")
list(APPEND _inc_env "${_path_env}")
string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")
list(APPEND _inc_env "${_path_env}")
endif()
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
......@@ -184,21 +186,21 @@ if (BLAS_FOUND)
if(CBLAS_INCDIR)
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${CBLAS_INCDIR})
NAMES cblas.h
HINTS ${CBLAS_INCDIR})
else()
if(CBLAS_DIR)
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${CBLAS_DIR}
PATH_SUFFIXES "include" "include/cblas")
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${CBLAS_DIR}
PATH_SUFFIXES "include" "include/cblas")
else()
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${_inc_env}
PATH_SUFFIXES "cblas")
set(CBLAS_cblas.h_DIRS "CBLAS_cblas.h_DIRS-NOTFOUND")
find_path(CBLAS_cblas.h_DIRS
NAMES cblas.h
HINTS ${_inc_env}
PATH_SUFFIXES "cblas")
endif()
endif()
mark_as_advanced(CBLAS_cblas.h_DIRS)
......@@ -210,7 +212,7 @@ if (BLAS_FOUND)
else ()
set(CBLAS_INCLUDE_DIRS "CBLAS_INCLUDE_DIRS-NOTFOUND")
if(NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas -- cblas.h not found")
message(STATUS "Looking for cblas -- cblas.h not found")
endif()
endif()
......@@ -229,15 +231,15 @@ if (BLAS_FOUND)
list(APPEND _lib_env "${ENV_CBLAS_DIR}/lib")
else()
if(WIN32)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else()
if(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}")
if(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}")
endif()
endif()
list(REMOVE_DUPLICATES _lib_env)
......@@ -249,20 +251,20 @@ if (BLAS_FOUND)
if(CBLAS_LIBDIR)
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${CBLAS_LIBDIR})
NAMES cblas
HINTS ${CBLAS_LIBDIR})
else()
if(CBLAS_DIR)
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${CBLAS_DIR}
PATH_SUFFIXES lib lib32 lib64)
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${CBLAS_DIR}
PATH_SUFFIXES lib lib32 lib64)
else()
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${_lib_env})
set(CBLAS_cblas_LIBRARY "CBLAS_cblas_LIBRARY-NOTFOUND")
find_library(CBLAS_cblas_LIBRARY
NAMES cblas
HINTS ${_lib_env})
endif()
endif()
mark_as_advanced(CBLAS_cblas_LIBRARY)
......@@ -278,7 +280,7 @@ if (BLAS_FOUND)
set(CBLAS_LIBRARIES "CBLAS_LIBRARIES-NOTFOUND")
set(CBLAS_LIBRARY_DIRS "CBLAS_LIBRARY_DIRS-NOTFOUND")
if (NOT CBLAS_FIND_QUIETLY)
message(STATUS "Looking for cblas -- lib cblas not found")
message(STATUS "Looking for cblas -- lib cblas not found")
endif()
endif ()
......@@ -292,22 +294,22 @@ if (BLAS_FOUND)
# CBLAS
if (CBLAS_INCLUDE_DIRS)
set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
set(REQUIRED_INCDIRS "${CBLAS_INCLUDE_DIRS}")
endif()
if (CBLAS_LIBRARY_DIRS)
set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
set(REQUIRED_LIBDIRS "${CBLAS_LIBRARY_DIRS}")
endif()
set(REQUIRED_LIBS "${CBLAS_LIBRARIES}")
# BLAS
if (BLAS_INCLUDE_DIRS)
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")
endif()
if (BLAS_LIBRARY_DIRS)
list(APPEND REQUIRED_LIBDIRS "${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}")
list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")
endif()
# set required libraries for link
......@@ -315,7 +317,7 @@ if (BLAS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")
foreach(lib_dir ${REQUIRED_LIBDIRS})
list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")
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}")
......@@ -328,28 +330,28 @@ if (BLAS_FOUND)
if(CBLAS_WORKS)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
# save link with dependencies
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}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
# Check for faster complex GEMM routine
# (only C/Z, no S/D version)
check_function_exists(cblas_zgemm3m CBLAS_ZGEMM3M_FOUND)
if ( CBLAS_ZGEMM3M_FOUND )
add_definitions(-DCBLAS_HAS_ZGEMM3M -DCBLAS_HAS_CGEMM3M)
endif()
# save link with dependencies
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}")
list(REMOVE_DUPLICATES CBLAS_LIBRARY_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_INCLUDE_DIRS_DEP)
list(REMOVE_DUPLICATES CBLAS_LINKER_FLAGS)
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 "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
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 "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_FLAGS)
......
......@@ -37,6 +37,7 @@
# 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_INCLUDE_DIRS - chameleon include directories
# CHAMELEON_LIBRARY_DIRS - Link directories for chameleon libraries
......@@ -166,9 +167,10 @@ if(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
endif()
endif()
set(CHAMELEON_INCLUDE_DIRS_DEP "${CHAMELEON_INCLUDE_DIRS}")
set(CHAMELEON_LIBRARY_DIRS_DEP "${CHAMELEON_LIBRARY_DIRS}")
set(CHAMELEON_LIBRARIES_DEP "${CHAMELEON_LIBRARIES}")
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}")
endif(PKG_CONFIG_EXECUTABLE AND NOT CHAMELEON_GIVEN_BY_USER)
......
###
#
# @copyright (c) 2017 Inria. All rights reserved.
#
###
#
# - Find CPPCHECK bin directory
# Use this module by invoking find_package with the form:
# find_package(CPPCHECK
# [REQUIRED]) # Fail with error if cppcheck is not found
#
# This module finds headers and cppcheck library.
# Results are reported in variables:
# CPPCHECK_FOUND - True if cppcheck executable is found
# CPPCHECK_EXECUTABLE - cppcheck executable directory found
#
# The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DCPPCHECK_DIR=path/to/cppcheck):
# CPPCHECK_DIR - Where to find the base directory of cppcheck
# CPPCHECK_BINDIR - Where to find the executable cppcheck
# The module can also look for the following environment variables if paths
# are not given as cmake variable: CPPCHECK_DIR, CPPCHECK_BINDIR
if (NOT CPPCHECK_FOUND)
set(CPPCHECK_DIR "" CACHE PATH "Installation directory of CPPCHECK library")
mark_as_advanced(CPPCHECK_DIR)
if (NOT CPPCHECK_FIND_QUIETLY)
message(STATUS "A cache variable, namely CPPCHECK_DIR, has been set to specify the install directory of CPPCHECK")
endif()
endif()
set(ENV_CPPCHECK_DIR "$ENV{CPPCHECK_DIR}")
set(ENV_CPPCHECK_BINDIR "$ENV{CPPCHECK_BINDIR}")
set(CPPCHECK_GIVEN_BY_USER "FALSE")
if ( CPPCHECK_DIR OR CPPCHECK_BINDIR OR ENV_CPPCHECK_DIR OR ENV_CPPCHECK_BINDIR )
set(CPPCHECK_GIVEN_BY_USER "TRUE")
endif()
if (NOT CPPCHECK_FIND_QUIETLY)
message(STATUS "Looking for CPPCHECK")
endif()
# Looking for executable
# ----------------------
# Add system include paths to search include
# ------------------------------------------
unset(where_to_look)
if(CPPCHECK_BINDIR)
list(APPEND where_to_look "${CPPCHECK_BINDIR}")
elseif(CPPCHECK_DIR)
list(APPEND where_to_look "${CPPCHECK_DIR}")
elseif(ENV_CPPCHECK_BINDIR)
list(APPEND where_to_look "${ENV_CPPCHECK_BINDIR}")
elseif(ENV_CPPCHECK_DIR)
list(APPEND where_to_look "${ENV_CPPCHECK_DIR}/bin")
else()
string(REPLACE ":" ";" _path_env "$ENV{PATH}")
list(APPEND where_to_look "${_path_env}")
endif()
list(APPEND where_to_look "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND where_to_look "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES where_to_look)
find_program(CPPCHECK_EXECUTABLE
NAMES cppcheck
HINTS ${where_to_look}
)
mark_as_advanced(CPPCHECK_EXECUTABLE)
if(CPPCHECK_EXECUTABLE)
execute_process(COMMAND ${CPPCHECK_EXECUTABLE} "--version" OUTPUT_VARIABLE CPPCHECK_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "Cppcheck " "" CPPCHECK_VERSION "${CPPCHECK_VERSION}")
endif()
# check that CPPCHECK has been found
# ----------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CPPCHECK DEFAULT_MSG
CPPCHECK_EXECUTABLE
CPPCHECK_VERSION)
......@@ -20,6 +20,7 @@
# 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
......@@ -86,6 +87,8 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
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) )
......
# - Try to find fabulous (C-api)
#
# If this script have difficulties to find fabulous, you can try to help
# it by setting the variable FABULOUS_DIR to the prefix path where fabulous
# was installed
#
# Once done this will define
# FABULOUS_FOUND - System has fabulous
# FABULOUS_INCLUDE_DIRS - The fabulous include directories
# FABULOUS_LIBRARIES - The libraries needed to use fabulous
# FABULOUS_DEFINITIONS - Compiler switches required for using fabulous
include(FindPackageHandleStandardArgs)
macro(FABULOUS_FIND_LIBRARIES_FROM_PKGCONFIG_RESULTS _prefix _pc_xprefix)
foreach(_library ${${_pc_xprefix}_LIBRARIES})
get_filename_component(_library ${_library} NAME_WE)
unset(_library_path)
unset(_library_path CACHE)
find_library(_library_path NAMES ${_library}
HINTS ${${_pc_xprefix}_LIBDIR} ${${_pc_xprefix}_LIBRARY_DIRS} )
if (_library_path)
list(APPEND ${_prefix}_LIBRARIES ${_library_path})
else()
message(FATAL_ERROR "Dependency of ${_prefix} '${_library}' NOT FOUND")
endif()
unset(_library_path CACHE)
endforeach()
endmacro()
macro(FABULOUS_CHECK_FUNCTION_EXISTS _prefix _function)
include(CheckFunctionExists)
unset(${_prefix}_WORKS)
unset(${_prefix}_WORKS CACHE)
set(CMAKE_REQUIRED_LIBRARIES ${${_prefix}_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${${_prefix}_INCLUDE_DIRS})
set(CMAKE_REQUIRED_DEFINITIONS ${${_prefix}_DEFINITIONS})
check_function_exists(${_function} ${_prefix}_WORKS)
set(CMAKE_REQUIRED_LIBRARIES "")
set(CMAKE_REQUIRED_INCLUDES "")
set(CMAKE_REQUIRED_DEFINITIONS "")
mark_as_advanced(${_prefix}_WORKS)
endmacro()
find_package(PkgConfig QUIET)
set(ENV_FABULOUS_DIR "$ENV{FABULOUS_DIR}")
set(ENV_FABULOUS_INCDIR "$ENV{FABULOUS_INCDIR}")
set(ENV_FABULOUS_LIBDIR "$ENV{FABULOUS_LIBDIR}")
set(FABULOUS_GIVEN_BY_USER "FALSE")
if ( FABULOUS_DIR OR ENV_FABULOUS_DIR
OR ( FABULOUS_INCDIR AND FABULOUS_LIBDIR )
OR ( ENV_FABULOUS_INCDIR AND ENV_FABULOUS_LIBDIR ) )
set(FABULOUS_GIVEN_BY_USER "TRUE")
endif()
set(FABULOUS_STATIC_FIND_QUIETLY "TRUE")
set(FABULOUS_SHARED_FIND_QUIETLY "TRUE")
if ((NOT FABULOUS_FOUND) AND (NOT FABULOUS_GIVEN_BY_USER) AND PKG_CONFIG_FOUND)
pkg_check_modules(PC_FABULOUS QUIET fabulous)
find_path(FABULOUS_STATIC_INCLUDE_DIR NAMES fabulous.h
HINTS ${PC_FABULOUS_STATIC_INCLUDEDIR} ${PC_FABULOUS_STATIC_INCLUDE_DIRS} )
find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a
HINTS ${PC_FABULOUS_STATIC_LIBDIR} ${PC_FABULOUS_STATIC_LIBRARY_DIRS} )
find_path(FABULOUS_SHARED_INCLUDE_DIR NAMES fabulous.h
HINTS ${PC_FABULOUS_INCLUDEDIR} ${PC_FABULOUS_INCLUDE_DIRS} )
find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so
HINTS ${PC_FABULOUS_LIBDIR} ${PC_FABULOUS_LIBRARY_DIRS} )
# handle the QUIETLY and REQUIRED arguments and set FABULOUS_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(
FABULOUS_STATIC DEFAULT_MSG
FABULOUS_STATIC_LIBRARY FABULOUS_STATIC_INCLUDE_DIR)
mark_as_advanced(FABULOUS_STATIC_INCLUDE_DIR FABULOUS_STATIC_LIBRARY)
find_package_handle_standard_args(
FABULOUS_SHARED DEFAULT_MSG
FABULOUS_SHARED_LIBRARY FABULOUS_SHARED_INCLUDE_DIR)
mark_as_advanced(FABULOUS_SHARED_INCLUDE_DIR FABULOUS_SHARED_LIBRARY)
if (FABULOUS_STATIC_FOUND AND NOT FABULOUS_SHARED_FOUND)
set(FABULOUS_INCLUDE_DIRS ${FABULOUS_STATIC_INCLUDE_DIR} )
set(FABULOUS_DEFINITIONS ${PC_FABULOUS_STATIC_CFLAGS_OTHER} )
set(FABULOUS_LIBRARIES "")
fabulous_find_libraries_from_pkgconfig_results(FABULOUS PC_FABULOUS_STATIC)
elseif(FABULOUS_SHARED_FOUND)
set(FABULOUS_INCLUDE_DIRS ${FABULOUS_INCLUDE_DIR} )
set(FABULOUS_DEFINITIONS ${PC_FABULOUS_CFLAGS_OTHER} )
set(FABULOUS_LIBRARIES "")
fabulous_find_libraries_from_pkgconfig_results(FABULOUS PC_FABULOUS)
endif()
fabulous_check_function_exists(FABULOUS fabulous_create)
find_package_handle_standard_args(
FABULOUS DEFAULT_MSG
FABULOUS_LIBRARIES FABULOUS_INCLUDE_DIRS FABULOUS_WORKS)
endif()
if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND)))
# Currently the C-api (compiled version) does not depent on chameleon
# so the library only depends on CBLAS AND LAPACKE
set(FABULOUS_DEFINITIONS "")
if ( ( FABULOUS_INCDIR AND FABULOUS_LIBDIR ) OR ( ENV_FABULOUS_INCDIR AND ENV_FABULOUS_LIBDIR ) )
if ((NOT FABULOUS_LIBDIR) AND (NOT FABULOUS_INCDIR)
AND (ENV_FABULOUS_INCDIR AND ENV_FABULOUS_LIBDIR) )
set(FABULOUS_LIBDIR ${ENV_FABULOUS_LIBDIR})
set(FABULOUS_INCDIR ${ENV_FABULOUS_INCDIR})
endif()
find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h HINTS ${FABULOUS_INCDIR})
find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a HINTS ${FABULOUS_LIBDIR})
find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so HINTS ${FABULOUS_LIBDIR})
else()
if (ENV_FABULOUS_DIR AND NOT FABULOUS_DIR)
set(FABULOUS_DIR "${ENV_FABULOUS_DIR}" CACHE PATH "Installation prefix where fabulous is installed")
else()
set(FABULOUS_DIR "${FABULOUS_DIR}" CACHE PATH "Installation prefix where fabulous is installed")
endif()