CMakeLists.txt 3.08 KB
Newer Older
1 2 3

cmake_minimum_required(VERSION 2.8.0)

Rémy Mozul's avatar
Rémy Mozul committed
4
project(Systems Fortran C)
5 6 7

find_package(LAPACK REQUIRED)

Rémy Mozul's avatar
Rémy Mozul committed
8 9
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fopenmp")

10
# looking for mumps
Rémy Mozul's avatar
Rémy Mozul committed
11 12 13 14 15 16 17 18 19 20 21 22
if( MP )
  message(STATUS "looking for mumps in ${MP}")
  find_library(MUMPS_FOUND dmumps HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
  find_library(MUMPS_COMMON_FOUND mumps_common HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
  find_library(PORD_FOUND pord HINTS ${MP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
  find_library(MPISEQ_FOUND mpiseq HINTS ${MP} PATH_SUFFIXES lib libseq REQUIRED)
  find_path(MUMPS_INCLUDE_DIR dmumps_struc.h NO_DEFAULT_PATH HINTS ${MP} ${MD} PATH_SUFFIXES include)
  
  set(MUMPS_LIBRARIES ${MUMPS_FOUND} ${MUMPS_COMMON_FOUND} ${PORD_FOUND} ${MPISEQ_FOUND})
  message(STATUS "MUMPs LIBRARIES: ${MUMPS_LIBRARIES}")
  message(STATUS "MUMPs INCLUDE  : ${MUMPS_INCLUDE_DIR}")
endif( MP )
23 24 25


# looking for petsc
Rémy Mozul's avatar
Rémy Mozul committed
26 27 28 29 30 31 32 33 34
if( PP )
  message(STATUS "looking for petsc in ${PP}")
  find_library(PETSC_FOUND petsc HINTS ${PP} PATH_SUFFIXES lib NO_DEFAULT_PATH REQUIRED)
  find_path(PETSC_C_INCLUDE_DIR petsc.h NO_DEFAULT_PATH HINTS ${PP} PATH_SUFFIXES include)
  find_path(PETSC_F_INCLUDE_DIR finclude/petsc.h90 NO_DEFAULT_PATH HINTS ${PP} PATH_SUFFIXES include/petsc)
  set(PETSC_LIBRARIES ${PETSC_FOUND})
  message(STATUS "PETSc LIBRARIES: ${PETSC_LIBRARIES}")
  message(STATUS "PETSc INCLUDE  : ${PETSC_C_INCLUDE_DIR} ${PETSC_F_INCLUDE_DIR}")
endif( PP )
35

Rémy Mozul's avatar
Rémy Mozul committed
36 37 38 39 40 41 42 43 44
# looking for umfpack
if( UP )
  message(STATUS "looking for umfpack")
  find_library(UMFPACK_FOUND umfpack REQUIRED)
  find_path(UMFPACK_INCLUDE_DIR umfpack.h)
  message(STATUS "UMFPACK LIBRARIES: ${UMFPACK_FOUND}")
  message(STATUS "UMFPACK INCLUDE  : ${UMFPACK_INCLUDE_DIR}")
endif( UP )

45
# mumps example
Rémy Mozul's avatar
Rémy Mozul committed
46 47
if( MUMPS_FOUND )
  include_directories(${MUMPS_INCLUDE_DIR})
48 49 50 51 52 53
  
  add_library( mumpsAlgebra dataStructure.f90 mumps_binding.f90)
  target_link_libraries( mumpsAlgebra ${MUMPS_LIBRARIES} ${LAPACK_LIBRARIES})
  
  add_executable( mumpsTest reference_test.f90 )
  target_link_libraries( mumpsTest mumpsAlgebra )
Rémy Mozul's avatar
Rémy Mozul committed
54
endif( MUMPS_FOUND )
55 56

# petsc example
Rémy Mozul's avatar
Rémy Mozul committed
57 58 59 60 61 62
if( PETSC_FOUND )

  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")

  include_directories(${PETSC_C_INCLUDE_DIR})
  include_directories(${PETSC_F_INCLUDE_DIR})
63 64
  
  add_library( petscAlgebra dataStructure.f90 petsc_binding.f90)
Rémy Mozul's avatar
Rémy Mozul committed
65
  target_link_libraries( petscAlgebra ${PETSC_LIBRARIES} )
66 67 68
  
  add_executable( petscTest reference_test.f90 )
  target_link_libraries( petscTest petscAlgebra )
Rémy Mozul's avatar
Rémy Mozul committed
69
endif( PETSC_FOUND )
Rémy Mozul's avatar
Rémy Mozul committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

# umfpack example
if( UMFPACK_FOUND )

  include_directories(${UMFPACK_INCLUDE_DIR})
  include_directories(${CMAKE_CURRENT_SOURCE_DIR})

  add_library(cbind umfpack_cbinding.c)
  target_link_libraries( cbind ${UMFPACK_FOUND})

  add_library( umfpackAlgebra dataStructure.f90 umfpack_binding.f90)
  target_link_libraries( umfpackAlgebra cbind )

  add_executable( umfpackTest reference_test.f90 )
  target_link_libraries( umfpackTest umfpackAlgebra )

  # simple C example of use
  add_executable( umfpackCTest umfpack_test.c )
  target_link_libraries( umfpackCTest ${UMFPACK_FOUND})

endif( UMFPACK_FOUND )