Commit 36bc62de authored by Florent Pruvost's avatar Florent Pruvost

add MORSE modules and use it in the main CMakeLists.txt

parent 7c153db4
This diff is collapsed.
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file AuxilaryFlags.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 0.9.0
# @author Xavier Lacoste
# @date 30-01-2015
#
# Define auxilary variables:
# - CMAKE_Fortran_PREPROCESS_FLAGS : force C preprocessor.
# - CMAKE_Fortran_FREEFORM_FLAG : Force free format.
###
IF(CMAKE_Fortran_COMPILER_ID MATCHES GNU)
list(APPEND CMAKE_Fortran_FLAGS "-cpp -ffree-form")
ELSEIF(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
list(APPEND CMAKE_Fortran_PREPROCESS_FLAG "-fpp")
ENDIF()
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file ColorizeMessage.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 0.9.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @date 13-07-2012
#
###
# Set some colors
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(ColourBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
endif()
# Colorize cmake messages during configure
function(message)
list(GET ARGV 0 MessageType)
if(MessageType STREQUAL FATAL_ERROR OR MessageType STREQUAL SEND_ERROR)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldRed}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL WARNING)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldYellow}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL AUTHOR_WARNING)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${BoldCyan}${ARGV_STR}${ColourReset}")
elseif(MessageType STREQUAL STATUS)
list(REMOVE_AT ARGV 0)
string (REPLACE ";" " " ARGV_STR "${ARGV}")
_message(${MessageType} "${Green}${ARGV_STR}${ColourReset}")
else()
string (REPLACE ";" " " ARGV_STR "${ARGV}")
string (REPLACE "${Esc}[1 " "${Esc}[1;" ARGV_STR "${ARGV_STR}")
_message("${ARGV_STR}")
endif()
endfunction()
##
## @end file ColorizeMessage.cmake
##
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file FindHeadersAndLibs.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 0.9.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @date 13-07-2012
#
###
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
function(FindHeader _libname _header_to_find)
# save _libname upper and lower case
string(TOUPPER ${_libname} LIBNAME)
string(TOLOWER ${_libname} libname)
# Looking for include
# -------------------
# Add system include paths to search include
# ------------------------------------------
unset(_inc_env)
if(WIN32)
string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")
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}")
endif()
list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")
list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")
list(REMOVE_DUPLICATES _inc_env)
# Try to find the _header_to_find in the given paths
# --------------------------------------------------
# call cmake macro to find the header path
if(${LIBNAME}_INCDIR)
set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND")
find_path(${LIBNAME}_${_header_to_find}_DIRS
NAMES ${_header_to_find}
HINTS ${${LIBNAME}_INCDIR})
elseif(${LIBNAME}_DIR)
set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND")
find_path(${LIBNAME}_${_header_to_find}_DIRS
NAMES ${_header_to_find}
HINTS ${${LIBNAME}_DIR}
PATH_SUFFIXES include)
else()
set(${LIBNAME}_${_header_to_find}_DIRS "${LIBNAME}_${_header_to_find}_DIRS-NOTFOUND")
find_path(${LIBNAME}_${_header_to_find}_DIRS
NAMES ${_header_to_find}
HINTS ${_inc_env})
endif()
mark_as_advanced(${LIBNAME}_${_header_to_find}_DIRS)
# Print status if not found
# -------------------------
if (NOT ${LIBNAME}_${_header_to_find}_DIRS)
Print_Find_Header_Status(${libname} ${_header_to_find})
endif ()
endfunction(FindHeader)
##
## @end file FindHeadersAndLibs.cmake
##
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file MorseInit.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 0.9.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @author Florent Pruvost
# @date 13-07-2012
#
###
# This include is required to check symbols of libs in the main CMakeLists.txt
include(CheckFunctionExists)
# To colorize messages
include(ColorizeMessage)
# To find headers and libs
include(FindHeadersAndLibs)
# Some macros to print status when search for headers and libs
# PrintFindStatus.cmake is in cmake_modules/morse/find directory
include(PrintFindStatus)
# Define some auxilary flags
include(AuxilaryFlags)
# Add the path where we handle our FindFOO.cmake to seek for liraries
list(APPEND CMAKE_MODULE_PATH ${MORSE_CMAKE_MODULE_PATH}/find)
option(MORSE_VERBOSE_FIND_PACKAGE "Add additional messages concerning no found packages" OFF)
#message("-- ${BoldGreen}MORSE_VERBOSE_FIND_PACKAGE is set to OFF, turn it ON to get"
# "information about packages not found${ColourReset}")
##
## @end file MorseInit.cmake
##
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file ParseArguments.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 0.9.0
# @author Cedric Castagnede
# @author Emmanuel Agullo
# @author Mathieu Faverge
# @date 13-07-2012
#
###
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
set(DEFAULT_ARGS)
foreach(arg_name ${arg_names})
set(${prefix}_${arg_name})
endforeach(arg_name)
foreach(option ${option_names})
set(${prefix}_${option} FALSE)
endforeach(option)
set(current_arg_name DEFAULT_ARGS)
set(current_arg_list)
foreach(arg ${ARGN})
set(larg_names ${arg_names})
list(FIND larg_names "${arg}" is_arg_name)
if(is_arg_name GREATER -1)
set(${prefix}_${current_arg_name} ${current_arg_list})
set(current_arg_name ${arg})
set(current_arg_list)
else(is_arg_name GREATER -1)
set(loption_names ${option_names})
list(FIND loption_names "${arg}" is_option)
if(is_option GREATER -1)
set(${prefix}_${arg} TRUE)
else(is_option GREATER -1)
set(current_arg_list ${current_arg_list} ${arg})
endif(is_option GREATER -1)
endif(is_arg_name GREATER -1)
endforeach(arg)
set(${prefix}_${current_arg_name} ${current_arg_list})
ENDMACRO(PARSE_ARGUMENTS)
MACRO(CAR var)
set(${var} ${ARGV1})
ENDMACRO(CAR)
MACRO(CDR var junk)
set(${var} ${ARGN})
ENDMACRO(CDR)
##
## @end file ParseArguments.cmake
##
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# - Some macros to print status when search for headers and libs
# Main parameters of macros
# _libname: name of the lib you seek, foo for example
# _header_to_find: name of the header you seek, foo.h for example
# _lib_to_find: name of the library you seek, libfoo for example
# _pc_to_find: name of the pkg-config file zyou seek, foo.pc for example
#=============================================================================
# Copyright 2012-2013 Inria
# Copyright 2012-2013 Emmanuel Agullo
# Copyright 2012-2013 Mathieu Faverge
# Copyright 2012 Cedric Castagnede
# Copyright 2013 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.)
# Set some colors
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(ColourBold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Yellow "${Esc}[33m")
set(Blue "${Esc}[34m")
set(Magenta "${Esc}[35m")
set(Cyan "${Esc}[36m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldYellow "${Esc}[1;33m")
set(BoldBlue "${Esc}[1;34m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldCyan "${Esc}[1;36m")
set(BoldWhite "${Esc}[1;37m")
endif()
# This macro informs why the _header_to_find file has not been found
macro(Print_Find_Header_Status _libname _header_to_find)
# save _libname upper and lower case
string(TOUPPER ${_libname} LIBNAME)
string(TOLOWER ${_libname} libname)
# print status
#message(" ")
if(${LIBNAME}_INCDIR)
message("${Blue}${LIBNAME}_INCDIR is defined but ${_header_to_find}"
"has not been found in ${${LIBNAME}_INCDIR}${ColourReset}")
else()
if(${LIBNAME}_DIR)
message("${Blue}${LIBNAME}_DIR is defined but"
"${_header_to_find} has not been found in"
"${${LIBNAME}_DIR}/include${ColourReset}")
else()
message("${Blue}${_header_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_INCDIR"
"are defined so that we looked for ${_header_to_find} in"
"system paths (INCLUDE, CPATH, C_INCLUDE_PATH,"
"INCLUDE_PATH, CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES"
", CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)${ColourReset}")
if(_inc_env)
message("${Blue}${_header_to_find} has not been found in"
"${_inc_env}${ColourReset}")
endif()
endif()
endif()
message("${BoldBlue}Please indicate where to find ${_header_to_find}. You have three options:\n"
"- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
"- Option 2: Provide the directory where to find the headers with cmake option: -D${LIBNAME}_INCDIR=your/path/to/${libname}/include/\n"
"- Option 3: Update your environment variable (INCLUDE or CPATH)\n"
"- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
#message(" ")
endmacro()
# This macro informs why the _lib_to_find file has not been found
macro(Print_Find_Library_Status _libname _lib_to_find)
# save _libname upper/lower case
string(TOUPPER ${_libname} LIBNAME)
string(TOLOWER ${_libname} libname)
# print status
#message(" ")
if(${LIBNAME}_LIBDIR)
message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"
"has not been found in ${${LIBNAME}_LIBDIR}${ColourReset}")
else()
if(${LIBNAME}_DIR)
message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
"has not been found in ${${LIBNAME}_DIR}/lib(or /lib32 or"
"/lib64)${ColourReset}")
else()
message("${Yellow}${_lib_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we looked for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
if(_lib_env)
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
endif()
endif()
endif()
message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
"- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
"- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
endmacro()
# This macro informs why the _lib_to_find file has not been found
macro(Print_Find_Library_Blas_Status _libname _lib_to_find)
# save _libname upper/lower case
string(TOUPPER ${_libname} LIBNAME)
string(TOLOWER ${_libname} libname)
# print status
#message(" ")
if(${LIBNAME}_LIBDIR)
message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
else()
if(${LIBNAME}_DIR)
message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"
"has not been found in ${ARGN}${ColourReset}")
else()
message("${Yellow}${_lib_to_find} not found."
"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"
"are defined so that we look for ${_lib_to_find} in"
"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"
"Mac: DYLD_LIBRARY_PATH,"
"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"
"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")
if(_lib_env)
message("${Yellow}${_lib_to_find} has not been found in"
"${_lib_env}${ColourReset}")
endif()
endif()
endif()
message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"
"- Option 1: Provide the root directory of the library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"
"- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"
"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"
"- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")
endmacro()
# This macro informs why the _lib_to_find file has not been found
macro(Print_Find_Library_Blas_CheckFunc_Status _name)
# save _libname upper/lower case
string(TOUPPER ${_name} FUNCNAME)
string(TOLOWER ${_name} funcname)
# print status
#message(" ")
message("${Red}Libs have been found but check of symbol ${_name} failed "
"with following libraries ${ARGN}${ColourReset}")
message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log"
"to figure out why it fails${ColourReset}")
#message(" ")
endmacro()
# This macro informs that _pc_to_find file has not been found in the list
# path you give as last argument (read in ${ARGN})
# ex: Print_Find_Pkgconfig_Status(foo foo.pc ${PATHLIST}
macro(Print_Find_Pkgconfig_Status _libname _pc_to_find)
# save _libname lower case
string(TOLOWER ${_libname} libname)
# print status
#message(" ")
message("${Magenta}${_pc_to_find} has not been found in"
"${ARGN}${ColourReset}")
message("${BoldMagenta}If you really want to use the pkg-config file of"
"${libname}, please update your PKG_CONFIG_PATH with the path"
"where ${_pc_to_find} states${ColourReset}")
#message(" ")
endmacro()
###
#
# @copyright (c) 2009-2014 The University of Tennessee and The University
# of Tennessee Research Foundation.
# All rights reserved.
# @copyright (c) 2012-2014 Inria. All rights reserved.
# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.
#
###
#
# @file RulesPrecisions.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 0.9.0
# @author Thomas Herault
# @author George Bosilca
# @author Aurelien Bouteiller
# @author Mathieu Faverge
# @author Florent Puvost
# @date 13-07-2012
#
###
cmake_minimum_required(VERSION 2.8)
include(CMakeDependentOption)
set(RP_GENDEPENDENCIES ${MORSE_CMAKE_MODULE_PATH}/precision_generator/genDependencies.py)
set(RP_CODEGEN ${MORSE_CMAKE_MODULE_PATH}/precision_generator/codegen.py)
# Dictionnary
# -----------
if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_DICTIONNARY )
message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_DICTIONNARY was defined (Default is used)" )
set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${MORSE_CMAKE_MODULE_PATH}/precision_generator/subs.py
CACHE INTERNAL "Dictionnary used for precision generation" )
else()
set(RP_${CMAKE_PROJECT_NAME}_DICTIONNARY ${RP_${CMAKE_PROJECT_NAME}_DICTIONNARY}
CACHE INTERNAL "Dictionnary used for precision generation" )
endif()
# Default Precisions
# ------------------
if( NOT DEFINED RP_${CMAKE_PROJECT_NAME}_PRECISIONS )
message( WARNING "RulesPrecisions included before RP_${CMAKE_PROJECT_NAME}_PRECISIONS was defined (\"s;d;c;z\" is used)" )
set(RP_${CMAKE_PROJECT_NAME}_PRECISIONS "s;d;c;z"
CACHE INTERNAL "Set of available precisions for the project" )
else()
set(RP_${CMAKE_PROJECT_NAME}_PRECISIONS ${RP_${CMAKE_PROJECT_NAME}_PRECISIONS}
CACHE INTERNAL "Set of available precisions for the project" )
endif()
# Detect if compilation is done in or out of place
# ------------------------------------------------
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" __inplace)
set( ${CMAKE_PROJECT_NAME}_COMPILE_INPLACE ${__inplace}
CACHE INTERNAL "Defines if the project compilation is made inplace or not" )
# Detect default settings
# -----------------------
set( _prec_S OFF )
set( _prec_D OFF )
set( _prec_DS OFF )
set( _prec_C OFF )
set( _prec_Z OFF )
set( _prec_ZC OFF )
foreach(_prec ${RP_${CMAKE_PROJECT_NAME}_PRECISIONS})
if ( ${_prec} STREQUAL "zc" )
set( _prec_S ON )
set( _prec_D ON )
set( _prec_C ON )
set( _prec_Z ON )
set( _prec_ZC ON )
elseif( ${_prec} STREQUAL "z" )
set( _prec_D ON )
set( _prec_Z ON )
elseif( ${_prec} STREQUAL "c" )
set( _prec_S ON )
set( _prec_C ON )
elseif( ${_prec} STREQUAL "ds" )
set( _prec_S ON )
set( _prec_D ON )
set( _prec_DS ON )
elseif( ${_prec} STREQUAL "d" )
set( _prec_S ON )
elseif( ${_prec} STREQUAL "s" )
set( _prec_S ON )
endif()
endforeach()
# set computed precisions
# -----------------------
if( ${_prec_S} )
option(${PROJECT_NAME}_PREC_S
"Build ${PROJECT_NAME} real single precision" ON)
endif()
if( ${_prec_D} )
option(${PROJECT_NAME}_PREC_D
"Build ${PROJECT_NAME} real double precision" ON)
endif()
if( ${_prec_C} )
cmake_dependent_option(${PROJECT_NAME}_PREC_C
"Build ${PROJECT_NAME} complex single precision" ON "${PROJECT_NAME}_PREC_S" OFF)
endif()
if( ${_prec_Z} )
cmake_dependent_option(${PROJECT_NAME}_PREC_Z
"Build ${PROJECT_NAME} complex double precision" ON "${PROJECT_NAME}_PREC_D" OFF)
endif()
if( ${_prec_DS} )
cmake_dependent_option(${PROJECT_NAME}_PREC_DS
"Build ${PROJECT_NAME} real mixed precision" ON "${PROJECT_NAME}_PREC_S;${PROJECT_NAME}_PREC_D" OFF)
endif()
if( ${_prec_ZC} )
cmake_dependent_option(${PROJECT_NAME}_PREC_ZC
"Build ${PROJECT_NAME} complex mixed precision" ON "${PROJECT_NAME}_PREC_C;${PROJECT_NAME}_PREC_Z" OFF)
endif()
# Define precision supported by the project
# -----------------------------------------
set( ${CMAKE_PROJECT_NAME}_PRECISION "" )
if(${CMAKE_PROJECT_NAME}_PREC_S)
list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "s")
endif()
if(${CMAKE_PROJECT_NAME}_PREC_D)
list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "d")
endif()
if(${CMAKE_PROJECT_NAME}_PREC_DS)
list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "ds")
endif()
if(${CMAKE_PROJECT_NAME}_PREC_C)
list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "c")
endif()
if(${CMAKE_PROJECT_NAME}_PREC_Z)
list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "z")
endif()
if(${CMAKE_PROJECT_NAME}_PREC_ZC)
list(APPEND ${CMAKE_PROJECT_NAME}_PRECISION "zc")
endif()
</