Commit 07a5d74c authored by Daniel Wortmann's avatar Daniel Wortmann

Updated cmake for HDF as subproject

parent 26f1a13a
......@@ -10,15 +10,16 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${tmp}")
include("cmake/CompilerConfig.txt")
include("cmake/ReportConfig.txt")
include("cmake/Generate_Schema.cmake")
include("cmake/Files_and_Targets.txt")
include("cmake/filespecific.cmake")
include("cmake/hdf5-subproject.cmake")
include("cmake/ReportConfig.txt")
#install(TARGETS fleur inpgen DESTINATION bin)
......
if (FLEUR_HDF5_SUBMODULE)
set(HDF5_EXTERNALLY_CONFIGURED ON)
#set(HDF5_EXTERNAL_LIB_PREFIX "fleur")
set(HDF5_ENABLE_F2003 ON)
set(HDF5_ENABLE_FORTRAN ON)
set(HDF5_BUILD_FORTRAN ON)
set(HDF5_BUILD_CPP_LIB OFF)
set(HDF5_BUILD_HL_LIB OFF)
set(HDF5_ENABLE_Z_LIB_SUPPORT OFF)
set(HDF5_ENABLE_SZIP_SUPPORT OFF)
set(BUILD_STATIC_LIBS ON)
set(HDF5_ENABLE_PARALLEL FLEUR_USE_MPI)
#get source code
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()
#configure HDF5
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(HDF5_F90_BINARY_DIR "${CMAKE_SOURCE_DIR}/external/hdf5-git/fortran/")
#set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5")
set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5")
#set(CMAKE_Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/external/hdf5/CMake-hdf5-1.10.3/HDF_Group/HDF5/1.10.3/include/")
add_subdirectory (external/hdf5-git)
#Now set all the FLEUR specific stuff
if(${FLEUR_USE_MPI})
target_link_libraries(fleur_MPI hdf5_fortran-static)
target_compile_definitions(fleur_MPI PUBLIC "CPP_HDF5MPI")
target_compile_definitions(fleur_MPI PUBLIC "CPP_HDF")
target_compile_definitions(juDFT PUBLIC "CPP_HDF5MPI")
target_compile_options(fleur_MPI PUBLIC "-I${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5/static")
endif()
if (${FLEUR_USE_SERIAL})
target_link_libraries(fleur hdf5_fortran-static)
target_link_libraries(inpgen hdf5_fortran-static)
target_compile_definitions(fleur PUBLIC "CPP_HDF")
target_compile_options(fleur PUBLIC "-I${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5/static")
endif()
target_link_libraries(juDFT hdf5_fortran-static)
target_link_libraries(juDFT hdf5-static)
target_compile_definitions(juDFT PUBLIC "CPP_HDF")
set (FLEUR_USE_HDF 1)
target_compile_options(juDFT PUBLIC "-I${CMAKE_CURRENT_BINARY_DIR}/modules/hdf5/static")
endif()
......@@ -31,10 +31,12 @@ endif()
message("HDF5 Library found:${FLEUR_USE_HDF5}")
if (DEFINED CLI_FLEUR_USE_HDF5})
if (CLI_FLEUR_USE_HDF5})
if (DEFINED CLI_FLEUR_USE_HDF5)
if (CLI_FLEUR_USE_HDF5)
if (NOT FLEUR_USE_HDF5)
message(FATAL_ERROR "You asked for HDF5 but cmake couldn't find it. Please set HDF5_ROOT and or give additional compiler/linker flags")
set(FLEUR_HDF5_SUBMODULE TRUE)
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")
endif()
else()
if (FLEUR_USE_HDF5)
......
......@@ -148,6 +148,7 @@ CONTAINS
INTEGER :: nprow,npcol,myrow,mycol,block_row,block_col,matsize,blacs_ctxt,err
LOGICAL :: ok
!For readability get data from blacsdesc
#ifdef CPP_MPI
blacs_ctxt=blacsdesc(2)
block_row=blacsdesc(5)
block_col=blacsdesc(6)
......@@ -171,5 +172,6 @@ CONTAINS
CALL h5sselect_valid_f(sid,ok,err)
IF (.NOT.ok) CALL judft_error("Writing of matrix failed, BUG in parallel HDF-IO")
ENDIF
#endif
END SUBROUTINE priv_create_hyperslab_from_blacsdesc
END MODULE m_iomatrix_hdf
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