Commit d6fcf4d9 authored by ESTERIE Pierre's avatar ESTERIE Pierre
Browse files

First step to new cmake : install ok, tools are independent and moved in...

First step to new cmake : install ok, tools are independent and moved in specific folder and installed in /bin, examples still need work
parent 4d61c4a7
......@@ -2,27 +2,34 @@
#
# Project Declaration
#--------------------
project(scalfmm3 CXX C)
project(scalfmm3 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)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
#
# Version Number
# --------------
# SCALFMM version number. An even minor number corresponds to releases.
# ${CMAKE_PROJECT_NAME} version number. An even minor number corresponds to releases.
set(${CMAKE_PROJECT_NAME}_MAJOR_VERSION 3)
set(${CMAKE_PROJECT_NAME}_MINOR_VERSION 0)
set(${CMAKE_PROJECT_NAME}_PATCH_VERSION 0-pre-alpha)
set(${CMAKE_PROJECT_NAME}_VERSION "${${CMAKE_PROJECT_NAME}_MAJOR_VERSION}.${${CMAKE_PROJECT_NAME}_MINOR_VERSION}.${${CMAKE_PROJECT_NAME}_PATCH_VERSION}" )
#
# Update cmake path with morse
# ----------------------------
include(cmake/morse.cmake)
# Default build type
# ------------------
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE
STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
#
# Creating main lib
......@@ -37,7 +44,6 @@ target_include_directories(${CMAKE_PROJECT_NAME} INTERFACE
$<INSTALL_INTERFACE:include>
)
# Set the RPATH config
# These options allow all installed executables to run correctly
# when installed to the install diretory
......@@ -53,71 +59,65 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
#
# Options for scalfmm
# -------------------
include(cmake/options.cmake)
#
# Flags for scalfmm
# -----------------
include(cmake/flags.cmake)
target_compile_options(${CMAKE_PROJECT_NAME} INTERFACE "${SCALFMM_CXX_FLAGS}")
#
# 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...
#
# Dependencies for the lib
# ------------------------
include(cmake/dependencies.cmake)
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}" CACHE STRING "ScalFMM libraries dependencies")
message(STATUS "ScalFMM dependencies : ${SCALFMM_LIBRARIES}")
# -----------------
target_compile_options(${CMAKE_PROJECT_NAME} INTERFACE "${${CMAKE_PROJECT_NAME}_CXX_FLAGS}")
# -----------------
#
# Set ScalFMM compile definitions
# Set ${CMAKE_PROJECT_NAME} compile definitions
# -------------------------------
set(SCALFMM_COMPILE_DEFINITIONS XSIMD_ENABLE_XTL_COMPLEX ENABLE_XTL_COMPLEX XTENSOR_USE_XSIMD CPP17)
set(SCALFMM_COMPILE_DEFINITIONS "${SCALFMM_COMPILE_DEFINITIONS}" CACHE STRING "Global compile definitions for ScalFMM")
message(STATUS "ScalFMM compile definitions : ${SCALFMM_COMPILE_DEFINITIONS}")
target_compile_definitions(${CMAKE_PROJECT_NAME} INTERFACE "${SCALFMM_COMPILE_DEFINITIONS}")
set(${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS XSIMD_ENABLE_XTL_COMPLEX ENABLE_XTL_COMPLEX XTENSOR_USE_XSIMD CPP17)
set(${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS "${${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS}" CACHE STRING "Global compile definitions for ${CMAKE_PROJECT_NAME}")
message(STATUS "${CMAKE_PROJECT_NAME} compile definitions : ${${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS}")
# -----------------
target_compile_definitions(${CMAKE_PROJECT_NAME} INTERFACE "${${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS}")
# -----------------
#
# Modules required
# ----------------
include(cmake/modules.cmake)
#
# Modules required
# ----------------
include(cmake/analysis.cmake)
#
# DEPRECATED
# Generate ScalFmmConfig.h
# ------------------------
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/scalfmm/config/scalfmm-config.hpp.cmake
${CMAKE_CURRENT_BINARY_DIR}/include/scalfmm/config/scalfmm-config.hpp)
#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/scalfmm/config/scalfmm-config.hpp.cmake
# ${CMAKE_CURRENT_BINARY_DIR}/include/scalfmm/config/scalfmm-config.hpp)
#
# Build Tools
# --------------
option(${CMAKE_PROJECT_NAME}_BUILD_TOOLS "Set to ON to build scalfmm3 tools." ON)
message(STATUS "${CMAKE_PROJECT_NAME}_BUILD_TOOLS = ${${CMAKE_PROJECT_NAME}_BUILD_TOOLS}" )
if( ${CMAKE_PROJECT_NAME}_BUILD_TOOLS )
# Build - Examples and drivers
add_subdirectory(tools)
endif()
#
# Build Examples
# --------------
message(STATUS "SCALFMM_BUILD_EXAMPLES = ${SCALFMM_BUILD_EXAMPLES}" )
if( SCALFMM_BUILD_EXAMPLES )
option(${CMAKE_PROJECT_NAME}_BUILD_EXAMPLES "Set to ON to build scalfmm3 examples." ON)
message(STATUS "${CMAKE_PROJECT_NAME}_BUILD_EXAMPLES = ${${CMAKE_PROJECT_NAME}_BUILD_EXAMPLES}" )
if( ${CMAKE_PROJECT_NAME}_BUILD_EXAMPLES )
# Build - Examples and drivers
add_subdirectory(examples)
#add_subdirectory(examples)
endif()
#
# Build - Unitary and numerical Tests
# -----------------------------------
message( STATUS "SCALFMM_BUILD_UTESTS = ${SCALFMM_BUILD_UTESTS}" )
if( SCALFMM_BUILD_UNITS )
option(${CMAKE_PROJECT_NAME}_BUILD_UNITS "Set to ON to build scalfmm3 unit tests." OFF)
message( STATUS "${CMAKE_PROJECT_NAME}_BUILD_UTESTS = ${${CMAKE_PROJECT_NAME}_BUILD_UTESTS}" )
if( ${CMAKE_PROJECT_NAME}_BUILD_UNITS )
enable_testing()
include(CTest)
add_subdirectory(units)
......@@ -126,8 +126,9 @@ endif()
#
# Add - doc
# ---------
message(STATUS "SCALFMM_BUILD_DOC = ${SCALFMM_BUILD_DOC}" )
if(SCALFMM_BUILD_DOC)
option( ${CMAKE_PROJECT_NAME}_BUILD_DOC "Set to ON to build the documentation" OFF )
message(STATUS "${CMAKE_PROJECT_NAME}_BUILD_DOC = ${${CMAKE_PROJECT_NAME}_BUILD_DOC}" )
if(${CMAKE_PROJECT_NAME}_BUILD_DOC)
add_subdirectory(docs)
endif()
......@@ -136,19 +137,4 @@ endif()
# --------------
include(cmake/export.cmake)
#
# Print configure status
# ----------------------
message(STATUS "SCALFMM_USE_MEM_STATS = ${SCALFMM_USE_MEM_STATS}" )
message(STATUS "SCALFMM_USE_LOG = ${SCALFMM_USE_LOG}" )
message(STATUS "SCALFMM_USE_MPI = ${SCALFMM_USE_MPI}" )
message(STATUS "SCALFMM_USE_BLAS = ${SCALFMM_USE_BLAS}")
message(STATUS "SCALFMM_USE_FFT = ${SCALFMM_USE_FFT}")
if(SCALFMM_USE_STARPU)
message(STATUS "SCALFMM_USE_STARPU = ${SCALFMM_USE_STARPU}" )
message(STATUS "STARPU_LIBRARIES = ${STARPU_LIBRARIES}")
message(STATUS "SCALFMM_USE_CUDA = ${SCALFMM_USE_CUDA}" )
MESSAGE(STATUS "SCALFMM_USE_OPENCL = ${SCALFMM_USE_OPENCL}" )
endif(SCALFMM_USE_STARPU)
message(STATUS "FUSE_LIST = ${FUSE_LIST}")
#
# Blas options
# ------------
if(SCALFMM_USE_BLAS)
if( SCALFMM_USE_MKL_AS_BLAS )
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS ) # not REQUIRED
elseif(SCALFMM_USE_ESSL_AS_BLAS)
set(BLA_VENDOR "IBMESSL")
find_package(BLAS QUIET) # not REQUIRED
find_package(LAPACK QUIET) # not REQUIRED
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
endif()
if(BLAS_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE blas::blas)
list(APPEND SCALFMM_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
if(LAPACK_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE lapack::lapack)
list(APPEND SCALFMM_LIBRARIES LAPACK)
endif()
message (STATUS "Check BLAS Fortran mangling")
# add options to let the user be able to force a behavior
option( SCALFMM_BLAS_ADD_ "Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)" ON )
option( SCALFMM_BLAS_UPCASE "Set to ON to force calls to BLAS Fortran symbols in capital (ex: DGEMM)" OFF )
option( SCALFMM_BLAS_NOCHANGE "Set to ON to force calls to BLAS Fortran symbols with no change (ex: dgemm)" OFF )
# if options not changed by user then auto-detection
if (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
# give blas libraries and check dgemm symbol
set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}")
check_function_exists(dgemv_ DGEMV_ADD_)
check_function_exists(DGEMV DGEMV_UPCASE)
check_function_exists(dgemv DGEMV_NOCHANGE)
# here we consider that the first kind of symbol found will be the one used
# current order is: ADD_, UPCASE, NOCHANGE
if (DGEMV_ADD_)
set (SCALFMM_BLAS_ADD_ ON)
set (SCALFMM_BLAS_UPCASE OFF)
set (SCALFMM_BLAS_NOCHANGE OFF)
message (STATUS "BLAS dgemv_ symbol found, SCALFMM_BLAS_ADD_ is ON")
else (DGEMV_ADD_)
if (DGEMV_UPCASE)
set (SCALFMM_BLAS_ADD_ OFF)
set (SCALFMM_BLAS_UPCASE ON)
set (SCALFMM_BLAS_NOCHANGE OFF)
message (STATUS "BLAS DGEMV symbol found, SCALFMM_BLAS_UPCASE is ON")
else (DGEMV_UPCASE)
if (DGEMV_NOCHANGE)
set (SCALFMM_BLAS_ADD_ OFF)
set (SCALFMM_BLAS_UPCASE OFF)
set (SCALFMM_BLAS_NOCHANGE ON)
message (STATUS "BLAS dgemv symbol found, SCALFMM_BLAS_NOCHANGE is ON")
endif (DGEMV_NOCHANGE)
endif (DGEMV_UPCASE)
endif (DGEMV_ADD_)
if ( (NOT DGEMV_ADD_) AND (NOT DGEMV_UPCASE) AND (NOT DGEMV_NOCHANGE) )
message(FATAL_ERROR "BLAS Fortran mangling is not properly detected - please check your BLAS libraries")
endif ()
else (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
if (SCALFMM_BLAS_ADD_)
message (STATUS "SCALFMM_BLAS_ADD_ is set to ON")
endif()
if (SCALFMM_BLAS_UPCASE)
message (STATUS "SCALFMM_BLAS_UPCASE is set to ON")
endif()
if (SCALFMM_BLAS_NOCHANGE)
message (STATUS "SCALFMM_BLAS_NOCHANGE is set to ON")
endif()
endif (NOT SCALFMM_BLAS_ADD_ AND NOT SCALFMM_BLAS_UPCASE AND NOT SCALFMM_BLAS_NOCHANGE)
else()
MESSAGE(WARNING "BLAS: ${BLAS_FOUND}")
message(WARNING "BLAS has not been found, SCALFMM will continue to compile but some applications will be disabled.")
message(WARNING "If you have BLAS set BLAS_LIBDIR, BLAS_INCDIR or BLAS_DIR (CMake variables using -D or environment variables).")
set(SCALFMM_USE_BLAS OFF)
endif()
endif(SCALFMM_USE_BLAS)
......@@ -29,8 +29,8 @@ install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/modules/internal/xtensor-b
install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/modules/internal/xtensor-fftw/include/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(FILES ${${CMAKE_PROJECT_NAME}_BINARY_DIR}/include/scalfmm/config/scalfmm-config.hpp
DESTINATION include/scalfmm/config/scalfmm-config.hpp)
#install(FILES ${${CMAKE_PROJECT_NAME}_BINARY_DIR}/include/scalfmm/config/scalfmm-config.hpp
# DESTINATION include/scalfmm/config/scalfmm-config.hpp)
install(EXPORT ${CMAKE_PROJECT_NAME}-targets
FILE ${CMAKE_PROJECT_NAME}-targets.cmake
......@@ -50,6 +50,10 @@ install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
foreach(file ${TOOLS_TO_INSTALL})
install(PROGRAMS "${CMAKE_BINARY_DIR}/tools/${file}"
DESTINATION bin/)
endforeach()
#
# build a CPack driven installer package
# --------------------------------------
......
......@@ -2,39 +2,32 @@
# Flags for scalfmm
# -----------------
list(APPEND ${CMAKE_PROJECT_NAME}_CXX_FLAGS -funroll-loops)
list(APPEND ${CMAKE_PROJECT_NAME}_CXX_FLAGS -ffast-math -ftree-vectorize)
#
# dev flags
# ---------
if(SCALFMM_ONLY_DEVEL)
list(APPEND SCALFMM_CXX_FLAGS -Wall -pedantic )
endif(SCALFMM_ONLY_DEVEL)
if(${CMAKE_PROJECT_NAME}_ONLY_DEVEL)
list(APPEND ${CMAKE_PROJECT_NAME}_CXX_FLAGS -Wall -pedantic )
endif(${CMAKE_PROJECT_NAME}_ONLY_DEVEL)
#
# Specific Debug flags
# --------------------
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
list(APPEND SCALFMM_CXX_FLAGS -funroll-loops)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
list(APPEND SCALFMM_CXX_FLAGS -fp-model\ strict)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
list(APPEND ${CMAKE_PROJECT_NAME}_CXX_FLAGS -fp-model\ strict)
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")
list(APPEND SCALFMM_CXX_FLAGS -ipo -fstrict-aliasing)
endif()
list(APPEND SCALFMM_CXX_FLAGS -ffast-math -ftree-vectorize)
endif(NOT APPLE)
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
list(APPEND ${CMAKE_PROJECT_NAME}_CXX_FLAGS -ipo -fstrict-aliasing)
endif()
#
# Set ScalFMM compile flags
# -------------------------
set(SCALFMM_CXX_FLAGS "${SCALFMM_CXX_FLAGS}" CACHE STRING "Global compile flags for ScalFMM")
message(STATUS "ScalFMM final flags : ${SCALFMM_CXX_FLAGS}")
set(${CMAKE_PROJECT_NAME}_CXX_FLAGS "${${CMAKE_PROJECT_NAME}_CXX_FLAGS}" CACHE STRING "Global compile flags for ScalFMM")
message(STATUS "ScalFMM final flags : ${${CMAKE_PROJECT_NAME}_CXX_FLAGS}")
......@@ -31,50 +31,3 @@ target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
$<INSTALL_INTERFACE:include>
)
#include(cmake/meta_module.cmake)
#set(MODULES_INSTALL_PATH ${CMAKE_BINARY_DIR}/modules/internal/)
#message(STATUS "Modules install path : ${MODULES_INSTALL_PATH}")
#
#set(xtl_MODULE_NAME xtl)
#set(xtl_MODULE_GIT_URL https://github.com/xtensor-stack/xtl.git)
#set(xtl_MODULE_GIT_TAG master)
#set(xtl_MODULE_INSTALL_PATH "${MODULES_INSTALL_PATH}/xtl")
#set(xtl_MODULE_CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${xtl_MODULE_INSTALL_PATH} -DCMAKE_PREFIX_PATH=${MODULES_INSTALL_PATH}")
#
#deploy_module(${xtl_MODULE_NAME} ${xtl_MODULE_GIT_URL} ${xtl_MODULE_GIT_TAG} ${xtl_MODULE_CMAKE_ARGS} ${xtl_MODULE_INSTALL_PATH} ${xtl_MODULE_NAME})
#
#set(xsimd_MODULE_NAME xsimd)
#set(xsimd_MODULE_GIT_URL https://github.com/xtensor-stack/xsimd.git)
#set(xsimd_MODULE_GIT_TAG master)
#set(xsimd_MODULE_INSTALL_PATH "${MODULES_INSTALL_PATH}/xsimd")
#set(xsimd_MODULE_CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${xsimd_MODULE_INSTALL_PATH} -DENABLE_XTL_COMPLEX=ON -DCMAKE_PREFIX_PATH=${MODULES_INSTALL_PATH}")
#
#deploy_module(${xsimd_MODULE_NAME} ${xsimd_MODULE_GIT_URL} ${xsimd_MODULE_GIT_TAG} ${xsimd_MODULE_CMAKE_ARGS} ${xsimd_MODULE_INSTALL_PATH} ${xsimd_MODULE_NAME})
#
#set(xtensor_MODULE_NAME xtensor)
#set(xtensor_MODULE_GIT_URL https://github.com/xtensor-stack/xtensor.git)
#set(xtensor_MODULE_GIT_TAG master)
#set(xtensor_MODULE_INSTALL_PATH "${MODULES_INSTALL_PATH}/xtensor")
#set(xtensor_MODULE_CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${xtensor_MODULE_INSTALL_PATH} -DXTENSOR_USE_XSIMD=ON -DCPP17=ON -DCMAKE_PREFIX_PATH=${MODULES_INSTALL_PATH}")
#
#deploy_module(${xtensor_MODULE_NAME} ${xtensor_MODULE_GIT_URL} ${xtensor_MODULE_GIT_TAG} ${xtensor_MODULE_CMAKE_ARGS} ${xtensor_MODULE_INSTALL_PATH} ${xtensor_MODULE_NAME})
#
#set(xtensor-blas_MODULE_NAME xtensor-blas)
#set(xtensor-blas_MODULE_GIT_URL https://github.com/xtensor-stack/xtensor-blas.git)
#set(xtensor-blas_MODULE_GIT_TAG master)
#set(xtensor-blas_MODULE_INSTALL_PATH "${MODULES_INSTALL_PATH}/xtensor-blas")
#set(xtensor-blas_MODULE_CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${xtensor-blas_MODULE_INSTALL_PATH}")
#
#deploy_module(${xtensor-blas_MODULE_NAME} ${xtensor-blas_MODULE_GIT_URL} ${xtensor-blas_MODULE_GIT_TAG} ${xtensor-blas_MODULE_CMAKE_ARGS} ${xtensor-blas_MODULE_INSTALL_PATH} ${xtensor-blas_MODULE_NAME})
#
#if(SCALFMM_USE_FFT)
# set(xtensor-fftw_MODULE_NAME xtensor-fftw)
# set(xtensor-fftw_MODULE_GIT_URL https://github.com/xtensor-stack/xtensor-fftw.git)
# set(xtensor-fftw_MODULE_GIT_TAG master)
# set(xtensor-fftw_MODULE_INSTALL_PATH "${xtensor-blas_MODULE_INSTALL_PATH}")
# set(xtensor-fftw_MODULE_CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${xtensor-fftw_MODULE_INSTALL_PATH} -DCMAKE_PREFIX_PATH=${MODULES_INSTALL_PATH}")
#
# deploy_module(${xtensor-fftw_MODULE_NAME} ${xtensor-fftw_MODULE_GIT_URL} ${xtensor-fftw_MODULE_GIT_TAG} ${xtensor-fftw_MODULE_CMAKE_ARGS} ${xtensor-fftw_MODULE_INSTALL_PATH} ${xtensor-blas_MODULE_NAME})
#endif(SCALFMM_USE_FFT)
#
# Options for scalfmm
# -------------------
# 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" ON )
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 build examples" ON )
option( SCALFMM_BUILD_UNITS "Set to ON to build unit tests" OFF )
option( SCALFMM_BUILD_DOC "Set to ON to build the Doxygen documentation" 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_ONLY_DEVEL "Set to ON to compile Development tools (only scalfmm team)" OFF )
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 )
endif(SCALFMM_USE_BLAS)
include(CMakeDependentOption)
cmake_dependent_option(SCALFMM_USE_MKL_AS_FFTW "Set to ON to use MKL FFTW" ON "SCALFMM_USE_FFT;SCALFMM_USE_MKL_AS_BLAS" OFF )
cmake_dependent_option(SCALFMM_USE_ESSL_AS_FFTW "Set to ON to use ESSL FFTW" ON "SCALFMM_USE_FFT;SCALFMM_USE_ESSL_AS_BLAS" OFF )
cmake_dependent_option( SCALFMM_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
cmake_dependent_option( SCALFMM_USE_CUDA "Set to ON to use OPENCL with StarPU" OFF "SCALFMM_USE_STARPU" OFF)
cmake_dependent_option(SCALFMM_USE_STATIC_ANALYSIS "Set to ON to use static analysis tools" ON "SCALFMM_ONLY_DEVEL" OFF )
cmake_dependent_option(SCALFMM_USE_CPPCHECK "Set to ON to use static analysis tools" OFF "SCALFMM_USE_STATIC_ANALYSIS" OFF )
cmake_dependent_option(SCALFMM_USE_CLANGTIDY "Set to ON to use static analysis tools" ON "SCALFMM_USE_STATIC_ANALYSIS" OFF )
cmake_dependent_option(SCALFMM_USE_IWYU "Set to ON to use static analysis tools" ON "SCALFMM_USE_STATIC_ANALYSIS" OFF )
# Additional options for developers
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
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()
# Examples
#---------
cmake_minimum_required (VERSION 3.15.0 FATAL_ERROR)
#
# Project Declaration
#--------------------
project(scalfmm3-examples CXX)
#
# Update cmake path with morse
# ----------------------------
#include(cmake/morse.cmake)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
#
# 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...
#
# Options for scalfmm
# -------------------
include(cmake/options.cmake)
#
# Dependencies for the lib
# ------------------------
include(cmake/dependencies.cmake)
set(${CMAKE_PROJECT_NAME}_LIBRARIES "${${CMAKE_PROJECT_NAME}_LIBRARIES}" CACHE STRING "${CMAKE_PROJECT_NAME} libraries dependencies")
message(STATUS "${CMAKE_PROJECT_NAME} dependencies : ${${CMAKE_PROJECT_NAME}_LIBRARIES}")
#
# Print configure status
# ----------------------
message(STATUS "${CMAKE_PROJECT_NAME}_USE_MEM_STATS = ${${CMAKE_PROJECT_NAME}_USE_MEM_STATS}" )
message(STATUS "${CMAKE_PROJECT_NAME}_USE_LOG = ${${CMAKE_PROJECT_NAME}_USE_LOG}" )
message(STATUS "${CMAKE_PROJECT_NAME}_USE_MPI = ${${CMAKE_PROJECT_NAME}_USE_MPI}" )
message(STATUS "${CMAKE_PROJECT_NAME}_USE_BLAS = ${${CMAKE_PROJECT_NAME}_USE_BLAS}")
message(STATUS "${CMAKE_PROJECT_NAME}_USE_FFT = ${${CMAKE_PROJECT_NAME}_USE_FFT}")
if(${CMAKE_PROJECT_NAME}_USE_STARPU)
message(STATUS "${CMAKE_PROJECT_NAME}_USE_STARPU = ${${CMAKE_PROJECT_NAME}_USE_STARPU}" )
message(STATUS "STARPU_LIBRARIES = ${STARPU_LIBRARIES}")
message(STATUS "${CMAKE_PROJECT_NAME}_USE_CUDA = ${${CMAKE_PROJECT_NAME}_USE_CUDA}" )
MESSAGE(STATUS "${CMAKE_PROJECT_NAME}_USE_OPENCL = ${${CMAKE_PROJECT_NAME}_USE_OPENCL}" )
endif(${CMAKE_PROJECT_NAME}_USE_STARPU)
message(STATUS "FUSE_LIST = ${FUSE_LIST}")
#
# Modules required
# ----------------
include(cmake/analysis.cmake)
# List of source files
set(source_tests_files
......
......@@ -2,7 +2,7 @@
# Static analysis during build
# ----------------------------
if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CPPCHECK)
if(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS AND ${CMAKE_PROJECT_NAME}_USE_CPPCHECK)
find_program(CPPCHECK "cppcheck")
if (CPPCHECK)
set(CMAKE_CXX_CPPCHECK "${CPPCHECK}"
......@@ -17,20 +17,20 @@ if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CPPCHECK)
message(STATUS "CPPCHECK analysis is ON.")
endif()
#add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo $<TARGET_GENEX_EVAL:${CMAKE_PROJECT_NAME},-I$<TARGET_PROPERTY:${CMAKE_PROJECT_NAME},INTERFACE_INCLUDE_DIRECTORIES>>)
endif(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CPPCHECK)
endif(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS AND ${CMAKE_PROJECT_NAME}_USE_CPPCHECK)
if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CLANGTIDY)
if(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS AND ${CMAKE_PROJECT_NAME}_USE_CLANGTIDY)
find_program(CLANGTIDY "clang-tidy")
if(CLANGTIDY)
set(CMAKE_CXX_CLANG_TIDY "${CLANGTIDY};--header-filter=${CMAKE_SOURCE_DIR}/include/scalfmm/.;--checks=-*,cppcoreguidelines-*,clang-analyser-cplusplus*,modernize-*,mpi-*,performance-*,portability-*,readability-*")
message(STATUS "Clang Tidy analysis is ON.")
endif()
endif(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CLANGTIDY)
endif(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS AND ${CMAKE_PROJECT_NAME}_USE_CLANGTIDY)
if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_IWYU)
if(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS AND ${CMAKE_PROJECT_NAME}_USE_IWYU)
find_program(IWYU "include-what-you-use")
if(IWYU)
set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE "${IWYU}")
message(STATUS "Include What You Use analysis is ON.")
endif()
endif(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_IWYU)
endif(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS AND ${CMAKE_PROJECT_NAME}_USE_IWYU)
#
# Blas options
# ------------
if(SCALFMM_USE_BLAS)
if( SCALFMM_USE_MKL_AS_BLAS )
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS REQUIRED)
elseif(SCALFMM_USE_ESSL_AS_BLAS)
set(BLA_VENDOR "IBMESSL")
find_package(BLAS REQUIRED)
#find_package(LAPACK QUIET)
elseif(SCALFMM_USE_EXTERNAL_BLAS)
message(STATUS "BLAS SET BY EXTERNAL PROGRAM = ${BLAS_LIBRARIES}")
list(APPEND BLASLAPACK_LIBRARIES "${BLAS_LIBRARIES}")
else()
find_package(CBLAS)
if(BLAS_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE MORSE::CBLAS)
list(APPEND SCALFMM_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
endif()
endif()
if(BLAS_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE BLAS::BLAS)
list(APPEND SCALFMM_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
#if(LAPACK_FOUND)
# target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE LAPACK::LAPACK)
# list(APPEND SCALFMM_LIBRARIES LAPACK)
#endif()
#message (STATUS "Check BLAS Fortran mangling")
## add options to let the user be able to force a behavior
#option( SCALFMM_BLAS_ADD_ "Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)" ON )
#option( SCALFMM_BLAS_UPCASE "Set to ON to force calls to BLAS Fortran symbols in capital (ex: DGEMM)" OFF )
#option( SCALFMM_BLAS_NOCHANGE "Set to ON to force calls to BLAS Fortran symbols with no change (ex: dgemm)" OFF )
## if options not changed by user then auto-detection