Commit 17158493 authored by ESTERIE Pierre's avatar ESTERIE Pierre

Merge branch 'cmake-refurb' into 'develop'

Merge cmake-refurb in develop

See merge request solverstack/ScalFMM!16
parents bfe02cab 7fd4f82d
image: hpclib/hiepacs
before_script:
- source /usr/share/modules/init/bash && source /usr/local/share/spack/setup-env.sh && spack load cmake@3.14.2
variables:
GIT_SUBMODULE_STRATEGY: normal
stages:
- build
- pages
- test
- sonar
......@@ -19,8 +23,8 @@ build:
- cd Build && cmake ..
-DSCALFMM_USE_LOG=ON
-DSCALFMM_USE_ASSERT=ON
-DSCALFMM_USE_SSE=OFF
-DSCALFMM_USE_AVX=OFF
-DINASTEMP_USE_AVX2=OFF
-DINASTEMP_USE_AVX=OFF
-DSCALFMM_USE_BLAS=ON
-DSCALFMM_USE_FFT=ON
-DSCALFMM_USE_MPI=ON
......@@ -29,8 +33,8 @@ build:
-DSCALFMM_BUILD_TESTS=ON
-DSCALFMM_BUILD_UTESTS=ON
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_C_COMPILER=gcc-6
-DCMAKE_CXX_COMPILER=g++-6
-DCMAKE_C_COMPILER=gcc-7
-DCMAKE_CXX_COMPILER=g++-7
- make -j5 2>&1 |tee scalfmm-build.log
doc:
......@@ -43,9 +47,22 @@ doc:
script:
- cd Build && cmake ..
-DSCALFMM_BUILD_DOC=ON
-DCMAKE_C_COMPILER=gcc-6
-DCMAKE_CXX_COMPILER=g++-6
- make doc
-DCMAKE_C_COMPILER=gcc-7
-DCMAKE_CXX_COMPILER=g++-7
- make doc
pages:
stage: pages
dependencies:
- doc
artifacts:
paths:
- public
script:
- mkdir public
- mv Build/Doc/html/* public/
only:
- cmake-refurb
test:
stage: test
......@@ -78,4 +95,4 @@ sonar:
- source ./Utils/scripts/analysis.sh
- sonar-scanner |tee sonar.log;
only:
- develop@solverstack/ScalFMM
\ No newline at end of file
- develop@solverstack/ScalFMM
cmake_minimum_required (VERSION 2.8.3 FATAL_ERROR)
cmake_minimum_required (VERSION 3.10.0 FATAL_ERROR)
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 7 AND CMAKE_PATCH_VERSION GREATER 11)
cmake_policy(SET CMP0022 OLD)
endif()
cmake_policy(SET CMP0004 NEW)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
#===========================================================================
#
# Project Declaration
#===========================================================================
project(SCALFMM C CXX )
#--------------------
project(scalfmm CXX)
# check if compiling into source directories
string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" insource)
if(insource)
message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build. Goto ./Build and tapes cmake ../")
endif(insource)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/)
SET(SCALFMM_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/)
#
# Adds the CMAKE_DEPENDENT_OPTION command
INCLUDE(CMakeDependentOption)
#===========================================================================
# Version Number
#===========================================================================
# --------------
# SCALFMM version number. An even minor number corresponds to releases.
set(SCALFMM_MAJOR_VERSION 2)
set(SCALFMM_MINOR_VERSION 0)
set(SCALFMM_PATCH_VERSION rc0)
set(SCALFMM_VERSION "${SCALFMM_MAJOR_VERSION}.${SCALFMM_MINOR_VERSION}.${SCALFMM_PATCH_VERSION}" )
set(${CMAKE_PROJECT_NAME}_MAJOR_VERSION 2)
set(${CMAKE_PROJECT_NAME}_MINOR_VERSION 0)
set(${CMAKE_PROJECT_NAME}_PATCH_VERSION rc0)
set(${CMAKE_PROJECT_NAME}_VERSION "${${CMAKE_PROJECT_NAME}_MAJOR_VERSION}.${${CMAKE_PROJECT_NAME}_MINOR_VERSION}.${${CMAKE_PROJECT_NAME}_PATCH_VERSION}" )
SET(CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_STANDARD 14)
#
# Set global c++ support
# ----------------------
set(CMAKE_CXX_STANDARD 14)
set( MORSE_DISTRIB_DIR "" CACHE PATH "Directory of MORSE distribution")
#
# Update cmake path
# -----------------
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/)
if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake")
#
# Creating main lib
# -----------------
list(APPEND SCALFMM_SOURCES FAlgorithmTimers.cpp FLog.cpp FMemStats.cpp FSignalHandler.cpp)
list(TRANSFORM SCALFMM_SOURCES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/src/")
add_library(${CMAKE_PROJECT_NAME} STATIC ${SCALFMM_SOURCES})
# Set library includes
# --------------------
target_include_directories(${CMAKE_PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${${CMAKE_PROJECT_NAME}_BINARY_DIR}/include>
$<BUILD_INTERFACE:${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake")
# Add extra cmake module path and initialize morse cmake modules
# --------------------------------------------------------------
......@@ -48,8 +55,12 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake/modules)
set(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake/modules )
endif()
include(MorseInit)
# Set the RPATH config
# These options allow all installed executables to run correctly
# when installed to the install diretory
# --------------------
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)
......@@ -58,289 +69,192 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
# the RPATH to be used when installing
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Build ScalFmm as static or dynamic lib
# --------------------------------------
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
#
# Options
#
option( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" OFF )
option( SCALFMM_USE_BLAS "Set to ON to build ScaFMM with BLAS" ON )
option( SCALFMM_USE_FFT "Set to ON to build ScaFMM with FFTW" ON )
option( SCALFMM_BUILD_EXAMPLES "Set to ON to compile examples " ON )
option( SCALFMM_BUILD_TESTS "Set to ON to build functionalities Tests" OFF )
option( SCALFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
option( SCALFMM_INSTALL_DATA "Set to ON to include the data when proceeding to the installtion " OFF )
# Cmake options for dependencies
option( SCALFMM_USE_MPI "Set to ON to build ScaFMM with MPI" OFF )
option( SCALFMM_USE_BLAS "Set to ON to build ScaFMM with BLAS" ON )
option( SCALFMM_USE_FFT "Set to ON to build ScaFMM with FFTW" OFF )
option( SCALFMM_USE_STARPU "Set to ON to build SCALFMM with StarPU" OFF )
# Cmake options that impact the build tree
option( SCALFMM_BUILD_EXAMPLES "Set to ON to compile examples " ON )
option( SCALFMM_BUILD_TESTS "Set to ON to build functionalities Tests" OFF )
option( SCALFMM_BUILD_UTESTS "Set to ON to build UTests" OFF )
option( SCALFMM_BUILD_UTILS "Set to ON to build utils Tests" OFF )
option( SCALFMM_BUILD_DOC "Set to ON to build the Doxygen documentation " OFF )
option( SCALFMM_BUILD_DEBUG "Set to ON to build in Debug" OFF )
# Cmake options to install additional content
option( SCALFMM_INSTALL_DATA "Set to ON to include the data when proceeding to the installtion " OFF )
# Cmake options related to trace, logging and statistics
option( SCALFMM_USE_LOG "Set to ON to print output debug information" OFF )
option( SCALFMM_USE_MEM_STATS "Set to ON to profile memory" OFF )
option( SCALFMM_ATTACHE_SOURCE "Set to ON to compile with -g" OFF )
option( SCALFMM_USE_ADDONS "Set to ON to compile add ons" OFF )
option( SCALFMM_USE_SIGNALS "Set to ON to catch various signal an print backtrace" OFF )
option( SCALFMM_USE_ASSERT "Set to ON to enable safe tests during execution" ON )
option( SCALFMM_USE_MIC_NATIVE "Set to ON to compile in native mode for MIC" OFF )
option( SCALFMM_ONLY_DEVEL "Set to ON to compile Development tools (only scalfmm team)" OFF )
option( SCALFMM_USE_EZTRACE "Set to ON to compile with eztrace framwork" OFF )
option( SCALFMM_USE_STARPU "Set to ON to build SCALFMM with StarPU" OFF )
option( SCALFMM_BUILD_UTILS "Set to ON to build utils Tests" OFF )
# Cmake options related to the targeted architecture
option( SCALFMM_USE_MIC_NATIVE "Set to ON to compile in native mode for MIC" OFF )
if( SCALFMM_ONLY_DEVEL )
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" OFF )
else()
option( SCALFMM_USE_OMP4 "Set to ON to disable the gcc/intel omp4" ON )
endif()
option( SCALFMM_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF )
# SIMGRID and peformance models options
option( SCALFMM_SIMGRID_NODATA "Set to ON to avoid the allocation of numerical parts in the group tree" OFF )
option( STARPU_SIMGRID_MLR_MODELS "Set to ON to enable MLR models need for calibration and simulation" OFF )
# OPENMP 4/5 support
message(WARNING "OpenMP_VERSION: ${OpenMP_VERSION}")
option( OPENMP_SUPPORT_PRIORITY "Set to ON to enable tasks priority (OMP4.x/KSTAR/StarPU compiler only)" OFF )
# STARPU options
CMAKE_DEPENDENT_OPTION(OPENMP_SUPPORT_COMMUTE "Set to ON to let tasks commute (KSTAR/StarPU compiler only)" OFF
"SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(OPENMP_SUPPORT_TASK_NAME "Set to ON to enable a taskname clause for tasks (KSTAR/StarPU compiler only)" OFF
"SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "SCALFMM_USE_STARPU" OFF)
CMAKE_DEPENDENT_OPTION(SCALFMM_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "SCALFMM_USE_STARPU" OFF)
endif()
message(STATUS "AVANT ${CMAKE_CXX_COMPILER_ID}" )
#
# MPI
#
if( SCALFMM_USE_MPI )
try_compile(COMPILE_INTEL ${CMAKE_CURRENT_BINARY_DIR}
${SCALFMM_CMAKE_MODULE_PATH}/compileTestIntel.cpp
COMPILE_DEFINITIONS "${CMAKE_CXX_FLAGS}")
if (COMPILE_INTEL)
set(CMAKE_CXX_COMPILER_ID "Intel")
endif()
endif()
message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" )
# Set scalfmm to default libraries
set(SCALFMM_LIBRARIES "")
set(SCALFMM_CXX_FLAGS "-fpic -Wall")
# set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/Contribs")
#
#
# Test if openmp is here
#
find_package (OpenMP)
if(OPENMP_FOUND)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else(OPENMP_FOUND)
message(WARNING "OPENMP NOT FOUND")
endif(OPENMP_FOUND)
message(STATUS "SCALFMM_BUILD_DEBUG = ${SCALFMM_BUILD_DEBUG}" )
#
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -m64")
endif()
##############################################################################
# Inastemp #
##############################################################################
set(INASTEMP_JUST_LIB TRUE)
set(INASTEMP_DO_INSTALL TRUE)
# add the cmakelist directory
add_subdirectory(inastemp)
# use the filled variables from inastemp
INCLUDE_DIRECTORIES(
${INASTEMP_BINARY_DIR}/Src
${INASTEMP_SOURCE_DIR}/Src
${INASTEMP_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/inastemp/Src
)
# propagate the flags to be able to compile
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${INASTEMP_CXX_FLAGS}")
##############################################################################
# FUSE list #
##############################################################################
set(FUSE_LIST "")
#set(FUSE_LIST " MPI;BLAS;FFT;STARPU;CUDA;OPENCL;OMP4;SSE;AVX;AVX2;MIC;MPI2")
# then do list(APPEND FUSE_LIST "BLAS") to protect from FUSE_BLAS
# list(APPEND FUSE_LIST "MPI")
##############################################################################
# Debug flags #
##############################################################################
# Set scalfmm global lists
# ------------------------
list(APPEND SCALFMM_CXX_FLAGS -fpic -Wall)
# TODO: Find new way to resolve dependencies...
# Set FUSE LIST
# -------------
set(FUSE_LIST "") # Construct during configure
set(FUSE_DEP_AVAILABLE "MPI;CUDA;STARPU;OMP4;BLAS;FFT;OPENCL") # List to compare against when compiling tests, etc...
#
if( SCALFMM_BUILD_DEBUG )
#
# Compile Debug flags
#
set(CMAKE_BUILD_TYPE Debug)
ADD_DEFINITIONS(-O0)
if( APPLE )
set(SCALFMM_FLAGS_OPTI_DEBUG "-funroll-loops" CACHE STRING
"Set your optimization flags for debug mode.")
else(APPLE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(SCALFMM_FLAGS_OPTI_DEBUG "-fp-model strict -funroll-loops" CACHE STRING
"Set your optimization flags for debug mode.")
else()
set(SCALFMM_FLAGS_OPTI_DEBUG "-funroll-loops" CACHE STRING
"Set your optimization flags for debug mode.")
# OpenMP
# ------
if(NOT OpenMP_CXX_FOUND)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC OpenMP::OpenMP_CXX)
list(APPEND SCALFMM_LIBRARIES OpenMP)
if(OpenMP_CXX_VERSION_MAJOR GREATER_EQUAL 4)
list(APPEND FUSE_LIST OMP4)
endif()
endif(APPLE)
# ADD_DEFINITIONS(${SCALFMM_FLAGS_OPTI_DEBUG})
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} ${SCALFMM_FLAGS_OPTI_DEBUG}")
set(CMAKE_CXX_FLAGS_TYPE "${CMAKE_CXX_FLAGS_DEBUG}")
else(OpenMP_CXX_FOUND)
message(WARNING "OPENMP NOT FOUND")
endif(OpenMP_CXX_FOUND)
endif(NOT OpenMP_CXX_FOUND)
#
# Inastemp
# --------
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inastemp")
# Set option() CMP0077 to old for inastemp...
set(CMAKE_POLICY_DEFAULT_CMP0077 OLD)
set(INASTEMP_JUST_LIB TRUE)
set(INASTEMP_DO_INSTALL TRUE)
# Create target
add_subdirectory(inastemp)
add_library(inastemp INTERFACE)
target_include_directories(inastemp INTERFACE
$<BUILD_INTERFACE:${INASTEMP_SOURCE_DIR}/Src>
$<BUILD_INTERFACE:${INASTEMP_BINARY_DIR}/Src>
$<INSTALL_INTERFACE:include>
)
string(REPLACE " -" ";-" INASTEMP_FLAGS "${INASTEMP_CXX_FLAGS}")
list(REMOVE_DUPLICATES INASTEMP_FLAGS)
target_compile_options(inastemp INTERFACE ${INASTEMP_FLAGS})
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC inastemp)
message(STATUS "Inastemp flags : ${INASTEMP_FLAGS}")
message(WARNING "Inastemp configures compile flags according to the current architure "
"you are compiling on. If you target a different machine, be carefull "
"with the available SIMD instruction set supported."
"Thus, use INASTEMP_USE_XXX to target the correct instruction set.")
else()
##############################################################################
# Release flags #
##############################################################################
else(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inastemp")
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_TYPE "${CMAKE_CXX_FLAGS_RELEASE}")
# if compiler is intel add -ip
message(STATUS "Inastemp is not available.")
message(STATUS "Please, initialize all git submodule.")
message(FATAL_ERROR "Exit : Inastemp dependency not found.")
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/inastemp")
#
# Specific Debug flags
# --------------------
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND SCALFMM_CXX_FLAGS -funroll-loops)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -ipo -fstrict-aliasing ")# -no-prec-div -no-prec-sqrt")
list(APPEND SCALFMM_CXX_FLAGS -fp-model\ strict)
endif()
# Compile optimization
if(APPLE)
set(SCALFMM_FLAGS_OPTI_RELEASE "-funroll-loops" CACHE STRING
"Set your optimization flags for release mode.")
else(APPLE)
# Not apple system - Check the compiler flags
endif()
#
# Specific Release flags
# ----------------------
if(CMAKE_BUILD_TYPE STREQUAL "Release")
list(APPEND SCALFMM_CXX_FLAGS -funroll-loops)
if(NOT APPLE)
list(APPEND -ftree-vectorize)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
#set(SCALFMM_FLAGS_OPTI_RELEASE "-fp-model precise -fp-model source -fimf-precision=low -funroll-loops -ftree-vectorize"
set(SCALFMM_FLAGS_OPTI_RELEASE "-funroll-loops -ftree-vectorize"
CACHE STRING "Set your optimization flags for release mode.")
# set(SCALFMM_FLAGS_OPTI_RELEASE "-funroll-loops -ftree-vectorize" CACHE STRING
# "Set your optimization flags for release mode.")
else()
set(SCALFMM_FLAGS_OPTI_RELEASE "-ffast-math -funroll-loops -ftree-vectorize" CACHE STRING
"Set your optimization flags for release mode.")
list(APPEND SCALFMM_CXX_FLAGS -ipo -fstrict-aliasing)
endif()
endif(APPLE)
#
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} ${SCALFMM_FLAGS_OPTI_RELEASE}")
list(APPEND SCALFMM_CXX_FLAGS -ffast-math -ftree-vectorize)
endif(NOT APPLE)
endif()
MESSAGE(STATUS " %%%%%%%%%% SCALFMM_CXX_FLAGS ${SCALFMM_CXX_FLAGS} %%%%%%%%%%%%%")
MESSAGE(STATUS " %%%%%%%%%% CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE} %%%%%%%%%%%%%")
#
##############################################################################
# Attach source code to exec #
##############################################################################
message(STATUS "SCALFMM_ATTACHE_SOURCE = ${SCALFMM_ATTACHE_SOURCE}" )
if( SCALFMM_ATTACHE_SOURCE )
message(STATUS "Option -g is used, the code is attached to the binary." )
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} -g")
endif(SCALFMM_ATTACHE_SOURCE)
#
##############################################################################
# find MPI #
##############################################################################
#
if( SCALFMM_USE_MPI )
find_package(MPI REQUIRED)
if(MPI_FOUND)
if (MPI_CXX_FOUND)
# message("MPI_CXX is in the place")
if (MPI_CXX_INCLUDE_PATH)
include_directories( ${MPI_CXX_INCLUDE_PATH} )
endif()
if (MPI_CXX_COMPILE_FLAGS)
string(REPLACE ";" " " MPI_CXX_COMPILE_FLAGS "${MPI_CXX_COMPILE_FLAGS}")
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS} ${MPI_CXX_COMPILE_FLAGS}")
endif()
if (MPI_CXX_INCLUDE_PATH)
LIST(APPEND SCALFMM_INCLUDES "${SCALFMM_INCLUDES};${MPI_CXX_INCLUDE_PATH}")
endif()
if (MPI_CXX_LINK_FLAGS)
list(APPEND "CMAKE_EXE_LINKER_FLAGS ${MPI_CXX_LINK_FLAGS}")
endif()
if (MPI_CXX_LIBRARIES)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${MPI_CXX_LIBRARIES}")
endif()
else (MPI_CXX_FOUND)
# MPI
# ---
if(SCALFMM_USE_MPI)
if(NOT MPI_FOUND)
try_compile(COMPILE_INTEL ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/compileTestIntel.cpp
COMPILE_DEFINITIONS "${CMAKE_CXX_FLAGS}")
if(COMPILE_INTEL)
set(CMAKE_CXX_COMPILER_ID "Intel")
endif()
message(STATUS "CXX ${CMAKE_CXX_COMPILER_ID}" )
find_package(MPI REQUIRED)
if(MPI_CXX_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC MPI::MPI_CXX)
list(APPEND SCALFMM_LIBRARIES MPI)
list(APPEND FUSE_LIST MPI)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/FMpi.cpp)
else(MPI_CXX_FOUND)
message(FATAL_ERROR "MPI_CXX is required but was not found. "
"Please provide an MPI compiler in your environment."
"Note that you can give the path to your MPI installation "
"by setting MPI_DIR cmake variable.")
endif (MPI_CXX_FOUND)
else(MPI_FOUND)
endif(MPI_FOUND)
endif( SCALFMM_USE_MPI)
list(APPEND FUSE_LIST "MPI")
#
##############################################################################
# Blas option #
##############################################################################
"Please provide an MPI compiler in your environment."
"Note that you can give the path to your MPI installation "
"by setting MPI_DIR cmake variable.")
endif(MPI_CXX_FOUND)
endif(NOT MPI_FOUND)
endif(SCALFMM_USE_MPI)
#
if( SCALFMM_USE_BLAS )
# if(APPLE) # In order to use QT-creator on macos
# list(APPEND CMAKE_REQUIRED_INCLUDES $ENV{MKLROOT}/include)
# endif()
# include(FortranCInterface)
# # Define a Fortran interface file (FCMangle.hpp)
# FortranCInterface_HEADER( ${CMAKE_CURRENT_SOURCE_DIR}/Src/FCMangle.hpp
# MACRO_NAMESPACE "PM_"
# SYMBOL_NAMESPACE "PM_"
# SYMBOLS init testPPM:init)
message(STATUS "CMAKE_CXX_COMPILER_ID STREQUAL ${CMAKE_CXX_COMPILER_ID}")
option( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL BLAS/LAPACK" OFF )
option( SCALFMM_USE_ESSL_AS_BLAS "Set to ON to use ESSL BLAS/LAPACK" OFF )
# Blas options
# ------------
if(SCALFMM_USE_BLAS)
option( SCALFMM_USE_MKL_AS_BLAS "Set to ON to use MKL BLAS/LAPACK" OFF )
option( SCALFMM_USE_ESSL_AS_BLAS "Set to ON to use ESSL BLAS/LAPACK" OFF )
option( SCALFMM_USE_EXTERNAL_BLAS "Set to ON to use external BLAS. Please, set BLAS_LIBRARIES variable." OFF )
if( SCALFMM_USE_MKL_AS_BLAS )
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS ) # not REQUIRED
unset(LAPACK_LIBRARIES)
if (BLAS_LIBRARIES)
set(BLASLAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
elseif(SCALFMM_USE_ESSL_AS_BLAS)
set(BLA_VENDOR "IBMESSL")
find_package(BLAS QUIET) # not REQUIRED
find_package(LAPACK QUIET) # not REQUIRED
if (LAPACK_LIBRARIES)
set(BLASLAPACK_LIBRARIES "${LAPACK_LIBRARIES}")
endif()
if (BLAS_LIBRARIES)
list(APPEND BLASLAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
elseif(SCALFMM_USE_EXTERNAL_BLAS)
message(STATUS "BLAS SET BY EXTERNAL PROGRAM = ${BLAS_LIBRARIES}")
list(APPEND BLASLAPACK_LIBRARIES "${BLAS_LIBRARIES}")
else()
find_package(BLAS) # not REQUIRED
find_package(LAPACK) # not REQUIRED
set(BLASLAPACK_LIBRARIES)
if (LAPACK_LIBRARIES)
set(BLASLAPACK_LIBRARIES "${LAPACK_LIBRARIES}")
endif()
if (BLAS_LIBRARIES)
list(APPEND BLASLAPACK_LIBRARIES "${BLAS_LIBRARIES}")
endif()
endif()