CMakeLists.txt 2.14 KB
Newer Older
1
2
3
4
5
6
7
8

cmake_minimum_required(VERSION 2.8.0)

project(Systems Fortran)

find_package(LAPACK REQUIRED)

# looking for mumps
Rémy Mozul's avatar
Rémy Mozul committed
9
10
11
12
13
14
15
16
17
18
19
20
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 )
21
22
23


# looking for petsc
Rémy Mozul's avatar
Rémy Mozul committed
24
25
26
27
28
29
30
31
32
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 )
33
34

# mumps example
Rémy Mozul's avatar
Rémy Mozul committed
35
36
if( MUMPS_FOUND )
  include_directories(${MUMPS_INCLUDE_DIR})
37
38
39
40
41
42
  
  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
43
endif( MUMPS_FOUND )
44
45

# petsc example
Rémy Mozul's avatar
Rémy Mozul committed
46
47
48
49
50
51
if( PETSC_FOUND )

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

  include_directories(${PETSC_C_INCLUDE_DIR})
  include_directories(${PETSC_F_INCLUDE_DIR})
52
53
  
  add_library( petscAlgebra dataStructure.f90 petsc_binding.f90)
Rémy Mozul's avatar
Rémy Mozul committed
54
  target_link_libraries( petscAlgebra ${PETSC_LIBRARIES} )
55
56
57
  
  add_executable( petscTest reference_test.f90 )
  target_link_libraries( petscTest petscAlgebra )
Rémy Mozul's avatar
Rémy Mozul committed
58
endif( PETSC_FOUND )