# Choose some code based on whether we're parallel or serial. if (USE_MPI) set(VER parallel) else() set(VER serial) endif() # Compile flags. if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-form -ffree-line-length-none") if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "10") set(CMAKE_Fortran_FLAGS_DEBUG "-fallow-argument-mismatch") set(CMAKE_Fortran_FLAGS_RELEASE "-fallow-argument-mismatch") endif() else() # Intel set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpe0 -traceback -r8 -i4 -free -CB") endif() else() if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-form -ffree-line-length-none") if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "10") set(CMAKE_Fortran_FLAGS_DEBUG "-fallow-argument-mismatch") set(CMAKE_Fortran_FLAGS_RELEASE "-fallow-argument-mismatch") endif() else() # Intel set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpe0 -r8 -i4 -free") endif() endif() add_subdirectory(t2_solver_interface) add_subdirectory(mpi_interface) include_directories(${PROJECT_BINARY_DIR}/src/t2_solver_interface ${PROJECT_BINARY_DIR}/src/mpi_interface) set(interface_libraries toughlib_t2_solver_core) if (USE_PETSC) add_subdirectory(petsc_interface) include_directories(${PROJECT_BINARY_DIR}/src/petsc_interface ${PETSC_INCLUDES}) set(interface_libraries ${interface_libraries} toughlib_petsc_core) endif() if (USE_MPI) add_subdirectory(metis_interface) include_directories(${PROJECT_BINARY_DIR}/src/metis_interface) set(interface_libraries ${interface_libraries} toughlib_metis_core) add_subdirectory(aztec_interface) include_directories(${PROJECT_BINARY_DIR}/src/aztec_interface) set(interface_libraries ${interface_libraries} toughlib_aztec_core) endif() # Solver interface add_library(toughlib_solver_core solver_core.f90) target_link_libraries(toughlib_solver_core ${interface_libraries} ${TOUGHLIB_TPL_LIB}) install(TARGETS toughlib_solver_core DESTINATION lib) install(FILES ${PROJECT_BINARY_DIR}/src/solver_core.mod DESTINATION include)