Commit b8c53118 authored by PRUVOST Florent's avatar PRUVOST Florent

update cmake modules and clean main CMakeLists a bit

parent 0e0cb337
This diff is collapsed.
...@@ -34,19 +34,19 @@ ...@@ -34,19 +34,19 @@
if (MORSE_ENABLE_WARNING) if (MORSE_ENABLE_WARNING)
if(CMAKE_C_COMPILER_ID MATCHES GNU) if(CMAKE_C_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fdiagnostics-show-option")
elseif(CMAKE_C_COMPILER_ID MATCHES Intel) elseif(CMAKE_C_COMPILER_ID MATCHES Intel)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w3 -diag-disable:remark") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w3 -diag-disable:remark")
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES GNU) if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fdiagnostics-show-option")
elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel) elseif(CMAKE_CXX_COMPILER_ID MATCHES Intel)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w3 -diag-disable:remark") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w3 -diag-disable:remark")
endif() endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Wall -fdiagnostics-show-option")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel) elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn all -diag-disable:remark") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -warn all -diag-disable:remark")
endif() endif()
...@@ -56,21 +56,21 @@ endif(MORSE_ENABLE_WARNING) ...@@ -56,21 +56,21 @@ endif(MORSE_ENABLE_WARNING)
if (MORSE_ENABLE_COVERAGE) if (MORSE_ENABLE_COVERAGE)
if(CMAKE_C_COMPILER_ID MATCHES GNU) if(CMAKE_C_COMPILER_ID MATCHES GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fno-inline --coverage")
else() else()
message(FATAL_ERROR "Code coverage is only available with the GNU C (gcc)" message(FATAL_ERROR "Code coverage is only available with the GNU C (gcc)"
"\n compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.") "\n compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
endif() endif()
if(CMAKE_CXX_COMPILER_ID MATCHES GNU) if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-inline --coverage")
else() else()
message(FATAL_ERROR "Code coverage is only available with the GNU CXX" message(FATAL_ERROR "Code coverage is only available with the GNU CXX"
"\n (g++) compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.") "\n (g++) compiler, please turn MORSE_ENABLE_COVERAGE OFF\n.")
endif() endif()
if(CMAKE_Fortran_COMPILER_ID MATCHES GNU) if(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} --coverage") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fPIC -fno-inline --coverage")
else() else()
message(FATAL_ERROR "Code coverage is only available with the GNU" message(FATAL_ERROR "Code coverage is only available with the GNU"
"\n Fortran (gfortran) compiler, please turn MORSE_ENABLE_COVERAGE" "\n Fortran (gfortran) compiler, please turn MORSE_ENABLE_COVERAGE"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # All rights reserved.
# @copyright (c) 2012-2014 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. # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# Univ. of California Berkeley, # Univ. of California Berkeley,
# Univ. of Colorado Denver. # Univ. of Colorado Denver.
# #
# @version 0.9.0 # @version 1.0.0
# @author Cedric Castagnede # @author Cedric Castagnede
# @author Emmanuel Agullo # @author Emmanuel Agullo
# @author Mathieu Faverge # @author Mathieu Faverge
...@@ -28,51 +28,51 @@ ...@@ -28,51 +28,51 @@
### ###
# Set some colors # Set some colors
#if(NOT WIN32) if(NOT WIN32)
# string(ASCII 27 Esc) string(ASCII 27 Esc)
# set(ColourReset "${Esc}[m") set(ColourReset "${Esc}[m")
# set(ColourBold "${Esc}[1m") set(ColourBold "${Esc}[1m")
# set(Red "${Esc}[31m") set(Red "${Esc}[31m")
# set(Green "${Esc}[32m") set(Green "${Esc}[32m")
# set(Yellow "${Esc}[33m") set(Yellow "${Esc}[33m")
# set(Blue "${Esc}[34m") set(Blue "${Esc}[34m")
# set(Magenta "${Esc}[35m") set(Magenta "${Esc}[35m")
# set(Cyan "${Esc}[36m") set(Cyan "${Esc}[36m")
# set(White "${Esc}[37m") set(White "${Esc}[37m")
# set(BoldRed "${Esc}[1;31m") set(BoldRed "${Esc}[1;31m")
# set(BoldGreen "${Esc}[1;32m") set(BoldGreen "${Esc}[1;32m")
# set(BoldYellow "${Esc}[1;33m") set(BoldYellow "${Esc}[1;33m")
# set(BoldBlue "${Esc}[1;34m") set(BoldBlue "${Esc}[1;34m")
# set(BoldMagenta "${Esc}[1;35m") set(BoldMagenta "${Esc}[1;35m")
# set(BoldCyan "${Esc}[1;36m") set(BoldCyan "${Esc}[1;36m")
# set(BoldWhite "${Esc}[1;37m") set(BoldWhite "${Esc}[1;37m")
#endif()
# Colorize cmake messages during configure # Colorize cmake messages during configure
function(message) function(message)
list(GET ARGV 0 MessageType) list(GET ARGV 0 MessageType)
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR) if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}") _message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL WARNING) elseif(MessageType STREQUAL WARNING)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}") _message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL AUTHOR_WARNING) elseif(MessageType STREQUAL AUTHOR_WARNING)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}") _message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL STATUS) elseif(MessageType STREQUAL STATUS)
list(REMOVE_AT ARGV 0) list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${Green}${ARGV_STR}${ColourReset}") _message(${MessageType} "${Green}${ARGV_STR}${ColourReset}")
else() else()
string (REPLACE ";" " " ARGV_STR "${ARGV}") string (REPLACE ";" " " ARGV_STR "${ARGV}")
string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}") string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}")
_message("${ARGV_STR}") _message("${ARGV_STR}")
endif() endif()
endfunction() endfunction()
endif()
## ##
## @end file ColorizeMessage.cmake ## @end file ColorizeMessage.cmake
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # 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. # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# Univ. of California Berkeley, # Univ. of California Berkeley,
# Univ. of Colorado Denver. # Univ. of Colorado Denver.
# #
# @version 0.9.0 # @version 1.0.0
# @author Cedric Castagnede # @author Cedric Castagnede
# @author Emmanuel Agullo # @author Emmanuel Agullo
# @author Mathieu Faverge # @author Mathieu Faverge
...@@ -27,11 +27,25 @@ ...@@ -27,11 +27,25 @@
# #
### ###
# Global Morse options
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
option(MORSE_ENABLE_COLOR_MESSAGE "Enable colors in messages" OFF)
#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# " information about packages not found")
# This include is required to check symbols of libs in the main CMakeLists.txt # This include is required to check symbols of libs in the main CMakeLists.txt
include(CheckFunctionExists) include(CheckFunctionExists)
# To colorize messages # This include is required to check defines in headers
#include(ColorizeMessage) include(CheckIncludeFiles)
if (MORSE_ENABLE_COLOR_MESSAGE)
# colorize messages
include(ColorizeMessage)
endif()
# To find headers and libs # To find headers and libs
include(FindHeadersAndLibs) include(FindHeadersAndLibs)
...@@ -49,12 +63,6 @@ include(Ressources) ...@@ -49,12 +63,6 @@ include(Ressources)
# Add the path where we handle our FindFOO.cmake to seek for liraries # Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find) list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
option(MORSE_ENABLE_WARNING "Enable warning messages" OFF)
option(MORSE_ENABLE_COVERAGE "Enable flags for coverage test" OFF)
#option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning packages not found" OFF)
#message(STATUS "MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# " information about packages not found")
## ##
## @end file MorseInit.cmake ## @end file MorseInit.cmake
## ##
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved. # @copyright (c) 2012-2016 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
# #
...@@ -158,6 +157,10 @@ endif() ...@@ -158,6 +157,10 @@ endif()
# the target receives a -DPRECISION_p in its cflags. # the target receives a -DPRECISION_p in its cflags.
# #
include(ParseArguments) include(ParseArguments)
# Add a hint to help Cmake to find the correct python version:
# (see https://cmake.org/cmake/help/v3.0/module/FindPythonInterp.html)
set(Python_ADDITIONAL_VERSIONS 2)
find_package(PythonInterp REQUIRED) find_package(PythonInterp REQUIRED)
MACRO(precisions_rules_py) MACRO(precisions_rules_py)
...@@ -237,10 +240,9 @@ MACRO(precisions_rules_py) ...@@ -237,10 +240,9 @@ MACRO(precisions_rules_py)
COMMAND ${CMAKE_COMMAND} -E remove -f ${_dependency_OUTPUT} && ${pythoncmd} && chmod a-w ${_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}) 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 "-DPRECISION_${_dependency_PREC}" GENERATED 1 IS_IN_BINARY_DIR 1 )
else( generate_out ) 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 "-DPRECISION_${_dependency_PREC}" GENERATED 0 )
endif( generate_out ) endif( generate_out )
list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT}) list(APPEND ${OUTPUTLIST} ${_dependency_OUTPUT})
......
This diff is collapsed.
This diff is collapsed.
...@@ -372,6 +372,9 @@ endif(BLAS_FOUND) ...@@ -372,6 +372,9 @@ endif(BLAS_FOUND)
if (CBLAS_LIBRARIES) if (CBLAS_LIBRARIES)
list(GET CBLAS_LIBRARIES 0 first_lib) list(GET CBLAS_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH) get_filename_component(first_lib_path "${first_lib}" PATH)
if (NOT CBLAS_LIBRARY_DIRS)
set(CBLAS_LIBRARY_DIRS "${first_lib_path}")
endif()
if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)") if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")
string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}") string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")
set(CBLAS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of CBLAS library" FORCE) set(CBLAS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of CBLAS library" FORCE)
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # All rights reserved.
# @copyright (c) 2012-2014 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. # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
# EZTRACE_INCLUDE_DIRS - eztrace include directories # EZTRACE_INCLUDE_DIRS - eztrace include directories
# EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries # EZTRACE_LIBRARY_DIRS - Link directories for eztrace libraries
# EZTRACE_LIBRARIES - eztrace component libraries to be linked # EZTRACE_LIBRARIES - eztrace component libraries to be linked
# EZTRACE_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# #
# The user can give specific paths where to find the libraries adding cmake # 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): # options at configure (ex: cmake path/to/project -DEZTRACE_DIR=path/to/eztrace):
...@@ -34,11 +35,11 @@ ...@@ -34,11 +35,11 @@
# are not given as cmake variable: EZTRACE_DIR, EZTRACE_INCDIR, EZTRACE_LIBDIR # are not given as cmake variable: EZTRACE_DIR, EZTRACE_INCDIR, EZTRACE_LIBDIR
#============================================================================= #=============================================================================
# Copyright 2012-2013 Inria # Copyright 2012-2018 Inria
# Copyright 2012-2013 Emmanuel Agullo # Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge # Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede # Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost # Copyright 2013-2018 Florent Pruvost
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details. # see accompanying file MORSE-Copyright.txt for details.
...@@ -82,8 +83,13 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER ) ...@@ -82,8 +83,13 @@ if( PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_GIVEN_BY_USER )
#endif() #endif()
else() else()
message(STATUS "${Magenta}Looking for EZTRACE - not found using PkgConfig." message(STATUS "${Magenta}Looking for EZTRACE - not found using PkgConfig."
"\n Perhaps you should add the directory containing eztrace.pc to" "\n Perhaps you should add the directory containing eztrace.pc to"
"\n the PKG_CONFIG_PATH environment variable.${ColourReset}") "\n the PKG_CONFIG_PATH environment variable.${ColourReset}")
endif()
if (EZTRACE_FOUND AND EZTRACE_LIBRARIES)
set(EZTRACE_FOUND_WITH_PKGCONFIG "TRUE")
else()
set(EZTRACE_FOUND_WITH_PKGCONFIG "FALSE")
endif() endif()
endif() endif()
...@@ -180,15 +186,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) ...@@ -180,15 +186,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
if(EZTRACE_DIR) if(EZTRACE_DIR)
set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND") set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND")
find_path(EZTRACE_eztrace.h_DIRS find_path(EZTRACE_eztrace.h_DIRS
NAMES eztrace.h NAMES eztrace.h
HINTS ${EZTRACE_DIR} HINTS ${EZTRACE_DIR}
PATH_SUFFIXES "include" "include/eztrace") PATH_SUFFIXES "include" "include/eztrace")
else() else()
set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND") set(EZTRACE_eztrace.h_DIRS "EZTRACE_eztrace.h_DIRS-NOTFOUND")
find_path(EZTRACE_eztrace.h_DIRS find_path(EZTRACE_eztrace.h_DIRS
NAMES eztrace.h NAMES eztrace.h
HINTS ${PATH_TO_LOOK_FOR} HINTS ${PATH_TO_LOOK_FOR}
PATH_SUFFIXES "eztrace") PATH_SUFFIXES "eztrace")
endif() endif()
endif() endif()
mark_as_advanced(EZTRACE_eztrace.h_DIRS) mark_as_advanced(EZTRACE_eztrace.h_DIRS)
...@@ -225,9 +231,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) ...@@ -225,9 +231,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
string(REPLACE ":" ";" _lib_env "$ENV{LIB}") string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else() else()
if(APPLE) if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else() else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif() endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
...@@ -251,14 +257,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) ...@@ -251,14 +257,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
if(EZTRACE_DIR) if(EZTRACE_DIR)
set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND") set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND")
find_library(EZTRACE_eztrace_LIBRARY find_library(EZTRACE_eztrace_LIBRARY
NAMES eztrace NAMES eztrace
HINTS ${EZTRACE_DIR} HINTS ${EZTRACE_DIR}
PATH_SUFFIXES lib lib32 lib64) PATH_SUFFIXES lib lib32 lib64)
else() else()
set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND") set(EZTRACE_eztrace_LIBRARY "EZTRACE_eztrace_LIBRARY-NOTFOUND")
find_library(EZTRACE_eztrace_LIBRARY find_library(EZTRACE_eztrace_LIBRARY
NAMES eztrace NAMES eztrace
HINTS ${PATH_TO_LOOK_FOR}) HINTS ${PATH_TO_LOOK_FOR})
endif() endif()
endif() endif()
mark_as_advanced(EZTRACE_eztrace_LIBRARY) mark_as_advanced(EZTRACE_eztrace_LIBRARY)
...@@ -315,10 +321,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND) ...@@ -315,10 +321,10 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT EZTRACE_FOUND)
if(NOT EZTRACE_WORKS) if(NOT EZTRACE_WORKS)
if(NOT EZTRACE_FIND_QUIETLY) if(NOT EZTRACE_FIND_QUIETLY)
message(STATUS "Looking for eztrace : test of eztrace_topology_init with eztrace library fails") 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_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")
message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}") message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails") message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif() endif()
endif() endif()
set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_INCLUDES)
...@@ -334,6 +340,7 @@ if (EZTRACE_LIBRARIES) ...@@ -334,6 +340,7 @@ if (EZTRACE_LIBRARIES)
else() else()
list(GET EZTRACE_LIBRARIES 0 first_lib) list(GET EZTRACE_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" PATH) get_filename_component(first_lib_path "${first_lib}" PATH)
set(EZTRACE_LIBRARY_DIRS "${first_lib_path}")
endif() endif()
if (${first_lib_path} MATCHES "/lib(32|64)?$") if (${first_lib_path} MATCHES "/lib(32|64)?$")
string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}") string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
# Once done this will define # Once done this will define
# FABULOUS_FOUND - System has fabulous # FABULOUS_FOUND - System has fabulous
# FABULOUS_INCLUDE_DIRS - The fabulous include directories # FABULOUS_INCLUDE_DIRS - The fabulous include directories
# FABULOUS_MODULE_DIRS - The fabulous module directories for Fortran API
# FABULOUS_LIBRARIES - The libraries needed to use fabulous # FABULOUS_LIBRARIES - The libraries needed to use fabulous
# FABULOUS_DEFINITIONS - Compiler switches required for using fabulous # FABULOUS_DEFINITIONS - Compiler switches required for using fabulous
#
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
macro(FABULOUS_FIND_LIBRARIES_FROM_PKGCONFIG_RESULTS _prefix _pc_xprefix) macro(FABULOUS_FIND_LIBRARIES_FROM_PKGCONFIG_RESULTS _prefix _pc_xprefix)
...@@ -115,6 +116,8 @@ if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND))) ...@@ -115,6 +116,8 @@ if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND)))
endif() endif()
find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h HINTS ${FABULOUS_INCDIR}) find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h HINTS ${FABULOUS_INCDIR})
find_path(FABULOUS_MODULE_DIRS NAMES fabulous_mod.mod HINTS ${FABULOUS_INCDIR}
PATH_SUFFIXES fabulous)
find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a HINTS ${FABULOUS_LIBDIR}) find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a HINTS ${FABULOUS_LIBDIR})
find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so HINTS ${FABULOUS_LIBDIR}) find_library(FABULOUS_SHARED_LIBRARY NAMES libfabulous.so HINTS ${FABULOUS_LIBDIR})
else() else()
...@@ -127,6 +130,9 @@ if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND))) ...@@ -127,6 +130,9 @@ if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND)))
find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h find_path(FABULOUS_INCLUDE_DIRS NAMES fabulous.h
HINTS ${FABULOUS_DIR} HINTS ${FABULOUS_DIR}
PATH_SUFFIXES include include/fabulous) PATH_SUFFIXES include include/fabulous)
find_path(FABULOUS_MODULE_DIRS NAMES fabulous_mod.mod
HINTS ${FABULOUS_DIR}
PATH_SUFFIXES include include/fabulous)
find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a find_library(FABULOUS_STATIC_LIBRARY NAMES libfabulous.a
HINTS ${FABULOUS_DIR} HINTS ${FABULOUS_DIR}
PATH_SUFFIXES lib lib32 lib64 lib/fabulous lib32/fabulous lib64/fabulous) PATH_SUFFIXES lib lib32 lib64 lib/fabulous lib32/fabulous lib64/fabulous)
...@@ -139,17 +145,18 @@ if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND))) ...@@ -139,17 +145,18 @@ if ((NOT FABULOUS_FOUND) AND (FABULOUS_GIVEN_BY_USER OR (NOT PKG_CONFIG_FOUND)))
find_package_handle_standard_args(FABULOUS_SHARED DEFAULT_MSG FABULOUS_SHARED_LIBRARY) find_package_handle_standard_args(FABULOUS_SHARED DEFAULT_MSG FABULOUS_SHARED_LIBRARY)
mark_as_advanced(FABULOUS_STATIC_LIBRARY FABULOUS_SHARED_LIBRARY) mark_as_advanced(FABULOUS_STATIC_LIBRARY FABULOUS_SHARED_LIBRARY)
if (FABULOUS_FIND_REQUIRED)
find_package(CBLAS REQUIRED)
find_package(LAPACKE REQUIRED)
else()
find_package(CBLAS)
find_package(LAPACKE)
endif()
if (FABULOUS_STATIC_FOUND AND NOT FABULOUS_SHARED_FOUND) if (FABULOUS_STATIC_FOUND AND NOT FABULOUS_SHARED_FOUND)
if (FABULOUS_FIND_REQUIRED) set(FABULOUS_LIBRARIES ${FABULOUS_STATIC_LIBRARY} ${CBLAS_LIBRARIES} ${LAPACKE_LIBRARIES} "-lstdc++" "-lm")
find_package(CBLAS REQUIRED)
find_package(LAPACKE REQUIRED)
else()
find_package(CBLAS)
find_package(LAPACKE)
endif()
set(FABULOUS_LIBRARIES ${FABULOUS_STATIC_LIBRARY} ${CBLAS_LIBRARIES} ${LAPACKE_LIBRARIES})
elseif(FABULOUS_SHARED_FOUND) elseif(FABULOUS_SHARED_FOUND)
set(FABULOUS_LIBRARIES ${FABULOUS_SHARED_LIBRARY}) set(FABULOUS_LIBRARIES ${FABULOUS_SHARED_LIBRARY} ${CBLAS_LIBRARIES} ${LAPACKE_LIBRARIES})
endif() endif()
fabulous_check_function_exists(FABULOUS fabulous_create) fabulous_check_function_exists(FABULOUS fabulous_create)
find_package_handle_standard_args( find_package_handle_standard_args(
......
This diff is collapsed.
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# @copyright (c) 2009-2014 The University of Tennessee and The University # @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation. # of Tennessee Research Foundation.
# All rights reserved. # All rights reserved.
# @copyright (c) 2012-2014 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. # @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
# #
### ###
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
# FXT_INCLUDE_DIRS - fxt include directories # FXT_INCLUDE_DIRS - fxt include directories
# FXT_LIBRARY_DIRS - Link directories for fxt libraries # FXT_LIBRARY_DIRS - Link directories for fxt libraries
# FXT_LIBRARIES - fxt component libraries to be linked # FXT_LIBRARIES - fxt component libraries to be linked
# FXT_FOUND_WITH_PKGCONFIG - True if found with pkg-config
# #
# The user can give specific paths where to find the libraries adding cmake # The user can give specific paths where to find the libraries adding cmake
# options at configure (ex: cmake path/to/project -DFXT_DIR=path/to/fxt): # options at configure (ex: cmake path/to/project -DFXT_DIR=path/to/fxt):
...@@ -30,11 +31,11 @@ ...@@ -30,11 +31,11 @@
# are not given as cmake variable: FXT_DIR, FXT_INCDIR, FXT_LIBDIR # are not given as cmake variable: FXT_DIR, FXT_INCDIR, FXT_LIBDIR
#============================================================================= #=============================================================================
# Copyright 2012-2013 Inria # Copyright 2012-2018 Inria
# Copyright 2012-2013 Emmanuel Agullo # Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge # Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede # Copyright 2012 Cedric Castagnede
# Copyright 2013 Florent Pruvost # Copyright 2013-2018 Florent Pruvost
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file MORSE-Copyright.txt for details. # see accompanying file MORSE-Copyright.txt for details.
...@@ -78,13 +79,19 @@ if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER) ...@@ -78,13 +79,19 @@ if(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
#endif() #endif()
else() else()
message(STATUS "${Magenta}Looking for FXT - not found using PkgConfig." message(STATUS "${Magenta}Looking for FXT - not found using PkgConfig."
"\n Perhaps you should add the directory containing fxt.pc to the" "\n Perhaps you should add the directory containing fxt.pc to the"
"\n PKG_CONFIG_PATH environment variable.${ColourReset}") "\n PKG_CONFIG_PATH environment variable.${ColourReset}")
endif() endif()
endif() endif()
set(FXT_C_FLAGS "${FXT_CFLAGS_OTHER}") set(FXT_C_FLAGS "${FXT_CFLAGS_OTHER}")
if (FXT_FOUND AND FXT_LIBRARIES)
set(FXT_FOUND_WITH_PKGCONFIG "TRUE")
else()
set(FXT_FOUND_WITH_PKGCONFIG "FALSE")
endif()
endif(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER) endif(PKG_CONFIG_EXECUTABLE AND NOT FXT_GIVEN_BY_USER)
if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) ) if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR (FXT_GIVEN_BY_USER) )
...@@ -137,15 +144,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR ...@@ -137,15 +144,15 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR
if(FXT_DIR) if(FXT_DIR)
set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND")
find_path(FXT_fxt.h_DIRS find_path(FXT_fxt.h_DIRS
NAMES fxt.h NAMES fxt.h
HINTS ${FXT_DIR} HINTS ${FXT_DIR}
PATH_SUFFIXES "include" "include/fxt") PATH_SUFFIXES "include" "include/fxt")
else() else()
set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND") set(FXT_fxt.h_DIRS "FXT_fxt.h_DIRS-NOTFOUND")
find_path(FXT_fxt.h_DIRS find_path(FXT_fxt.h_DIRS
NAMES fxt.h NAMES fxt.h
HINTS ${_inc_env} HINTS ${_inc_env}
PATH_SUFFIXES "fxt") PATH_SUFFIXES "fxt")
endif() endif()
endif() endif()
mark_as_advanced(FXT_fxt.h_DIRS) mark_as_advanced(FXT_fxt.h_DIRS)
...@@ -183,9 +190,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR ...@@ -183,9 +190,9 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR
string(REPLACE ":" ";" _lib_env "$ENV{LIB}") string(REPLACE ":" ";" _lib_env "$ENV{LIB}")
else() else()
if(APPLE) if(APPLE)
string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}") string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")
else() else()
string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}") string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")
endif() endif()
list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
...@@ -206,14 +213,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR ...@@ -206,14 +213,14 @@ if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT FXT_FOUND) OR
if(FXT_DIR) if(FXT_DIR)
set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND") set(FXT_fxt_LIBRARY "FXT_fxt_LIBRARY-NOTFOUND")
find_library(FXT_fxt_LIBRARY find_library(FXT_fxt_LIBRARY
NAMES fxt