CMakeLists.txt 1.82 KB
Newer Older
1 2
cmake_minimum_required(VERSION 3.0)
project(FLEUR LANGUAGES Fortran)
Daniel Wortmann's avatar
Daniel Wortmann committed
3

4 5 6 7 8 9
#These options should be adjusted
option(JUDFT_USE_MPI "Compile with MPI, will also work in serial" OFF)
option(JUDFT_USE_HDF5 "Compile HDF5 tools" OFF)
option(JUDFT_USE_HDF5MPI "Is the HDF5 version able to do parallel IO" OFF)
option(JUDFT_USE_COLLECT "Collect usage data" ON)
option(JUDFT_USE_DEBUG "Set CPP_DEBUG when compiling code" OFF)
10
option(JUDFT_COMPILE_HDF5 "HDF5 is compiled as submodule" OFF)
11 12 13
#In addition you might want to set
#set(JUDFT_LIBRARIES "-lsomething")
#set(JUFDT_COMPILEOPTS "-r8")
Daniel Wortmann's avatar
Daniel Wortmann committed
14 15


16
if (${JUDFT_USE_HDF5})
17
set(judft_HDF 
18 19 20 21 22 23 24 25
hdf_accessprp.F90
hdf_tools.F90
hdf_tools_attr.F90
hdf_tools_exists.F90
hdf_tools_misc.F90
hdf_tools_rw.F90
hdf_tools_rw_var.F90
hdf_tools_stride.F90)
26 27
else()
set(judft_HDF "")
28
endif()
29 30 31

add_library(juDFT STATIC
${judft_HDF} 
32 33 34 35 36 37 38 39 40 41
usage_data.F90
info.F90
init.F90
juDFT.F90
stop.F90
string.f90
time.F90
args.F90
sysinfo.F90
check_arguments.F90
Matthias Redies's avatar
Matthias Redies committed
42
check_para.F90
43
xmlOutput.F90
44
)
45 46 47 48 49
if (JUDFT_USE_MPI) 
  target_compile_definitions(juDFT PUBLIC CPP_MPI)
endif()
if (JUDFT_USE_HDF5)
  target_compile_definitions(juDFT PUBLIC CPP_HDF)
50 51 52
  if (JUDFT_COMPILE_HDF5) 
      target_link_libraries(juDFT PUBLIC hdf5_fortran-static)
  endif() 
53 54 55
endif()
if (JUDFT_USE_HDF5MPI)
  target_compile_definitions(juDFT PUBLIC CPP_HDFMPI)
56
endif()
57 58 59 60 61 62 63 64 65 66 67 68
if (JUDFT_USE_COLLECT)
  target_compile_definitions(juDFT PUBLIC CPP_ALLOW_USAGE_DATA)
endif()
if (JUDFT_USE_DEBUG)
  target_compile_definitions(juDFT PUBLIC CPP_DEBUG)
endif()

if (DEFINED JUDFT_LIBRARIES )
   target_link_libraries(juDFT ${JUDFT_LIBRARIES})
endif()

if (DEFINED JUDFT_COMPILEOPTS )
69
  target_compile_options(juDFT PRIVATE ${JUDFT_COMPILEOPTS})
70 71 72 73
endif()

#Set module directories
include_directories("${CMAKE_CURRENT_BINARY_DIR}/modules/juDFT")
Daniel Wortmann's avatar
Daniel Wortmann committed
74
set_target_properties(juDFT PROPERTIES Fortran_MODULE_DIRECTORY modules/juDFT)