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

CMake with multiple packages and different dependency handling.

parent 91ccb684
......@@ -39,11 +39,11 @@ endif()
#
# Creating main lib
# -----------------
add_library(${CMAKE_PROJECT_NAME} INTERFACE)
target_compile_features(${CMAKE_PROJECT_NAME} INTERFACE cxx_std_17)
add_library(${CMAKE_PROJECT_NAME}-headers INTERFACE)
target_compile_features(${CMAKE_PROJECT_NAME}-headers INTERFACE cxx_std_17)
# Set library includes
# --------------------
target_include_directories(${CMAKE_PROJECT_NAME} INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
......@@ -70,7 +70,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# -----------------
include(cmake/flags.cmake)
# -----------------
target_compile_options(${CMAKE_PROJECT_NAME} INTERFACE "${${CMAKE_PROJECT_NAME}_CXX_FLAGS}")
target_compile_options(${CMAKE_PROJECT_NAME}-headers INTERFACE "${${CMAKE_PROJECT_NAME}_CXX_FLAGS}")
# -----------------
#
......@@ -78,6 +78,11 @@ target_compile_options(${CMAKE_PROJECT_NAME} INTERFACE "${${CMAKE_PROJECT_NAME}_
# -------------------
include(cmake/options.cmake)
#
# Modules required
# ----------------
include(cmake/modules.cmake)
#
# Set ${CMAKE_PROJECT_NAME} compile definitions
# -------------------------------
......@@ -85,26 +90,28 @@ set(${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS XSIMD_ENABLE_XTL_COMPLEX ENABLE_X
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}")
target_compile_definitions(${CMAKE_PROJECT_NAME}-headers INTERFACE "${${CMAKE_PROJECT_NAME}_COMPILE_DEFINITIONS}")
# -----------------
#
# Modules required
# ----------------
include(cmake/modules.cmake)
#
# Dependencies for the lib
# ------------------------
include(cmake/dependencies.cmake)
# Minimum required dependencies are BLAS/CBLAS and FFTW
add_library(${CMAKE_PROJECT_NAME}-core INTERFACE)
target_link_libraries(${CMAKE_PROJECT_NAME}-core INTERFACE ${CMAKE_PROJECT_NAME}-headers ${BLAS_TARGET} ${CBLAS_TARGET} ${FFTW_TARGET} ${OMP_TARGET} ${CMAKE_PROJECT_NAME}-headers)
set(CORE_LIBRARIES CBLAS BLAS FFTW OpenMP ${CMAKE_PROJECT_NAME}-headers)
if(${CMAKE_PROJECT_NAME}_USE_MPI)
add_library(${CMAKE_PROJECT_NAME}-mpi INTERFACE)
target_link_libraries(${CMAKE_PROJECT_NAME}-mpi INTERFACE ${CMAKE_PROJECT_NAME}-core ${MPI_TARGET})
target_compile_definitions(${CMAKE_PROJECT_NAME}-mpi INTERFACE ${MPI_COMPILE_DEFINITIONS})
set(MPI_LIBRARIES MPI ${CMAKE_PROJECT_NAME}-core)
endif()
set(${CMAKE_PROJECT_NAME}_LIBRARIES "${${CMAKE_PROJECT_NAME}_LIBRARIES}" CACHE STRING "${CMAKE_PROJECT_NAME} libraries dependencies")
message(STATUS "${CMAKE_PROJECT_NAME} dependencies : ${FUSE_LIST}")
# 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)
#
# Modules required
......@@ -114,7 +121,7 @@ include(cmake/analysis.cmake)
#
# Set FUSE LIST
# -------------
set(FUSE_DEP_AVAILABLE "MPI;CUDA;STARPU;OMP4;BLAS;CBLAS;FFTW;OPENCL") # List to compare against when compiling tests, etc...
set(FUSE_DEP_AVAILABLE "MPI;CUDA;STARPU;OMP;BLAS;CBLAS;FFTW;OPENCL") # List to compare against when compiling tests, etc...
#
# Build Tools
......
#
# Blas options
# ------------
if(${CMAKE_PROJECT_NAME}_USE_BLAS)
if(NOT BLAS_FOUND OR NOT CBLAS_FOUND)
if( ${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS )
if(NOT BLAS_FOUND OR NOT CBLAS_FOUND)
if( ${CMAKE_PROJECT_NAME}_USE_MKL)
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS CBLAS)
list(APPEND FUSE_LIST BLAS CBLAS)
elseif()
message(ERROR "CBLAS and BLAS required for uniform interpolator.")
endif()
else()
set(BLA_VENDOR "Intel10_64lp_seq")
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS CBLAS)
list(APPEND FUSE_LIST BLAS CBLAS)
elseif()
message(ERROR "CBLAS and BLAS required for uniform interpolator.")
endif()
find_package(CBLAS REQUIRED)
if(CBLAS_FOUND)
list(APPEND CBLAS_TARGET MORSE::CBLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES CBLAS)
list(APPEND FUSE_LIST CBLAS)
elseif()
message(ERROR "CBLAS required for uniform interpolator.")
endif()
else()
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
elseif()
message(ERROR "BLAS required for chebyshev interpolator.")
endif()
find_package(CBLAS REQUIRED)
if(CBLAS_FOUND)
list(APPEND CBLAS_TARGET MORSE::CBLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES CBLAS)
list(APPEND FUSE_LIST CBLAS)
elseif()
message(ERROR "CBLAS required for uniform interpolator.")
endif()
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND BLAS_TARGET BLAS::BLAS)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES BLAS)
list(APPEND FUSE_LIST BLAS)
elseif()
message(ERROR "BLAS required for chebyshev interpolator.")
endif()
endif(NOT BLAS_FOUND OR NOT CBLAS_FOUND)
endif(${CMAKE_PROJECT_NAME}_USE_BLAS)
endif()
endif(NOT BLAS_FOUND OR NOT CBLAS_FOUND)
#message (STATUS "Check BLAS Fortran mangling")
## add options to let the user be able to force a behavior
......
......@@ -2,32 +2,30 @@
# FFT options
# -----------
if(${CMAKE_PROJECT_NAME}_USE_FFTW)
if(NOT FFTW_FOUND)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW Configure:")
if(NOT FFTW_FOUND)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW 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(${CMAKE_PROJECT_NAME}_USE_MKL_AS_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from MKL")
find_package(FFTW REQUIRED COMPONENTS MKL)
elseif (${CMAKE_PROJECT_NAME}_USE_ESSL_AS_FFTW)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from ESSL")
find_package(FFTW REQUIRED COMPONENTS ESSL)
else()
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW")
find_package(FFTW REQUIRED COMPONENTS SIMPLE LONG)
endif()
# 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(${CMAKE_PROJECT_NAME}_USE_MKL)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from MKL")
find_package(FFTW REQUIRED COMPONENTS MKL)
elseif (${CMAKE_PROJECT_NAME}_USE_ESSL)
message(STATUS "${CMAKE_PROJECT_NAME} USE FFT from ESSL")
find_package(FFTW REQUIRED COMPONENTS ESSL)
else()
message(STATUS "${CMAKE_PROJECT_NAME} USE FFTW")
find_package(FFTW REQUIRED COMPONENTS SIMPLE LONG)
endif()
if(FFTW_FOUND)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES FFTW)
list(APPEND FUSE_LIST FFTW)
list(APPEND FFTW_TARGET MORSE::FFTW)
else(FFTW_FOUND)
message(WARNING "FFTW has not been found, ${CMAKE_PROJECT_NAME} 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(${CMAKE_PROJECT_NAME}_USE_FFT OFF)
endif(FFTW_FOUND)
endif(NOT FFTW_FOUND)
endif(${CMAKE_PROJECT_NAME}_USE_FFTW)
if(FFTW_FOUND)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES FFTW)
list(APPEND FUSE_LIST FFTW)
list(APPEND FFTW_TARGET MORSE::FFTW)
else(FFTW_FOUND)
message(FATAL_ERROR "FFTW has not been found, ${CMAKE_PROJECT_NAME} will continue to compile but some applications will be disabled.")
message(FATAL_ERROR "If you have FFTW set FFTW_LIBDIR, FFTW_INCDIR or FFTW_DIR (CMake variables using -D or environment variables).")
set(${CMAKE_PROJECT_NAME}_USE_FFT OFF)
endif(FFTW_FOUND)
endif(NOT FFTW_FOUND)
......@@ -2,9 +2,9 @@
# OpenMP
# ------
if(NOT OpenMP_CXX_FOUND)
find_package(OpenMP)
find_package(OpenMP REQUIRED)
if(OpenMP_CXX_FOUND)
list(APPEND BLAS_TARGET OpenMP::OpenMP_CXX)
list(APPEND OMP_TARGET OpenMP::OpenMP_CXX)
list(APPEND ${CMAKE_PROJECT_NAME}_LIBRARIES OpenMP)
list(APPEND FUSE_LIST OMP)
else(OpenMP_CXX_FOUND)
......
#
# Export Library
# --------------
install(TARGETS ${CMAKE_PROJECT_NAME}
EXPORT ${CMAKE_PROJECT_NAME}-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
set(PACKAGES ${CMAKE_PROJECT_NAME}-headers ${CMAKE_PROJECT_NAME}-core ${CMAKE_PROJECT_NAME}-mpi)
install(TARGETS ${PACKAGES}
EXPORT ${CMAKE_PROJECT_NAME}-targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
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/internal/morse_cmake/modules/
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME})
set(MORSE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/)
install(DIRECTORY ${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/modules/internal/inria_tools/
DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
......@@ -41,20 +45,23 @@ install(EXPORT ${CMAKE_PROJECT_NAME}-targets
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}/)
foreach(package ${PACKAGES})
write_basic_package_version_file("${package}ConfigVersion.cmake"
VERSION ${${CMAKE_PROJECT_NAME}_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/${package}Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${package}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/)
install(FILES "${CMAKE_BINARY_DIR}/${package}ConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/${package}Config.cmake"
DESTINATION lib/cmake/${CMAKE_PROJECT_NAME})
endforeach()
foreach(file ${TOOLS_TO_INSTALL})
install(PROGRAMS "${CMAKE_BINARY_DIR}/tools/${file}"
install(PROGRAMS "${CMAKE_BINARY_DIR}/tools/${CMAKE_BUILD_TYPE}/${file}"
DESTINATION bin/)
endforeach()
#
......
......@@ -6,27 +6,27 @@
#
# Module internal
# ------------
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/modules/internal/inria_tools>
$<INSTALL_INTERFACE:include>
)
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/modules/internal/xtl/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/modules/internal/xsimd/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/modules/internal/xtensor/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/modules/internal/xtensor-blas/include>
$<INSTALL_INTERFACE:include>
)
target_include_directories(${CMAKE_PROJECT_NAME} SYSTEM INTERFACE
target_include_directories(${CMAKE_PROJECT_NAME}-headers SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/modules/internal/xtensor-fftw/include>
$<INSTALL_INTERFACE:include>
)
......
......@@ -4,88 +4,72 @@
# Cmake options for dependencies
option( ${CMAKE_PROJECT_NAME}_USE_MPI "Set to ON to build ScalFMM with MPI" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_BLAS "Set to ON to build ScalFMM with BLAS" ON )
option( ${CMAKE_PROJECT_NAME}_USE_FFTW "Set to ON to build ScalFMM with FFTW" ON )
option( ${CMAKE_PROJECT_NAME}_USE_STARPU "Set to ON to build ${CMAKE_PROJECT_NAME} with StarPU" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_MKL "Set to ON to build ScalFMM with MKL" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_ESSL "Set to ON to build ScalFMM with ESSL" OFF )
# Cmake options related to trace, logging and statistics
option( ${CMAKE_PROJECT_NAME}_USE_LOG "Set to ON to print output debug information" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_MEM_STATS "Set to ON to profile memory" OFF )
option( ${CMAKE_PROJECT_NAME}_ONLY_DEVEL "Set to ON to compile Development tools (only scalfmm team)" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS "Set to ON to use static analysis" OFF )
if(${CMAKE_PROJECT_NAME}_USE_BLAS)
option( ${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS "Set to ON to use MKL BLAS/LAPACK" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_ESSL_AS_BLAS "Set to ON to use ESSL BLAS/LAPACK" OFF )
option( ${CMAKE_PROJECT_NAME}_USE_EXTERNAL_BLAS "Set to ON to use external BLAS. Please, set BLAS_LIBRARIES variable." OFF )
endif(${CMAKE_PROJECT_NAME}_USE_BLAS)
include(CMakeDependentOption)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_MKL_AS_FFTW "Set to ON to use MKL FFTW" ON "${CMAKE_PROJECT_NAME}_USE_FFTW;${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS" OFF )
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_ESSL_AS_FFTW "Set to ON to use ESSL FFTW" ON "${CMAKE_PROJECT_NAME}_USE_FFTW;${CMAKE_PROJECT_NAME}_USE_ESSL_AS_BLAS" OFF )
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_OPENCL "Set to ON to use OPENCL with StarPU" OFF "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_CUDA "Set to ON to use OPENCL with StarPU" OFF "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS "Set to ON to use static analysis tools" ON "${CMAKE_PROJECT_NAME}_ONLY_DEVEL" OFF )
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_CPPCHECK "Set to ON to use static analysis tools" OFF "${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS" OFF )
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_CLANGTIDY "Set to ON to use static analysis tools" ON "${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS" OFF )
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_IWYU "Set to ON to use static analysis tools" ON "${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS" OFF )
# Additional options for developers
if( ${CMAKE_PROJECT_NAME}_ONLY_DEVEL )
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
option( ${CMAKE_PROJECT_NAME}_USE_OMP4 "Set to ON to disable the gcc/intel omp4" OFF )
else()
option( ${CMAKE_PROJECT_NAME}_USE_OMP4 "Set to ON to disable the gcc/intel omp4" ON )
endif()
option( ${CMAKE_PROJECT_NAME}_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF )
# SIMGRID and peformance models options
option( ${CMAKE_PROJECT_NAME}_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
"${CMAKE_PROJECT_NAME}_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
"${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
endif()
#if( ${CMAKE_PROJECT_NAME}_ONLY_DEVEL )
#
# if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# option( ${CMAKE_PROJECT_NAME}_USE_OMP4 "Set to ON to disable the gcc/intel omp4" OFF )
# else()
# option( ${CMAKE_PROJECT_NAME}_USE_OMP4 "Set to ON to disable the gcc/intel omp4" ON )
# endif()
#
# option( ${CMAKE_PROJECT_NAME}_TIME_OMPTASKS "Set to ON to time omp4 tasks and generate output file" OFF )
#
# # SIMGRID and peformance models options
# option( ${CMAKE_PROJECT_NAME}_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
# "${CMAKE_PROJECT_NAME}_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
# "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
# cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_USE_COMMUTE "Set to ON to enable commute with StarPU" ON "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
# cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_USE_REDUX "Set to ON to enable redux with StarPU" OFF "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
# cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_USE_PRIO "Set to ON to enable priority with StarPU" ON "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
# cmake_dependent_option(${CMAKE_PROJECT_NAME}_STARPU_FORCE_NO_SCHEDULER "Set to ON to disable heteroprio even if supported" OFF "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
# cmake_dependent_option(${CMAKE_PROJECT_NAME}_USE_STARPU_EXTRACT "Set to ON to enable extract with StarPU mpi implicit" ON "${CMAKE_PROJECT_NAME}_USE_STARPU" OFF)
#endif()
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_FFTW = ${${CMAKE_PROJECT_NAME}_USE_FFTW}")
message( STATUS "${CMAKE_PROJECT_NAME}_USE_STARPU = ${${CMAKE_PROJECT_NAME}_USE_STARPU}")
message( STATUS "${CMAKE_PROJECT_NAME}_USE_MKL = ${${CMAKE_PROJECT_NAME}_USE_MKL}")
message( STATUS "${CMAKE_PROJECT_NAME}_USE_ESSL = ${${CMAKE_PROJECT_NAME}_USE_ESSL}")
# Cmake options related to trace, logging and statistics
message( STATUS "${CMAKE_PROJECT_NAME}_USE_LOG = ${${CMAKE_PROJECT_NAME}_USE_LOG}")
message( STATUS "${CMAKE_PROJECT_NAME}_USE_MEM_STATS = ${${CMAKE_PROJECT_NAME}_USE_MEM_STATS}")
message( STATUS "${CMAKE_PROJECT_NAME}_ONLY_DEVEL = ${${CMAKE_PROJECT_NAME}_ONLY_DEVEL}")
if(${CMAKE_PROJECT_NAME}_USE_BLAS)
message( STATUS "${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS = ${${CMAKE_PROJECT_NAME}_USE_MKL_AS_BLAS}")
message( STATUS "${CMAKE_PROJECT_NAME}_USE_ESSL_AS_BLAS = ${${CMAKE_PROJECT_NAME}_USE_ESSL_AS_BLAS}")
message( STATUS "${CMAKE_PROJECT_NAME}_USE_EXTERNAL_BLAS = ${${CMAKE_PROJECT_NAME}_USE_EXTERNAL_BLAS}")
endif(${CMAKE_PROJECT_NAME}_USE_BLAS)
if(${CMAKE_PROJECT_NAME}_USE_STARPU)
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)
if(${CMAKE_PROJECT_NAME}_ONLY_DEVEL)
message( STATUS "${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS = ${${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS }" )
message( STATUS "${CMAKE_PROJECT_NAME}_USE_CPPCHECK = ${${CMAKE_PROJECT_NAME}_USE_CPPCHECK}" )
message( STATUS "${CMAKE_PROJECT_NAME}_USE_CLANGTIDY = ${${CMAKE_PROJECT_NAME}_USE_CLANGTIDY}" )
message( STATUS "${CMAKE_PROJECT_NAME}_USE_IWYU = ${${CMAKE_PROJECT_NAME}_USE_IWYU}" )
endif(${CMAKE_PROJECT_NAME}_ONLY_DEVEL)
message( STATUS "${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS = ${${CMAKE_PROJECT_NAME}_USE_STATIC_ANALYSIS}" )
message( STATUS "${CMAKE_PROJECT_NAME}_USE_CPPCHECK = ${${CMAKE_PROJECT_NAME}_USE_CPPCHECK}" )
message( STATUS "${CMAKE_PROJECT_NAME}_USE_CLANGTIDY = ${${CMAKE_PROJECT_NAME}_USE_CLANGTIDY}" )
message( STATUS "${CMAKE_PROJECT_NAME}_USE_IWYU = ${${CMAKE_PROJECT_NAME}_USE_IWYU}" )
......@@ -42,11 +42,12 @@ foreach(exec ${source_tests_files})
# Dependency are OK
if( compile_exec )
add_executable( ${execname} EXCLUDE_FROM_ALL ${exec})
list(APPEND SCALFMM_EXAMPLES_TARGETS ${execname})
target_link_libraries( ${execname} ${CMAKE_PROJECT_NAME} ${TARGETS_TO_LINK})
list(APPEND ${CMAKE_PROJECT_NAME}_EXAMPLES_TARGETS ${execname})
target_link_libraries( ${execname} ${CMAKE_PROJECT_NAME}-headers ${TARGETS_TO_LINK})
target_compile_definitions( ${execname} PRIVATE ${COMPILE_DEFINITIONS_TO_ADD})
set_target_properties(${execname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BUILD_TYPE})
endif()
endforeach(exec)
add_custom_target(examples EXCLUDE_FROM_ALL ALL DEPENDS ${SCALFMM_EXAMPLES_TARGETS})
add_custom_target(examples EXCLUDE_FROM_ALL ALL DEPENDS ${${CMAKE_PROJECT_NAME}_EXAMPLES_TARGETS})
#-----------------------------------------------------------------------------
#
# SCALFMMConfig.cmake - SCALFMM CMake configuration file for external projects.
#
# This file is configured by SCALFMM and used by the SCALFMM.cmake module
# to load SCALFMM's settings for an external project.
#
@PACKAGE_INIT@
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@-core)
list(APPEND CMAKE_MODULE_PATH "@MORSE_INSTALL_PATH@")
include(MorseInit)
set(@PROJECT_NAME@-headers_DIR "@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@")
set(IMPORTED_LIBS @CORE_LIBRARIES@)
set(BLA_VENDOR @BLA_VENDOR@)
include(CMakeFindDependencyMacro)
foreach(lib IN LISTS IMPORTED_LIBS)
find_dependency(${lib})
if(NOT ${lib}_FOUND)
message(FATAL_ERROR "MISSING ${lib} DEPENDENCY !")
else()
message(STATUS "Found ${lib} dependency.")
endif()
endforeach()
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
endif()
......@@ -5,10 +5,8 @@
# This file is configured by SCALFMM and used by the SCALFMM.cmake module
# to load SCALFMM's settings for an external project.
#
@PACKAGE_INIT@
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@)
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@-headers)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
endif()
#-----------------------------------------------------------------------------
#
# SCALFMMConfig.cmake - SCALFMM CMake configuration file for external projects.
#
# This file is configured by SCALFMM and used by the SCALFMM.cmake module
# to load SCALFMM's settings for an external project.
#
@PACKAGE_INIT@
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@-mpi)
list(APPEND CMAKE_MODULE_PATH "@MORSE_INSTALL_PATH@")
include(MorseInit)
set(@PROJECT_NAME@-core_DIR "@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@")
set(IMPORTED_LIBS @MPI_LIBRARIES@)
set(BLA_VENDOR @BLA_VENDOR@)
include(CMakeFindDependencyMacro)
foreach(lib IN LISTS IMPORTED_LIBS)
find_dependency(${lib})
if(NOT ${lib}_FOUND)
message(FATAL_ERROR "MISSING ${lib} DEPENDENCY !")
else()
message(STATUS "Found ${lib} dependency.")
endif()
endforeach()
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
endif()
......@@ -13,11 +13,30 @@ set(source_tests_files
# Add execs - 1 cpp = 1 exec
foreach(exec ${source_tests_files})
set(compile_exec TRUE)
get_filename_component( execname ${exec} NAME_WE )
add_executable( ${execname} ${exec})
list(APPEND ${CMAKE_PROJECT_NAME}_TOOLS_TARGETS ${execname})
target_link_libraries( ${execname} ${CMAKE_PROJECT_NAME})
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 "${exec} needs ${fuse_key}, dependencies are not met." )
set(compile_exec FALSE)
elseif(lines_fuse AND ${fuse_key} IN_LIST FUSE_LIST)
message( STATUS "${exec} tool activated with ${fuse_key}." )
list(APPEND TARGETS_TO_LINK ${${fuse_key}_TARGET})
if(${fuse_key}_COMPILE_DEFINITIONS)
list(APPEND COMPILE_DEFINITIONS_TO_ADD ${${fuse_key}_COMPILE_DEFINITIONS})
endif()
endif()
endforeach()
# Dependency are OK
if( compile_exec )
add_executable( ${execname} EXCLUDE_FROM_ALL ${exec})
list(APPEND ${CMAKE_PROJECT_NAME}_TOOLS_TARGETS ${execname})
target_link_libraries( ${execname} ${CMAKE_PROJECT_NAME}-headers ${TARGETS_TO_LINK})
target_compile_definitions( ${execname} PRIVATE ${COMPILE_DEFINITIONS_TO_ADD})
set_target_properties(${execname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BUILD_TYPE})
endif()
endforeach(exec)
add_custom_target(tools ALL DEPENDS ${${CMAKE_PROJECT_NAME}_TOOLS_TARGETS})
......
#include "scalfmm/container/particle.hpp"
// @FUSE_OMP
#include "scalfmm/container/particle.hpp"
#include "scalfmm/container/particle_container.hpp"
#include "scalfmm/container/point.hpp"
#include <scalfmm/container/iterator.hpp>
......
......@@ -40,20 +40,21 @@ foreach(exec ${source_tests_files})
# Dependency are OK
if( compile_exec )
add_executable( unit.${execname} ${exec})
add_executable( unit.${execname} EXCLUDE_FROM_ALL ${exec})
list(APPEND SCALFMM_UNITS_TARGETS unit.${execname})