Commit 044c378b authored by ESTERIE Pierre's avatar ESTERIE Pierre

First step with cmake, units, tools, basic components

parent e35676b5
......@@ -4,3 +4,9 @@
[submodule "inastemp"]
path = inastemp
url = https://gitlab.inria.fr/coulaud/inastemp.git
[submodule "experimental/modules/morse_cmake"]
path = experimental/modules/morse_cmake
url = https://gitlab.inria.fr/solverstack/morse_cmake
[submodule "experimental/modules/xsimd"]
path = experimental/modules/xsimd
url = https://github.com/QuantStack/xsimd
cmake_minimum_required (VERSION 3.13.0 FATAL_ERROR)
#
# Project Declaration
#--------------------
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)
#
# Version Number
# --------------
# SCALFMM 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
# -----------------
#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
#
# Creating main lib
# -----------------
add_library(${CMAKE_PROJECT_NAME} INTERFACE)
target_compile_features(${CMAKE_PROJECT_NAME} INTERFACE cxx_std_20)
# Set library includes
# --------------------
target_include_directories(${CMAKE_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake")
# Add extra cmake module path and initialize morse cmake modules
# --------------------------------------------------------------
if(MORSE_DISTRIB_DIR)
list(APPEND CMAKE_MODULE_PATH ${MORSE_DISTRIB_DIR}/modules)
set(MORSE_CMAKE_MODULE_PATH ${MORSE_DISTRIB_DIR}/modules )
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake/modules)
set(MORSE_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules/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)
# when building, don't use the install RPATH already
# (but later on when installing)
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)
#
# Options
#
# 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 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)" ON )
#
# Set scalfmm dev flags
# ------------------------
if(SCALFMM_ONLY_DEVEL)
list(APPEND SCALFMM_CXX_FLAGS -Wall -pedantic )
endif(SCALFMM_ONLY_DEVEL)
# 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...
#
# OpenMP
# ------
if(NOT OpenMP_CXX_FOUND)
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE OpenMP::OpenMP_CXX)
list(APPEND SCALFMM_LIBRARIES OpenMP)
if(OpenMP_CXX_VERSION_MAJOR GREATER_EQUAL 4)
list(APPEND FUSE_LIST OMP4)
endif()
else(OpenMP_CXX_FOUND)
message(WARNING "OPENMP NOT FOUND")
endif(OpenMP_CXX_FOUND)
endif(NOT OpenMP_CXX_FOUND)
#
# XSIMD
# -----
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/xsimd")
set(xsimd_DIR "${CMAKE_CURRENT_BINARY_DIR}/modules/xsimd")
# Find XSIMD properly
add_subdirectory(modules/xsimd)
find_package(xsimd CONFIG REQUIRED)
if(xsimd_FOUND)
message(STATUS "XSIMD found")
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE xsimd)
else(xsimd_FOUND)
message(FATAL_ERROR "Can't find XSIMD !")
endif(xsimd_FOUND)
endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/xsimd")
#
# Module inria
# ------------
target_include_directories(${CMAKE_PROJECT_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/modules/inria>
$<INSTALL_INTERFACE:include>
)
#
# 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()
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)
endif()
#
# MPI
# ---
if(SCALFMM_USE_MPI)
if(NOT MPI_FOUND)
find_package(MPI REQUIRED)
if(MPI_CXX_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE MPI::MPI_CXX)
list(APPEND SCALFMM_LIBRARIES MPI)
list(APPEND FUSE_LIST MPI)
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)
endif(NOT MPI_FOUND)
endif(SCALFMM_USE_MPI)
#
# 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
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)
#
# FFT options
# -----------
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 )
if(SCALFMM_USE_FFT)
message(STATUS "SCALFMM USE FFT Configure:")
# The package find_package(FFTW) can be used with the following COMPONENTS:
# MKL, ESSL, THREADS|OMP and/or SIMPLE|LONG|QUAD
# Default will find the real double precision fftw library version without THREADS|OMP
if(SCALFMM_USE_MKL_AS_FFTW)
message(STATUS " SCALFMM USE FFT from MKL")
set(BLA_VENDOR "Intel10_64lp_seq")
if(NOT TARGET blas::blas)
find_package(FFTW COMPONENTS MKL)
else()
set(FFTW_FOUND 1)
find_package(FFTW COMPONENTS MKL QUIET)
target_include_directories(${CMAKE_PROJECT_NAME} INTERFACE ${FFTW_INCLUDE_DIRS})
endif()
elseif (SCALFMM_USE_ESSL_AS_FFTW)
message(STATUS " SCALFMM USE FFT from ESSL ")
find_package(FFTW COMPONENTS ESSL)
else()
message(STATUS " SCALFMM USE FFTW")
find_package(FFTW COMPONENTS SIMPLE)
endif()
if(FFTW_FOUND)
list(APPEND FUSE_LIST FFT)
if(NOT SCALFMM_USE_MKL_AS_FFTW)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE fftw::fftw)
list(APPEND SCALFMM_LIBRARIES FFTW)
endif()
else(FFTW_FOUND)
message(WARNING "FFTW has not been found, SCALFMM will continue to compile but some applications will be disabled.")
message(WARNING "If you have FFTW set FFTW_LIBDIR, FFTW_INCDIR or FFTW_DIR (CMake variables using -D or environment variables).")
set(SCALFMM_USE_FFT OFF)
endif(FFTW_FOUND)
endif(SCALFMM_USE_FFT)
message(STATUS "SCALFMM_USE_FFT = ${SCALFMM_USE_FFT}")
#
# STARPU Section
# --------------
message( STATUS "SCALFMM_USE_STARPU = ${SCALFMM_USE_STARPU}" )
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)
if( SCALFMM_USE_STARPU )
enable_language(C)
# Find StarPU with a list of optional components
set(SCALFMM_STARPU_VERSION "1.2.8" CACHE STRING " STARPU version desired")
# create list of components in order to make a single call to find_package(starpu...)
set(STARPU_COMPONENT_LIST "HWLOC")
if(SCALFMM_USE_CUDA)
message(WARNING "This release doest not include a full support for CUDA/OpenCl.")
#list(APPEND STARPU_COMPONENT_LIST "CUDA")
endif()
if(SCALFMM_USE_MPI)
list(APPEND STARPU_COMPONENT_LIST "MPI")
endif()
if(SCALFMM_USE_OPENCL)
message(WARNING "This release doest not include a full support for CUDA/OpenCl.")
#list(APPEND STARPU_COMPONENT_LIST "OPENCL")
endif()
find_package(STARPU ${SCALFMM_STARPU_VERSION} REQUIRED
COMPONENTS ${STARPU_COMPONENT_LIST})
if(STARPU_FOUND)
target_link_libraries(${CMAKE_PROJECT_NAME} INTERFACE starpu::starpu_dep)
list(APPEND FUSE_LIST "STARPU")
list(APPEND SCALFMM_LIBRARIES "STARPU")
if(SCALFMM_USE_CUDA)
#list(APPEND FUSE_LIST "CUDA")
endif()
if(SCALFMM_USE_OPENCL)
#list(APPEND FUSE_LIST "OPENCL")
endif()
else(STARPU_FOUND)
message(FATAL_ERROR "StarPU not found.")
endif(STARPU_FOUND)
endif(SCALFMM_USE_STARPU)
# 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()
#
# 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}")
# And adding flags to target
# --------------------------
target_compile_options(${CMAKE_PROJECT_NAME} INTERFACE "${SCALFMM_CXX_FLAGS}")
#
# Set ScalFMM dependencies
# ------------------------
set(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES}" CACHE STRING "ScalFMM libraries dependencies")
message(STATUS "ScalFMM dependencies : ${SCALFMM_LIBRARIES}")
# #
# # Set ScalFMM link flags
# # ----------------------
# string(REPLACE ";" " " SCALFMM_LINK_FLAGS "${SCALFMM_LINK_FLAGS}")
# set(SCALFMM_LINK_FLAGS "${SCALFMM_LINK_FLAGS}" CACHE STRING "Global link flags for ScalFMM")
# message(STATUS "ScalFMM link flags : ${SCALFMM_LINK_FLAGS}")
# # And adding lin flags to the target
# # ----------------------------------
# target_link_options(${CMAKE_PROJECT_NAME} INTERFACE "${SCALFMM_LIBRARIES}")
#
# Set ScalFMM compile definitions
# -------------------------------
set(SCALFMM_COMPILE_DEFINITIONS "${SCALFMM_COMPILE_DEFINITIONS}" CACHE STRING "Global compile definitions for ScalFMM")
message(STATUS "ScalFMM compile definitions : ${SCALFMM_COMPILE_DEFINITIONS}")
# And adding definitions to target
# --------------------------------
target_compile_definitions(${CMAKE_PROJECT_NAME} INTERFACE "${SCALFMM_COMPILE_DEFINITIONS}")
#
# 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)
#
# Static analysis during build
# ----------------------------
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 )
if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CPPCHECK)
find_program(CPPCHECK "cppcheck")
if (CPPCHECK)
set(CMAKE_CXX_CPPCHECK "${CPPCHECK}"
"--language=c++"
"$<GENEX_EVAL:-I$<TARGET_PROPERTY:INTERFACE_INCLUDE_DIRECTORIES>>"
"-I."
"-v"
"--enable=all"
"--force"
"--inline-suppr"
)
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)
if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_USE_CLANGTIDY)
find_program(CLANGTIDY "clang-tidy")
if (CLANGTIDY)
set(CMAKE_CXX_CLANG_TIDY "${CLANGTIDY};-checks=-*,boost-*,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)
if(SCALFMM_USE_STATIC_ANALYSIS AND SCALFMM_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)
#
# Build Examples
# --------------
message(STATUS "SCALFMM_BUILD_EXAMPLES = ${SCALFMM_BUILD_EXAMPLES}" )
if( SCALFMM_BUILD_EXAMPLES )
# Build - Examples and drivers
add_subdirectory(examples)
endif()
#
# Build - Unitary and numerical Tests
# -----------------------------------
message( STATUS "SCALFMM_BUILD_UTESTS = ${SCALFMM_BUILD_UTESTS}" )
if( SCALFMM_BUILD_UNITS )
enable_testing()
include(CTest)
add_subdirectory(units)
endif()
#
# Add - doc
# ---------
message(STATUS "SCALFMM_BUILD_DOC = ${SCALFMM_BUILD_DOC}" )
if(SCALFMM_BUILD_DOC)
add_subdirectory(doc)
endif()
#
# Export Library
# --------------
install(TARGETS ${CMAKE_PROJECT_NAME} xsimd
EXPORT ${CMAKE_PROJECT_NAME}-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)
install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/include
DESTINATION ${CMAKE_INSTALL_PREFIX}
PATTERN "scalfmm-config.hpp.cmake" EXCLUDE)
install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/modules/inria
DESTINATION ${CMAKE_INSTALL_PREFIX}
PATTERN "scalfmm-config.hpp.cmake" EXCLUDE)
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
NAMESPACE ${CMAKE_PROJECT_NAME}::
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
VERSION ${${CMAKE_PROJECT_NAME}_VERSION}
COMPATIBILITY SameMajorVersion)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_PROJECT_NAME}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/)
install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
#
# build a CPack driven installer package
# --------------------------------------
# See CPackConfig.cmake for the details.
include(CPack)
#
# Print configure status
# ----------------------
# Use Mem stats
message(STATUS "SCALFMM_USE_MEM_STATS = ${SCALFMM_USE_MEM_STATS}" )
# Use Log
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}")
message(STATUS "SCALFMM_USE_MKL = ${SCALFMM_USE_MKL}")
#
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 "SCALFMM_CXX_FLAGS = ${SCALFMM_CXX_FLAGS}")
message(STATUS "SCALFMM_LIBRARIES = ${SCALFMM_LIBRARIES}")
message(STATUS "FUSE_LIST = ${FUSE_LIST}")
else(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse_cmake")
message(STATUS "MORSE_DISTRIB_DIR is not set")
message(STATUS "Please indicate where is located your MORSE distribution directory."
" This is necessary to find cmake_modules.")
message(STATUS "If you are a MORSE developer, you normally have access to the svn repository of the MORSE_DISTRIB_DIR: "
"svn checkout svn+ssh://yourlogin@scm.gforge.inria.fr/svnroot/morse/trunk/morse_distrib")
endif(MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/morse_cmake")
set(CPACK_PACKAGE_VERSION_PATCH 0)
execute_process(
COMMAND git rev-list HEAD --count
OUTPUT_VARIABLE CPACK_PACKAGE_VERSION_PATCH
RESULT_VARIABLE RET
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
#string_TRIM(PATCH1 PATCH)
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "ON")
#
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE")
set(CPACK_PACKAGE_VERSION_MAJOR "${${CMAKE_PROJECT_NAME}_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${${CMAKE_PROJECT_NAME}_MINOR_VERSION}")
#
set(PACK_PACKAGE_VERSION "${${CMAKE_PROJECT_NAME}_VERSION}.${${CMAKE_PROJECT_NAME}_MINOR_VERSION}-${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "SCALFMM-${${CMAKE_PROJECT_NAME}_MAJOR_VERSION}.${${CMAKE_PROJECT_NAME}_MINOR_VERSION}-${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_IGNORE_FILES "\\\\.git;.DS_Store;.*~;/*.aux;/*.idx;/*.log;/*.out;/*.toc;/*.ilg;CMakeLists.txt.user;/.settings/")
list(APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/Utils/;/Build*;/Obsolete/")
#
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "ScalFMM")
set(CTEST_NIGHTLY_START_TIME "00:00:00 GMT")
set(CTEST_SUBMIT_URL "http://cdash.inria.fr/CDash/submit.php?project=scalfmm")
#--------------------------------------------------------------------
# BUILDNAME variable construction
# This variable will be used to set the build name which will appear
# on the Chameleon dashboard http://cdash.inria.fr/CDash/
#--------------------------------------------------------------------
# Start with the short system name, e.g. "Linux", "FreeBSD" or "Windows"
if(NOT BUILDNAME)
set(BUILDNAME "${CMAKE_SYSTEM_NAME}")
# Add i386 or amd64
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(BUILDNAME "${BUILDNAME}-amd64")
else()
set(BUILDNAME "${BUILDNAME}-i386")
endif()
# Add compiler name
get_filename_component(CMAKE_CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME)
set(BUILDNAME "${BUILDNAME}-${CMAKE_CXX_COMPILER_NAME}")
# Add the build type, e.g. "Debug, Release..."
if(CMAKE_BUILD_TYPE)
set(BUILDNAME "${BUILDNAME}-${CMAKE_BUILD_TYPE}")
endif(CMAKE_BUILD_TYPE)
# Specific options of Scalfmm
if(SCALFMM_USE_SSE)
set(BUILDNAME "${BUILDNAME}-sse")
endif()
if(SCALFMM_USE_BLAS)
set(BUILDNAME "${BUILDNAME}-blas")
endif()
if(SCALFMM_USE_MPI)
set(BUILDNAME "${BUILDNAME}-mpi")
endif()
endif()
# Examples
#---------
# List of source files
set(source_tests_files
sandbox.cpp
)
# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
set(compile_exec TRUE)
get_filename_component( execname ${exec} NAME_WE )
foreach(fuse_key ${FUSE_DEP_AVAILABLE})
file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}")
if(lines_fuse AND NOT ${fuse_key} IN_LIST FUSE_LIST)
message( STATUS "This needs ${fuse_key} = ${exec}" )
set(compile_exec FALSE)
endif()
endforeach()
# Dependency are OK
if( compile_exec )
add_executable( ${execname} ${exec})
list(APPEND SCALFMM_EXAMPLES_TARGETS ${execname})
list(APPEND SCALFMM_TESTS_TARGETS ${execname})
set_target_properties(${execname} PROPERTIES ENABLE_EXPORTS TRUE
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BUILD_TYPE}
)
target_link_libraries( ${execname} ${CMAKE_PROJECT_NAME})
install(TARGETS ${execname} RUNTIME DESTINATION bin)
endif()
endforeach(exec)
add_custom_target(scalfmm_examples ALL DEPENDS ${SCALFMM_EXAMPLES_TARGETS})
//---------------------
// Experimental example
//---------------------
#include <string>
#include <vector>
#include <iostream>
#include <tuple>
#include <inria/tcli/help_descriptor.hpp>
#include <inria/tcli/tcli.hpp>
#include <scalfmm/container/particle_container.hpp>