diff --git a/README.md b/README.md index df3e5d7ca8ded55aaaa079eb25e2151328bd50a3..b164756a7f1644131589c200d6c29cc10ae108ef 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,8 @@ And if you know the microarchitecture, such as cascade lake for example, you can When you add architecture flags, SIMD flags are automatically triggered. ## Using ScalFMM in your project - +You can integrate ScalFMM as a package after its intalation or as an header only library. +### with find_package To find ScalFMM, `pkgconfig` can be used within your CMake and all ScalFMM dependencies will be found automatically. Here is an example : @@ -181,6 +182,46 @@ endif() - `scalfmm::scalfmm-headers` with only the headers, requires full configuration and linking with dependencies on your side. - `scalfmm::scalfmm-mpi` and `scalfmm::scalfmm-starpu` (UNDER DEVELOPMENT) with distributed support. +### header only +It's a bit trickier, remembering that ScalFMM depends on OpenMP, Lapack/Blas and fftw. +The first step is to define a scalfmm target as follows +```cmake +set(SCALFMM_DIR "$ENV{SCALFMM_DIR}") +add_library(scalfmm INTERFACE) +target_compile_definitions(scalfmm INTERFACE ENABLE_XTL_COMPLEX HAVE_CBLAS=1 XSIMD_ENABLE_XTL_COMPLEX XTENSOR_DISABLE_EXCEPTIONS XTENSOR_FFTW_USE_DOUBLE XTENSOR_FFTW_USE_FLOAT XTENSOR_USE_XSIMD) +target_compile_features(scalfmm INTERFACE cxx_std_17) +target_include_directories(scalfmm INTERFACE "${SCALFMM_DIR}/include" "${SCALFMM_DIR}/modules/internal/inria_tools" "${SCALFMM_DIR}/modules/internal/xtensor-fftw/include" +"${SCALFMM_DIR}/modules/internal/cpp_tools/colors/include" "${SCALFMM_DIR}/modules/internal/cpp_tools/timers/include" +"${SCALFMM_DIR}/modules/internal/cpp_tools/cl_parser/include" "${SCALFMM_DIR}/modules/internal/xsimd/include" +"${SCALFMM_DIR}/modules/internal/xtensor/include" "${SCALFMM_DIR}/modules/internal/xtensor-blas/include" +"${SCALFMM_DIR}/modules/internal/xtl/include" +) +``` +Then +```cmake +include (FindPkgConfig REQUIRED) +find_package(OpenMP REQUIRED) +if(NOT OpenMP_CXX_FOUND) + message(WARNING " OPENMP NOT FOUND ") + target_compile_definitions(scalfmm INTERFACE SCAL_USE_SEQ) +endif(NOT OpenMP_CXX_FOUND) + +pkg_search_module(FFTW REQUIRED fftw3 IMPORTED_TARGET) +pkg_search_module(FFTWF REQUIRED fftw3f IMPORTED_TARGET) +list(APPEND FFTW_TARGET PkgConfig::FFTW) +list(APPEND FFTW_TARGET PkgConfig::FFTWF) + +set(BLA_VENDOR "OpenBLAS") +find_package(BLAS REQUIRED) +find_package(LAPACK REQUIRED) +``` + +Finally, to build `your_target` you juste need th add the scalfmm target as follows +```cmake +target_link_libraries(your-target scalfmm LAPACK::LAPACK BLAS::BLAS ${FFTW_TARGET} OpenMP::OpenMP_CXX ) +``` + + ## Building the Doc The doc can be found [here](https://solverstack.gitlabpages.inria.fr/ScalFMM/) or you can build it locally.