2022-09-26 07:38:03 +00:00
cmake_minimum_required ( VERSION 3.16 FATAL_ERROR )
2022-09-02 08:00:54 +00:00
# set the project name and version
2023-09-27 07:58:39 +00:00
project ( phasicFlow VERSION 1.0 )
2022-09-02 08:00:54 +00:00
2025-02-16 21:43:02 +00:00
set ( CMAKE_CXX_STANDARD 20 CACHE STRING "" FORCE )
2022-09-02 08:00:54 +00:00
set ( CMAKE_CXX_STANDARD_REQUIRED True )
set ( CMAKE_INSTALL_PREFIX ${ phasicFlow_SOURCE_DIR } CACHE PATH "Install path of phasicFlow" FORCE )
2025-02-16 21:43:02 +00:00
set ( CMAKE_BUILD_TYPE Release CACHE STRING "build type" )
2023-09-27 07:58:39 +00:00
set ( BUILD_SHARED_LIBS ON CACHE BOOL "Build using shared libraries" FORCE )
mark_as_advanced ( FORCE var BUILD_SHARED_LIBS )
2022-09-02 08:00:54 +00:00
2025-02-16 21:43:02 +00:00
message ( STATUS "Install prefix is:" ${ CMAKE_INSTALL_PREFIX } )
2022-09-02 08:00:54 +00:00
2023-09-27 07:58:39 +00:00
include ( cmake/globals.cmake )
option ( pFlow_STD_Parallel_Alg "Use TTB std parallel algorithms" ON )
2022-09-07 10:16:46 +00:00
option ( pFlow_Build_Serial "Build phasicFlow and backends for serial execution" OFF )
2022-09-02 08:00:54 +00:00
option ( pFlow_Build_OpenMP "Build phasicFlow and backends for OpenMP execution" OFF )
option ( pFlow_Build_Cuda "Build phasicFlow and backends for Cuda execution" OFF )
2023-09-27 07:58:39 +00:00
option ( pFlow_Build_Double "Build phasicFlow with double precision floating-oint variables" ON )
option ( pFlow_Build_MPI "Build for MPI parallelization. This will enable multi-gpu run, CPU run on clusters (distributed memory machine). Use this combination Cuda+MPI, OpenMP + MPI or Serial+MPI " OFF )
2022-09-02 08:00:54 +00:00
2025-02-16 21:43:02 +00:00
#for installing the required packages
include ( cmake/preReq.cmake )
2022-09-04 21:26:29 +00:00
if ( pFlow_Build_Serial )
2022-09-02 08:00:54 +00:00
set ( Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE )
set ( Kokkos_ENABLE_OPENMP OFF CACHE BOOL "OpenMP execution" FORCE )
set ( Kokkos_ENABLE_CUDA OFF CACHE BOOL "Cuda execution" FORCE )
set ( Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Cuda execution" FORCE )
2023-09-27 07:58:39 +00:00
set ( Kokkos_ENABLE_CUDA_CONSTEXPR OFF CACHE BOOL "Enable constexpr on cuda code" FORCE )
2022-09-04 21:26:29 +00:00
elseif ( pFlow_Build_OpenMP )
2022-09-02 08:00:54 +00:00
set ( Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE )
set ( Kokkos_ENABLE_OPENMP ON CACHE BOOL "OpenMP execution" FORCE )
set ( Kokkos_ENABLE_CUDA OFF CACHE BOOL "Cuda execution" FORCE )
set ( Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Cuda execution" FORCE )
2025-02-16 21:43:02 +00:00
set ( Kokkos_DEFAULT_HOST_PARALLEL_EXECUTION_SPACE Serial CACHE STRING "" FORCE )
set ( Kokkos_DEFAULT_DEVICE_PARALLEL_EXECUTION_SPACE OpenMP CACHE STRING "" FORCE )
2023-09-27 07:58:39 +00:00
set ( Kokkos_ENABLE_CUDA_CONSTEXPR OFF CACHE BOOL "Enable constexpr on cuda code" FORCE )
2022-09-04 21:26:29 +00:00
elseif ( pFlow_Build_Cuda )
2022-09-02 08:00:54 +00:00
set ( Kokkos_ENABLE_SERIAL ON CACHE BOOL "Serial execution" FORCE )
set ( Kokkos_ENABLE_OPENMP OFF CACHE BOOL "OpenMP execution" FORCE )
set ( Kokkos_ENABLE_CUDA ON CACHE BOOL "Cuda execution" FORCE )
set ( Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Cuda execution" FORCE )
2023-09-27 07:58:39 +00:00
set ( Kokkos_ENABLE_CUDA_CONSTEXPR ON CACHE BOOL "Enable constexpr on cuda code" FORCE )
2022-09-02 08:00:54 +00:00
endif ( )
2023-09-27 07:58:39 +00:00
if ( pFlow_Build_MPI )
find_package ( MPI REQUIRED )
endif ( )
2022-09-02 08:00:54 +00:00
include ( cmake/makeLibraryGlobals.cmake )
include ( cmake/makeExecutableGlobals.cmake )
configure_file ( phasicFlowConfig.H.in phasicFlowConfig.H )
2024-01-18 12:51:06 +00:00
set ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
2025-02-16 21:43:02 +00:00
2022-09-02 08:00:54 +00:00
#add a global include directory
include_directories ( src/setHelpers src/demComponent "${PROJECT_BINARY_DIR}" )
add_subdirectory ( src )
2024-01-29 15:58:19 +00:00
add_subdirectory ( solvers )
2022-09-02 08:00:54 +00:00
2024-01-21 21:26:23 +00:00
add_subdirectory ( utilities )
2023-01-30 13:45:05 +00:00
2024-12-27 15:56:09 +00:00
add_subdirectory ( DEMSystems )
2022-09-02 08:00:54 +00:00
install ( FILES "${PROJECT_BINARY_DIR}/phasicFlowConfig.H"
2023-09-27 07:58:39 +00:00
D E S T I N A T I O N i n c l u d e )
2022-09-02 08:00:54 +00:00
include ( InstallRequiredSystemLibraries )
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" )
set ( CPACK_PACKAGE_VERSION_MAJOR "${phasicFlow_VERSION_MAJOR}" )
set ( CPACK_PACKAGE_VERSION_MINOR "${phasicFlow_VERSION_MINOR}" )
include ( CPack )
2022-12-09 22:02:54 +00:00