Commit 354b2de4 authored by Kirill Terekhov's avatar Kirill Terekhov

edit CMakeLists

Automatically switch off packages in cmake when related libraries are not found
parent 9689e3ce
......@@ -61,11 +61,10 @@ endif()
if(USE_MPI)
find_package(MPI)
if(NOT MPI_FOUND)
set(USE_MPI OFF)
set(USE_MPI OFF CACHE BOOL "Compile with MPI support" FORCE)
message("MPI NOT FOUND")
else()
include_directories(${MPI_INCLUDE_PATH})
set(USE_MPI ON)
set_target_properties(inmost PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
message("MPI FOUND")
endif()
......@@ -78,7 +77,7 @@ if(USE_OMP)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
message("OpenMP FOUND")
else()
set(USE_OMP OFF)
set(USE_OMP OFF CACHE BOOL "Compile with OpenMP support" FORCE)
message("OpenMP NOT FOUND")
endif()
endif()
......@@ -86,12 +85,11 @@ endif()
if(USE_PARTITIONER_PARMETIS)
find_package(ParMETIS)
if(NOT PARMETIS_FOUND)
set(USE_PARTITIONER_PARMETIS OFF)
set(USE_PARTITIONER_PARMETIS OFF CACHE BOOL "Use ParMetis partitioner" FORCE)
message("PARMETIS NOT FOUND")
else()
include_directories(${PARMETIS_INCLUDE_DIR})
include_directories(${METIS_INCLUDE_DIR})
set(USE_PARTITIONER_PARMETIS ON)
message("PARMETIS FOUND")
endif()
endif()
......@@ -99,11 +97,10 @@ endif()
if(USE_SOLVER_METIS)
find_package(METIS)
if(NOT METIS_FOUND)
set(USE_SOLVER_METIS OFF)
set(USE_SOLVER_METIS OFF CACHE BOOL "Use METIS for matrix reordering" FORCE)
message("METIS NOT FOUND")
else()
include_directories(${METIS_INCLUDE_DIR})
set(USE_SOLVER_METIS ON)
message("METIS FOUND")
endif()
endif()
......@@ -111,12 +108,11 @@ endif()
if(USE_SOLVER_MONDRIAAN)
find_package(MONDRIAAN)
if(NOT MONDRIAAN_FOUND)
set(USE_SOLVER_MONDRIAAN OFF)
set(USE_SOLVER_MONDRIAAN OFF CACHE BOOL "Use Mondriaan for matrix reordering" FORCE)
message("Mondriaan NOT FOUND")
else()
link_directories(${MONDRIAAN_LIBRARY_DIRS})
include_directories(${MONDRIAAN_INCLUDE_DIRS})
set(USE_SOLVER_MONDRIAAN ON)
message("Mondriaan FOUND")
endif()
endif()
......@@ -125,12 +121,11 @@ endif()
if(USE_PARTITIONER_ZOLTAN)
find_package(ZOLTAN)
if(NOT ZOLTAN_FOUND)
set(USE_PARTITIONER_ZOLTAN OFF)
set(USE_PARTITIONER_ZOLTAN OFF CACHE BOOL "Use Zoltan partitioner" FORCE)
message("ZOLTAN NOT FOUND")
else()
#include_directories(${ZOLTAN_INCLUDE_DIR})
include_directories(${ZOLTAN_INCLUDE_DIRS})
set(USE_PARTITIONER_ZOLTAN ON)
message("ZOLTAN FOUND")
endif()
endif()
......@@ -138,11 +133,10 @@ endif()
if(USE_SOLVER_PETSC)
find_package(PETSc)
if(NOT PETSC_FOUND)
set(USE_SOLVER_PETSC OFF)
set(USE_SOLVER_PETSC OFF CACHE BOOL "Use PETSc solvers" FORCE)
message("PETSC NOT FOUND")
else()
include_directories(${PETSC_INCLUDES})
set(USE_SOLVER_PETSC ON)
message("PETSC FOUND")
add_definitions(${PETSC_DEFINITIONS})
#message(${PETSC_LIBRARIES})
......@@ -154,7 +148,7 @@ if(USE_SOLVER_TRILINOS)
set(CMAKE_PREFIX_PATH ${TRILINOS_PATH} ${CMAKE_PREFIX_PATH})
find_package(Trilinos PATHS ${TRILINOS_PATH}/lib/cmake/Trilinos ${TRILINOS_PATH})
if(NOT Trilinos_FOUND)
set(USE_SOLVER_TRILINOS OFF)
set(USE_SOLVER_TRILINOS OFF CACHE BOOL "Use Trilinos solvers" FORCE)
message("Trilinos NOT FOUND")
else()
......@@ -178,7 +172,6 @@ if(USE_SOLVER_TRILINOS)
link_directories(${Trilinos_TPL_LIBRARY_DIRS})
set(USE_SOLVER_TRILINOS ON)
message("Trilinos FOUND")
endif()
endif()
......@@ -187,7 +180,7 @@ endif()
if(USE_SOLVER_SUPERLU)
find_package(SUPERLU)
if(NOT SUPERLU_FOUND)
set(USE_SOLVER_SUPERLU OFF)
set(USE_SOLVER_SUPERLU OFF CACHE BOOL "Use SuperLU solver" FORCE)
MESSAGE("SUPERLU NOT FOUND")
else()
MESSAGE("\nFound SuperLU! Here are the details: ")
......@@ -195,19 +188,16 @@ if(USE_SOLVER_SUPERLU)
MESSAGE("LIBRARIES: ${SUPERLU_LIBRARIES}")
include_directories(${SUPERLU_INCLUDES})
set(USE_SOLVER_SUPERLU ON)
endif()
endif()
if(USE_AUTODIFF_OPENCL)
find_package(OpenCL)
if(OPENCL_FOUND)
set(USE_AUTODIFF_OPENCL ON)
include_directories(${OPENCL_INCLUDE_DIRS})
link_directories(${PETSC_LIBRARY_DIRS})
else()
set(USE_AUTODIFF_OPENCL OFF)
set(USE_AUTODIFF_OPENCL OFF CACHE BOOL "Use OpenCL for automatic differentiation" FORCE)
message("OpenCL not found")
endif()
endif()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment