Commit 3bfba972 authored by Daniel Wortmann's avatar Daniel Wortmann

Modified cmake to include libxc and to fix bugs and problems. Now only one of...

Modified cmake to include libxc and to fix bugs and problems. Now only one of fleur or fleur_MPI are build by default.
parent ffc25c9d
......@@ -15,7 +15,6 @@ include("cmake/Generate_Schema.cmake")
include("cmake/Files_and_Targets.txt")
include("cmake/filespecific.cmake")
include("cmake/hdf5-subproject.cmake")
include("cmake/ReportConfig.txt")
......
......@@ -22,4 +22,6 @@ include("cmake/tests/test_ELPA.cmake")
include("cmake/tests/test_ChASE.cmake")
endif()
include("cmake/tests/test_juDFT.cmake")
include("cmake/compileenv.txt")
......@@ -20,7 +20,6 @@ include(xc-pot/CMakeLists.txt)
include(cdn/CMakeLists.txt)
include(diagonalization/CMakeLists.txt)
include(eigen_soc/CMakeLists.txt)
include(juDFT/CMakeLists.txt)
include(math/CMakeLists.txt)
include(orbdep/CMakeLists.txt)
include(cdn_mt/CMakeLists.txt)
......@@ -81,13 +80,6 @@ if (${FLEUR_USE_SERIAL})
target_link_libraries(fleur ${FLEUR_LIBRARIES})
target_link_libraries(fleur juDFT)
set_target_properties(fleur PROPERTIES Fortran_MODULE_DIRECTORY modules/fleur COMPILE_OPTIONS -Imodules/fleur)
#inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen})
target_compile_definitions(inpgen PUBLIC ${FLEUR_DEFINITIONS})
target_compile_options(inpgen PUBLIC ${FLEUR_PRECISION_OPTION})
target_link_libraries(inpgen ${FLEUR_LIBRARIES})
target_link_libraries(inpgen juDFT)
set_target_properties(inpgen PROPERTIES Fortran_MODULE_DIRECTORY modules/inpgen COMPILE_OPTIONS -Imodules/inpgen)
endif()
#parallel executables
if(${FLEUR_USE_MPI})
......@@ -100,15 +92,23 @@ if(${FLEUR_USE_MPI})
set_target_properties(fleur_MPI PROPERTIES Fortran_MODULE_DIRECTORY modules/fleur_MPI COMPILE_OPTIONS -Imodules/fleur_MPI)
endif ()
#inpgen executable
add_executable(inpgen ${inpgen_F77} ${inpgen_F90} ${juDFT_SRC_F90} ${c_filesInpgen})
target_compile_definitions(inpgen PUBLIC ${FLEUR_DEFINITIONS})
target_compile_options(inpgen PUBLIC ${FLEUR_PRECISION_OPTION})
target_link_libraries(inpgen ${FLEUR_LIBRARIES})
target_link_libraries(inpgen juDFT)
set_target_properties(inpgen PROPERTIES Fortran_MODULE_DIRECTORY modules/inpgen COMPILE_OPTIONS -Imodules/inpgen)
if (${FLEUR_USE_SERIAL})
install(TARGETS fleur inpgen
CONFIGURATIONS Release
DESTINATION bin)
endif()
if (${FLEUR_USE_MPI})
install(TARGETS fleur_MPI
CONFIGURATIONS Release
DESTINATION bin)
endif()
#if (${FLEUR_USE_SERIAL})
#install(TARGETS fleur inpgen
# CONFIGURATIONS Release
# DESTINATION bin)
#endif()
#if (${FLEUR_USE_MPI})
#install(TARGETS fleur_MPI
# CONFIGURATIONS Release
# DESTINATION bin)
#endif()
......@@ -22,6 +22,7 @@ do
-magma) shift; CLI_USE_MAGMA=$1;;
-gpu) shift; CLI_USE_GPU=$1;;
-chase) shift; CLI_USE_CHASE=$1;;
-libxc) shift; CLI_USE_LIBXC=$1;;
-link) shift; CLI_LIBRARIES=$1;;
-libdir) shift; CLI_LIBDIR="$CLI_LIBDIR $1";;
-flags) shift; CLI_FLAGS=$1;;
......@@ -81,10 +82,11 @@ General options:
-cmake_opts # : additional options for cmake can be specified here directly
Command line options to switch on/off features. These options overwrite the results of
the test and might lead to the configuration to fail.
the test and might lead to the configuration to fail.
-hdf5 [TRUE|FALSE] : use HDF5 library
-wannier [TRUE|FALSE] : use Wannier90 library
-mpi [TRUE|FALSE] : compile the MPI parallel version
-libxc [TRUE|FALSE] : use libxc library
Command line option to compile external libraries:
-external # : download and compile external libraries before building FLEUR
......
......@@ -101,11 +101,14 @@ then
echo "set(CLI_FLEUR_USE_GPU $CLI_USE_GPU)" >>config.cmake
fi
if [ "$CLI_USE_LIBXC" ]
then
echo "set(CLI_FLEUR_USE_LIBXC $CLI_USE_LIBXC)" >>config.cmake
fi
if [ "$CLI_USE_SERIAL" ]
then
echo "set(FLEUR_USE_SERIAL $CLI_USE_SERIAL)" >>config.cmake
else
echo "set(FLEUR_USE_SERIAL TRUE)" >>config.cmake
echo "set(CLI_FLEUR_USE_SERIAL $CLI_USE_SERIAL)" >>config.cmake
fi
if [ "$CLI_ELPA_OPENMP" ]
......
......@@ -34,9 +34,36 @@ message("HDF5 Library found:${FLEUR_USE_HDF5}")
if (DEFINED CLI_FLEUR_USE_HDF5)
if (CLI_FLEUR_USE_HDF5)
if (NOT FLEUR_USE_HDF5)
set(FLEUR_HDF5_SUBMODULE TRUE)
message(WARNING "You asked for HDF5 but cmake couldn't find it. We will try to download and compile HDF5 along with FLEUR")
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/hdf5-git/src" )
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init external/hdf5-git WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _res_init OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _res_update OUTPUT_QUIET ERROR_QUIET)
if( ${_res_init} GREATER 0 OR ${_res_update} GREATER 0 )
message(FATAL_ERROR "HDF5 source could not be downloaded.\n"
"We tried: 'git submodule init external/hdf5-git && git submodule update' and resulted in error" )
endif()
endif()
set(HDF5_EXTERNALLY_CONFIGURED 1)
set(HDF5_EXPORTED_TARGETS "hdf5_fortran-static")
set(HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support")
set(HDF5_BUILD_CPP_LIB OFF CACHE BOOL "Build HDF5 C++ Library")
set(HDF5_BUILD_HL_LIB OFF CACHE BOOL "Build HIGH Level HDF5 Library")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries")
set(HDF5_BUILD_TOOLS OFF CACHE BOOL "Build HDF5 Tools")
set(HDF5_BUILD_EXAMPLES OFF CACHE BOOL "Build HDF5 Library Examples")
set(BUILD_TESTING OFF CACHE BOOL "Build HDF5 Unit Testing")
if (FLEUR_USE_MPI)
set(HDF5_ENABLE_PARALLEL ON CACHE BOOL "Enable parallel build (requires MPI)")
else()
set(HDF5_ENABLE_PARALLEL OFF CACHE BOOL "Enable parallel build (requires MPI)")
endif()
set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5")
add_subdirectory (external/hdf5-git EXCLUDE_FROM_ALL)
set(FLEUR_USE_HDF5 TRUE)
message(WARNING "You asked for HDF5 but cmake couldn't find it. We will try to compile HDF5 along with FLEUR")
set(FLEUR_USE_HDF5MPI FLEUR_USE_MPI)
set(FLEUR_LIBRARIES "${FLEUR_LIBRARIES};hdf5_fortran-static")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5/static")
endif()
else()
if (FLEUR_USE_HDF5)
......
......@@ -3,6 +3,41 @@ try_compile(FLEUR_USE_LIBXC ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/
LINK_LIBRARIES ${FLEUR_LIBRARIES}
)
if (DEFINED CLI_FLEUR_USE_LIBXC)
if (CLI_FLEUR_USE_LIBXC)
if (NOT FLEUR_USE_LIBXC)
message("You asked for LibXC support but cmake couldn't find it. We will try to download and compile along with FLEUR")
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/external/libxc-git/src" )
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init external/libxc-git WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _res_init OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} RESULT_VARIABLE _res_update OUTPUT_QUIET ERROR_QUIET)
if( ${_res_init} GREATER 0 OR ${_res_update} GREATER 0 )
message(FATAL_ERROR "HDF5 source could not be downloaded.\n"
"We tried: 'git submodule init external/libxc-git && git submodule update' and resulted in error" )
endif()
endif()
#patch libxc
execute_process(COMMAND "sh" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/external/libxc-git" INPUT_FILE "${PROJECT_SOURCE_DIR}/external/patch-libxc.sh")
message("libxc was patched")
set(ENABLE_FORTRAN ON CACHE BOOL "Build Fortran 90 interface")
set(ENABLE_FORTRAN03 ON CACHE BOOL "Build Fortran 2003 interface")
add_subdirectory (external/libxc-git EXCLUDE_FROM_ALL)
set(FLEUR_USE_LIBXC TRUE)
set(FLEUR_LIBRARIES "${FLEUR_LIBRARIES};xcf90;xcf03")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -I${CMAKE_CURRENT_BINARY_DIR}/external/libxc-git")
endif()
else()
if (FLEUR_USE_LIBXC)
message("LibXC found but you explicitely asked not to use it")
set(FLEUR_USE_LIBXC FALSE)
endif()
endif()
endif()
message("Libxc Library found:${FLEUR_USE_LIBXC}")
if (FLEUR_USE_LIBXC)
......
......@@ -20,4 +20,11 @@ endif()
if (FLEUR_USE_MPI)
set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_MPI")
set(FLEUR_USE_SERIAL FALSE)
else()
set(FLEUR_USE_SERIAL TRUE)
endif()
if (DEFINED CLI_FLEUR_USE_SERIAL)
set(FLEUR_USE_SERIAL CLI_FLEUR_USE_SERIAL)
endif()
\ No newline at end of file
This diff is collapsed.
mv src/libxc_master.F03 src/libxc_master_03.F90
cp ../patch-libxc.cmake CMakeLists.txt
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