cmake.ifort.config 1.75 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
#generic Makefile for the ifort compiler

enable_language(C Fortran)
set (Fleur_uses_serial TRUE)
find_package(LibXml2 REQUIRED)
find_package(LAPACK REQUIRED)
find_package(MPI)
find_package(HDF5)

set(CMAKE_C_FLAGS "-I${LIBXML2_INCLUDE_DIR}")

#MPI can be switched off with NO_MPI variable
if (NOT DEFINED ENV{NO_MPI} )
      if (MPI_Fortran_FOUND)
         set(Fleur_uses_MPI TRUE)
      endif()
else ()
       set(Fleur_uses_MPI FALSE)
endif ()

#Check for HDF5
if ((NOT DEFINED ENV{NO_HDF}) AND (DEFINED ENV{HDF5_ROOT})) 
  set (HDF5_INCL "-I$ENV{HDF5_ROOT}/include")
  set(HDF5_LIBS "-L$ENV{HDF5_ROOT}/lib -lhdf5_fortran -lhdf5 -lz")
  set(Fleur_uses_HDF5 TRUE)
  add_definitions(-DCPP_HDF)
else ()
  message("No hdf support found")
  message("You might want to set HDF5_ROOT")
endif ()


#The Fortran compile flags
set(CMAKE_Fortran_FLAGS "${HDF5_INCL} -mkl -warn nousage -assume byterecl -r8 " )
set(CMAKE_Fortran_FLAGS_RELEASE " -O3 -xHost -openmp" )    
set(CMAKE_Fortran_FLAGS_DEBUG   " -traceback -ftrapuv -CB -openmp -O0 -g" )

set(LAPACK_LIBS  "-lxml2 -mkl -lmatmul -openmp -lpthread")

if (DEFINED ENV{SCALAPACK_ROOT})
   set(Fleur_uses_SCALAPACK TRUE)
   set(LAPACK_LIBS "${LAPACK_LIBS} -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64")
endif() 

if (DEFINED ENV{ELPA_ROOT})
    set(Fleur_uses_ELPA TRUE)
    set(LAPACK_LIBS "${LAPACK_LIBS} -L$ENV{ELPA_ROOT}/lib -lelpa_openmp -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -lstdc++")
    set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I$ENV{ELPA_ROOT}/include")
endif()

if (DEFINED ENV{ELEMENTAL_ROOT})
   set(Fleur_uses_ELEMENTAL TRUE)
   set(LAPACK_LIBS "${LAPACK_LIBS} fleur_elemental.o -L$ENV{ELEMENTAL_ROOT}/lib -lelemental -lpmrrr -llapack-addons -lstdc++") 
endif()



add_definitions(-DCPP_IO -DCPP_DOUBLE -DCPP_APC)