2020-01-10 18:19:06 +08:00
|
|
|
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
|
|
|
# CMake < 3.13 cannot install external targets:
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/merge_requests/2152
|
|
|
|
|
|
|
|
# CMake < 3.14 generates incorrect dependency graphs with
|
|
|
|
# alias targets:
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/merge_requests/2521
|
|
|
|
|
2019-05-25 23:58:54 +08:00
|
|
|
# Policy CMP0048: The project() command manages VERSION variables
|
|
|
|
set(CMAKE_POLICY_DEFAULT_CMP0048 NEW)
|
2019-05-25 04:44:56 +08:00
|
|
|
|
|
|
|
project(qe
|
2020-09-29 01:55:59 +08:00
|
|
|
VERSION 6.6.0
|
2019-06-06 20:13:52 +08:00
|
|
|
DESCRIPTION "ESPRESSO: opEn-Source Package for Research in Electronic Structure, Simulation, and Optimization"
|
|
|
|
LANGUAGES Fortran C)
|
2020-01-10 07:18:09 +08:00
|
|
|
|
2020-10-01 02:56:02 +08:00
|
|
|
if(${qe_BINARY_DIR} STREQUAL ${qe_SOURCE_DIR})
|
|
|
|
message(FATAL_ERROR "QE source folder cannot be safely used as a build folder!")
|
|
|
|
endif()
|
|
|
|
|
2020-10-01 02:42:46 +08:00
|
|
|
######################################################################
|
|
|
|
# Define the paths for static libraries and executables
|
|
|
|
######################################################################
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${qe_BINARY_DIR}/lib CACHE PATH "Single output directory for building all libraries.")
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${qe_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
|
|
|
|
set(QE_TESTS_DIR ${qe_BINARY_DIR}/tests/bin)
|
|
|
|
|
|
|
|
|
2020-01-10 07:18:09 +08:00
|
|
|
###########################################################
|
|
|
|
# Build helpers
|
|
|
|
###########################################################
|
2020-10-07 14:23:44 +08:00
|
|
|
set(PROJECT_CMAKE ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
2019-05-27 05:28:14 +08:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
2020-07-03 15:54:07 +08:00
|
|
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
|
2020-01-10 07:18:09 +08:00
|
|
|
include(cmake/qeHelpers.cmake)
|
|
|
|
|
2019-05-25 04:44:56 +08:00
|
|
|
###########################################################
|
|
|
|
# Build Type
|
|
|
|
# Ensure that a specific, default build type is set when
|
|
|
|
# none has been explicitly set by the user
|
|
|
|
###########################################################
|
2020-03-05 17:37:00 +08:00
|
|
|
qe_ensure_build_type("Release")
|
2019-05-25 04:44:56 +08:00
|
|
|
|
2019-05-25 05:48:35 +08:00
|
|
|
###########################################################
|
2020-01-09 20:10:56 +08:00
|
|
|
# Modules
|
2019-05-25 05:48:35 +08:00
|
|
|
###########################################################
|
2020-01-09 07:49:03 +08:00
|
|
|
include(CheckFunctionExists)
|
2019-05-25 17:09:27 +08:00
|
|
|
# Must use GNUInstallDirs to install libraries into correct
|
|
|
|
# locations on all platforms.
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2019-06-07 20:29:05 +08:00
|
|
|
###########################################################
|
|
|
|
# Build Options
|
|
|
|
###########################################################
|
|
|
|
option(QE_ENABLE_TEST
|
|
|
|
"enable unit tests" ON)
|
|
|
|
option(QE_ENABLE_MPI
|
|
|
|
"enable distributed execution support via MPI" ON)
|
2020-02-12 22:36:53 +08:00
|
|
|
option(QE_ENABLE_OPENMP
|
|
|
|
"enable distributed execution support via OpenMP" OFF)
|
2019-05-25 04:44:56 +08:00
|
|
|
option(QE_ENABLE_TRACE
|
|
|
|
"enable execution tracing output" OFF)
|
|
|
|
option(QE_ENABLE_MPI_INPLACE
|
|
|
|
"enable inplace MPI calls (ignored when QE_ENABLE_MPI=OFF)" OFF)
|
2019-05-27 04:26:09 +08:00
|
|
|
option(QE_ENABLE_MPI_MODULE
|
|
|
|
"use MPI via Fortran module instead of mpif.h header inclusion" OFF)
|
2019-05-25 04:44:56 +08:00
|
|
|
option(QE_ENABLE_BARRIER
|
|
|
|
"enable global synchronization between execution units" OFF)
|
2020-02-13 21:50:01 +08:00
|
|
|
option(QE_ENABLE_SCALAPACK
|
|
|
|
"enable SCALAPACK execution units" OFF)
|
2020-02-17 19:10:24 +08:00
|
|
|
option(QE_ENABLE_ELPA
|
|
|
|
"enable ELPA execution units" OFF)
|
2020-02-17 22:58:41 +08:00
|
|
|
option(QE_ENABLE_HDF5
|
|
|
|
"enable HDF5 data collection" OFF)
|
2020-10-02 04:37:13 +08:00
|
|
|
option(QE_ENABLE_CUDA
|
2020-10-02 21:08:14 +08:00
|
|
|
"enable CUDA acceleration on NVIDIA GPUs" OFF)
|
2020-03-03 22:20:15 +08:00
|
|
|
option(QE_ENABLE_VENDOR_DEPS
|
|
|
|
"enable fallback on vendored deps when none is found via find_package()" ON)
|
2020-03-04 01:06:49 +08:00
|
|
|
option(QE_ENABLE_DOC
|
2020-03-04 21:19:12 +08:00
|
|
|
"enable documentation building" OFF)
|
2019-05-25 04:44:56 +08:00
|
|
|
|
2020-03-04 18:04:28 +08:00
|
|
|
# TODO change all ifdefs throughout code base to match
|
|
|
|
# cmake options
|
|
|
|
# TODO symbols beginning with '__' followed by a capital
|
|
|
|
# character are reserved for standard library use (at
|
|
|
|
# least in C, not sure about Fortran), change all feature
|
|
|
|
# macros to avoid weird behaviors
|
|
|
|
|
2020-01-09 07:49:03 +08:00
|
|
|
# Disable all configuration headers used to be generated
|
|
|
|
# by configure (see <qe>/include/)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(QE_NO_CONFIG_H)
|
2020-01-09 07:49:03 +08:00
|
|
|
|
2019-05-25 04:44:56 +08:00
|
|
|
if(QE_ENABLE_TRACE)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__TRACE)
|
2019-05-25 04:44:56 +08:00
|
|
|
endif()
|
|
|
|
if(QE_ENABLE_MPI_INPLACE)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__USE_INPLACE_MPI)
|
2019-05-27 04:26:09 +08:00
|
|
|
endif()
|
2019-05-27 04:26:09 +08:00
|
|
|
if(QE_ENABLE_MPI_MODULE)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__MPI_MODULE)
|
2019-05-27 04:26:09 +08:00
|
|
|
endif()
|
2019-05-25 04:44:56 +08:00
|
|
|
if(QE_ENABLE_BARRIER)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__USE_BARRIER)
|
2020-01-09 07:49:03 +08:00
|
|
|
endif()
|
2020-02-17 22:58:41 +08:00
|
|
|
if(QE_ENABLE_MPI)
|
2020-02-12 23:43:45 +08:00
|
|
|
# OMPI_SKIP_MPICXX: skip CXX APIs on openmpi, cause trouble to C APIs
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__MPI OMPI_SKIP_MPICXX)
|
2020-02-12 23:43:45 +08:00
|
|
|
endif()
|
2020-02-17 22:58:41 +08:00
|
|
|
if(QE_ENABLE_SCALAPACK)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__SCALAPACK)
|
2020-02-13 21:50:01 +08:00
|
|
|
endif()
|
2020-02-17 22:58:41 +08:00
|
|
|
if(QE_ENABLE_HDF5)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(__HDF5)
|
2020-02-17 22:58:41 +08:00
|
|
|
endif()
|
2020-01-09 07:49:03 +08:00
|
|
|
|
2020-01-09 07:49:03 +08:00
|
|
|
# Feature checks
|
|
|
|
check_function_exists(mallinfo HAVE_MALLINFO)
|
|
|
|
if(HAVE_MALLINFO)
|
2020-03-04 18:04:28 +08:00
|
|
|
qe_add_global_compile_definitions(HAVE_MALLINFO)
|
2020-01-09 07:49:03 +08:00
|
|
|
endif()
|
|
|
|
|
2020-02-17 19:10:24 +08:00
|
|
|
# Check options consistency
|
2020-03-04 18:04:28 +08:00
|
|
|
if(QE_ENABLE_ELPA AND NOT QE_ENABLE_SCALAPACK)
|
|
|
|
message(FATAL_ERROR "ELPA requires SCALAPACK support, enable it with '-DQE_ENABLE_SCALAPACK=ON' or disable ELPA with '-DQE_ENABLE_ELPA=OFF'")
|
2020-02-17 19:10:24 +08:00
|
|
|
endif()
|
2020-03-04 18:04:28 +08:00
|
|
|
if(QE_ENABLE_SCALAPACK AND NOT QE_ENABLE_MPI)
|
|
|
|
message(FATAL_ERROR "SCALAPACK requires MPI support, enable it with '-DQE_ENABLE_MPI=ON' or disable SCALAPACK with '-DQE_ENABLE_SCALAPACK=OFF'")
|
2020-02-17 22:58:41 +08:00
|
|
|
endif()
|
2020-09-29 01:55:59 +08:00
|
|
|
# if(QE_ENABLE_HDF5 AND NOT QE_ENABLE_MPI)
|
|
|
|
# message(FATAL_ERROR "HDF5 requires MPI support, enable it with '-DQE_ENABLE_MPI=ON' or disable HDF5 with '-DQE_ENABLE_HDF5=OFF'")
|
|
|
|
# endif()
|
2020-02-17 19:10:24 +08:00
|
|
|
|
2019-05-25 04:44:56 +08:00
|
|
|
###########################################################
|
|
|
|
# MPI
|
|
|
|
# The following targets will be defined:
|
2019-06-07 20:29:05 +08:00
|
|
|
add_library(qe_mpi_fortran INTERFACE)
|
2019-05-25 04:44:56 +08:00
|
|
|
add_library(QE::MPI_Fortran ALIAS qe_mpi_fortran)
|
2020-10-05 21:28:24 +08:00
|
|
|
qe_install_targets(qe_mpi_fortran)
|
2019-05-25 04:44:56 +08:00
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_MPI)
|
2020-10-07 06:56:10 +08:00
|
|
|
find_package(MPI REQUIRED Fortran)
|
2019-05-25 04:44:56 +08:00
|
|
|
target_link_libraries(qe_mpi_fortran
|
2019-06-07 20:29:05 +08:00
|
|
|
INTERFACE MPI::MPI_Fortran)
|
2019-05-25 04:44:56 +08:00
|
|
|
endif(QE_ENABLE_MPI)
|
|
|
|
|
2020-02-12 22:36:53 +08:00
|
|
|
###########################################################
|
|
|
|
# OpenMP
|
|
|
|
# The following targets will be defined:
|
|
|
|
add_library(qe_openmp_fortran INTERFACE)
|
|
|
|
add_library(QE::OpenMP_Fortran ALIAS qe_openmp_fortran)
|
|
|
|
add_library(qe_openmp_c INTERFACE)
|
|
|
|
add_library(QE::OpenMP_C ALIAS qe_openmp_c)
|
|
|
|
qe_install_targets(qe_openmp_fortran qe_openmp_c)
|
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_OPENMP)
|
|
|
|
find_package(OpenMP REQUIRED Fortran C)
|
|
|
|
target_link_libraries(qe_openmp_fortran
|
2020-02-12 23:43:45 +08:00
|
|
|
INTERFACE OpenMP::OpenMP_Fortran)
|
2020-02-12 22:36:53 +08:00
|
|
|
target_link_libraries(qe_openmp_c
|
2020-02-12 23:43:45 +08:00
|
|
|
INTERFACE OpenMP::OpenMP_C)
|
2020-02-27 01:49:08 +08:00
|
|
|
|
2020-02-12 22:36:53 +08:00
|
|
|
endif(QE_ENABLE_OPENMP)
|
|
|
|
|
2020-10-07 14:23:44 +08:00
|
|
|
############################################################
|
|
|
|
## Compiler specific options
|
|
|
|
############################################################
|
|
|
|
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
|
|
|
include(${PROJECT_CMAKE}/GNUFortranCompiler.cmake)
|
|
|
|
endif()
|
|
|
|
|
2020-10-11 11:10:17 +08:00
|
|
|
############################################################
|
|
|
|
## Vendor
|
|
|
|
## Try to found vendor specific libraries for:
|
|
|
|
## BLAS, LAPACK and FFTW
|
|
|
|
############################################################
|
|
|
|
if(QE_ENABLE_OPENMP)
|
|
|
|
find_package(VENDOR COMPONENTS THREADS)
|
|
|
|
else()
|
|
|
|
find_package(VENDOR)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(VENDOR_FOUND)
|
|
|
|
message(STATUS "Found vendor: ${VENDOR}")
|
|
|
|
message(STATUS "Found vendor BLAS libraries: ${BLAS_LIBRARIES}")
|
|
|
|
message(STATUS "Found vendor LAPACK libraries: ${LAPACK_LIBRARIES}")
|
|
|
|
if(NOT FFTW_ROOT)
|
|
|
|
message(STATUS "Found vendor FFTW libraries: ${FFTW_LIBRARIES}")
|
|
|
|
message(STATUS "Found vendor FFTW include: ${FFTW_INCLUDE_DIRS}")
|
|
|
|
else()
|
|
|
|
set(FFTW_FOUND FALSE)
|
|
|
|
set(FFTW_LIBRARIES)
|
|
|
|
set(FFTW_INCLUDE_DIRS)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-02-13 21:48:34 +08:00
|
|
|
###########################################################
|
2020-10-11 11:10:17 +08:00
|
|
|
# Lapack
|
|
|
|
# The following targets will be defined:
|
|
|
|
add_library(qe_lapack INTERFACE)
|
|
|
|
add_library(QE::LAPACK ALIAS qe_lapack)
|
|
|
|
qe_install_targets(qe_lapack)
|
|
|
|
#######################################################################
|
|
|
|
if(NOT VENDOR_FOUND)
|
|
|
|
find_package(LAPACK)
|
|
|
|
if(LAPACK_FOUND)
|
|
|
|
message(STATUS "Found LAPACK: ${LAPACK_LIBRARIES}")
|
|
|
|
target_link_libraries(qe_lapack
|
|
|
|
INTERFACE
|
|
|
|
${LAPACK_LIBRARIES}
|
|
|
|
${LAPACK_LINKER_FLAGS})
|
|
|
|
elseif(QE_ENABLE_VENDOR_DEPS)
|
|
|
|
message(STATUS "Installing QE::LAPACK via submodule")
|
|
|
|
qe_git_submodule_update(external/lapack)
|
|
|
|
add_subdirectory(external/lapack EXCLUDE_FROM_ALL)
|
|
|
|
target_link_libraries(qe_lapack INTERFACE lapack)
|
|
|
|
qe_fix_fortran_modules(lapack)
|
|
|
|
qe_install_targets(lapack)
|
|
|
|
else()
|
|
|
|
# No dep has been found via find_package,
|
|
|
|
# call it again with REQUIRED to make it fail
|
|
|
|
# explicitly (hoping in some helpful message)
|
|
|
|
find_package(LAPACK REQUIRED)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
target_link_libraries(qe_lapack
|
|
|
|
INTERFACE
|
|
|
|
${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
|
|
|
|
endif()
|
2020-03-03 01:08:32 +08:00
|
|
|
|
2020-10-11 11:10:17 +08:00
|
|
|
###########################################################
|
2020-02-13 21:50:01 +08:00
|
|
|
# SCALAPACK
|
|
|
|
# The following targets will be defined:
|
|
|
|
add_library(qe_scalapack INTERFACE)
|
|
|
|
add_library(QE::SCALAPACK ALIAS qe_scalapack)
|
|
|
|
qe_install_targets(qe_scalapack)
|
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_SCALAPACK)
|
2020-02-19 22:29:32 +08:00
|
|
|
find_package(SCALAPACK REQUIRED QUIET)
|
|
|
|
message(STATUS "Found SCALAPACK: ${SCALAPACK_LIBRARIES};${SCALAPACK_LINKER_FLAGS}")
|
2020-10-11 11:10:17 +08:00
|
|
|
target_link_libraries(qe_scalapack
|
|
|
|
INTERFACE
|
2020-02-13 21:50:01 +08:00
|
|
|
${SCALAPACK_LIBRARIES}
|
2020-02-19 22:29:32 +08:00
|
|
|
${SCALAPACK_LINKER_FLAGS})
|
2020-02-13 21:50:01 +08:00
|
|
|
endif(QE_ENABLE_SCALAPACK)
|
|
|
|
|
2020-02-17 19:10:24 +08:00
|
|
|
###########################################################
|
|
|
|
# ELPA
|
|
|
|
# The following targets will be defined:
|
|
|
|
add_library(qe_elpa INTERFACE)
|
|
|
|
add_library(QE::ELPA ALIAS qe_elpa)
|
|
|
|
qe_install_targets(qe_elpa)
|
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_ELPA)
|
|
|
|
find_package(ELPA REQUIRED)
|
2020-10-11 15:16:46 +08:00
|
|
|
|
2020-02-17 19:10:24 +08:00
|
|
|
# Check if ELPA version is compatible with QE
|
2020-10-11 15:16:46 +08:00
|
|
|
if(ELPA_VERSION_STRING VERSION_GREATER_EQUAL "2018.11")
|
2020-10-11 23:23:32 +08:00
|
|
|
set(QE_ELPA_DEFINITIONS __ELPA)
|
2020-10-11 15:16:46 +08:00
|
|
|
elseif(ELPA_VERSION_STRING VERSION_GREATER_EQUAL "2016.11")
|
2020-10-11 23:23:32 +08:00
|
|
|
set(QE_ELPA_DEFINITIONS __ELPA_2016)
|
2020-10-11 15:16:46 +08:00
|
|
|
elseif(ELPA_VERSION_STRING VERSION_GREATER_EQUAL "2015")
|
2020-10-11 23:23:32 +08:00
|
|
|
set(QE_ELPA_DEFINITIONS __ELPA_2015)
|
2020-02-17 19:10:24 +08:00
|
|
|
else()
|
2020-10-11 15:16:46 +08:00
|
|
|
message(FATAL_ERROR "ELPA verion ${ELPA_VERSION_STRING} is not supported.")
|
2020-02-17 19:10:24 +08:00
|
|
|
endif()
|
2020-10-11 23:23:32 +08:00
|
|
|
message(STATUS "Add ELPA flag : ${QE_ELPA_DEFINITIONS}")
|
|
|
|
qe_add_global_compile_definitions(${QE_ELPA_DEFINITIONS})
|
2020-02-17 19:10:24 +08:00
|
|
|
|
|
|
|
# Looking for module directory
|
2020-10-11 15:16:46 +08:00
|
|
|
file(GLOB_RECURSE ELPA_MODS_FILES "${ELPA_INCLUDE_DIRS}/*.mod" "${ELPA_INCLUDE_DIRS}/../modules/*.mod")
|
|
|
|
if(ELPA_MODS_FILES)
|
|
|
|
list(GET ELPA_MODS_FILES 0 ELPA_MOD)
|
2020-02-17 19:10:24 +08:00
|
|
|
get_filename_component(ELPA_MOD_DIR "${ELPA_MOD}" PATH)
|
|
|
|
set(ELPA_INCLUDE_DIRS "${ELPA_MOD_DIR};${ELPA_INCLUDE_DIRS}")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Fortran module directory of ELPA not found!")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Add link libraries and include directories
|
|
|
|
target_link_libraries(qe_elpa
|
|
|
|
INTERFACE
|
|
|
|
${ELPA_LIBRARIES}
|
|
|
|
${ELPA_LIBRARIES_DEP}
|
2020-03-05 17:37:23 +08:00
|
|
|
${ELPA_LINKER_FLAGS})
|
2020-02-17 19:10:24 +08:00
|
|
|
target_include_directories(qe_elpa
|
|
|
|
INTERFACE
|
|
|
|
${ELPA_INCLUDE_DIRS}
|
2020-03-05 17:37:23 +08:00
|
|
|
${ELPA_INCLUDE_DIRS_DEP})
|
2020-02-17 19:10:24 +08:00
|
|
|
endif(QE_ENABLE_ELPA)
|
|
|
|
|
2020-02-17 22:58:41 +08:00
|
|
|
###########################################################
|
|
|
|
# HDF5
|
|
|
|
# The following targets will be defined:
|
|
|
|
add_library(qe_hdf5_fortran INTERFACE)
|
|
|
|
add_library(QE::HDF5_Fortran ALIAS qe_hdf5_fortran)
|
|
|
|
add_library(qe_hdf5_c INTERFACE)
|
|
|
|
add_library(QE::HDF5_C ALIAS qe_hdf5_c)
|
|
|
|
qe_install_targets(qe_hdf5_fortran qe_hdf5_c)
|
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_HDF5)
|
|
|
|
find_package(HDF5 REQUIRED Fortran C)
|
|
|
|
|
|
|
|
if(NOT HDF5_Fortran_LIBRARIES OR NOT HDF5_Fortran_INCLUDE_DIRS)
|
|
|
|
message(FATAL_ERROR "HDF5 Fortran interface has not been found!")
|
|
|
|
endif()
|
2020-09-29 01:55:59 +08:00
|
|
|
if (NOT HDF5_IS_PARALLEL OR NOT QE_ENABLE_MPI)
|
|
|
|
qe_add_global_compile_definitions(__HDF5_SERIAL)
|
|
|
|
endif()
|
2020-02-17 22:58:41 +08:00
|
|
|
|
|
|
|
target_link_libraries(qe_hdf5_fortran
|
|
|
|
INTERFACE
|
|
|
|
${HDF5_Fortran_LIBRARIES}
|
|
|
|
${HDF5_Fortran_HL_LIBRARIES})
|
|
|
|
target_include_directories(qe_hdf5_fortran
|
|
|
|
INTERFACE
|
|
|
|
${HDF5_Fortran_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions(qe_hdf5_fortran
|
|
|
|
INTERFACE
|
|
|
|
${HDF5_Fortran_DEFINITIONS})
|
|
|
|
|
|
|
|
target_link_libraries(qe_hdf5_c
|
|
|
|
INTERFACE
|
|
|
|
${HDF5_C_LIBRARIES}
|
|
|
|
${HDF5_C_HL_LIBRARIES})
|
|
|
|
target_include_directories(qe_hdf5_c
|
|
|
|
INTERFACE
|
|
|
|
${HDF5_C_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions(qe_hdf5_c
|
|
|
|
INTERFACE
|
|
|
|
${HDF5_C_DEFINITIONS})
|
|
|
|
endif(QE_ENABLE_HDF5)
|
|
|
|
|
2020-10-02 04:37:13 +08:00
|
|
|
###########################################################
|
|
|
|
# CUDA
|
|
|
|
# FIXME just a place holder for the moment
|
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_CUDA)
|
|
|
|
qe_add_global_compile_definitions(__CUDA)
|
|
|
|
endif(QE_ENABLE_CUDA)
|
|
|
|
|
2019-06-07 20:29:05 +08:00
|
|
|
###########################################################
|
|
|
|
# Tests
|
|
|
|
# Any executable target marked as test runner via
|
|
|
|
# 'add_test()' will be run by the 'test' make target
|
|
|
|
###########################################################
|
|
|
|
if(QE_ENABLE_TEST)
|
|
|
|
enable_testing()
|
|
|
|
endif(QE_ENABLE_TEST)
|
|
|
|
|
2019-05-25 04:44:56 +08:00
|
|
|
###########################################################
|
2019-06-07 17:04:07 +08:00
|
|
|
# Components
|
2019-05-25 04:44:56 +08:00
|
|
|
###########################################################
|
2020-01-09 23:50:49 +08:00
|
|
|
add_subdirectory(external)
|
2020-01-09 07:18:27 +08:00
|
|
|
add_subdirectory(clib)
|
2020-01-09 01:34:41 +08:00
|
|
|
add_subdirectory(FFTXlib)
|
2019-06-07 17:04:07 +08:00
|
|
|
add_subdirectory(UtilXlib)
|
2020-01-09 01:34:41 +08:00
|
|
|
add_subdirectory(Modules)
|
2019-06-07 17:04:07 +08:00
|
|
|
add_subdirectory(LAXlib)
|
2020-01-09 16:49:04 +08:00
|
|
|
add_subdirectory(KS_Solvers)
|
2020-01-09 06:51:01 +08:00
|
|
|
add_subdirectory(dft-d3)
|
2020-01-09 01:34:41 +08:00
|
|
|
add_subdirectory(PW)
|
2020-01-09 16:49:12 +08:00
|
|
|
add_subdirectory(CPV)
|
2020-02-04 23:53:08 +08:00
|
|
|
add_subdirectory(atomic)
|
2020-07-03 15:54:07 +08:00
|
|
|
add_subdirectory(upflib)
|
2020-02-05 00:47:38 +08:00
|
|
|
add_subdirectory(COUPLE)
|
|
|
|
add_subdirectory(LR_Modules)
|
2020-02-10 17:49:02 +08:00
|
|
|
add_subdirectory(PHonon)
|
|
|
|
add_subdirectory(PP)
|
|
|
|
add_subdirectory(EPW)
|
|
|
|
add_subdirectory(GWW)
|
|
|
|
add_subdirectory(HP)
|
|
|
|
add_subdirectory(NEB)
|
|
|
|
add_subdirectory(PlotPhon)
|
|
|
|
add_subdirectory(PWCOND)
|
|
|
|
add_subdirectory(QHA)
|
|
|
|
add_subdirectory(TDDFPT)
|
|
|
|
add_subdirectory(XSpectra)
|
2020-03-04 01:06:49 +08:00
|
|
|
if(QE_ENABLE_DOC)
|
|
|
|
add_subdirectory(Doc)
|
|
|
|
endif()
|
2019-05-25 17:09:27 +08:00
|
|
|
|
2020-03-05 00:13:11 +08:00
|
|
|
###########################################################
|
|
|
|
# Pkg-config
|
|
|
|
###########################################################
|
|
|
|
configure_file(
|
2020-03-06 23:34:46 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/quantum_espresso.pc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/quantum_espresso.pc
|
|
|
|
@ONLY)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/quantum_espresso.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
2020-03-05 00:13:11 +08:00
|
|
|
|
2019-06-07 20:29:05 +08:00
|
|
|
###########################################################
|
2019-06-07 17:04:07 +08:00
|
|
|
# Exports
|
2019-06-07 20:29:05 +08:00
|
|
|
###########################################################
|
2020-01-09 20:10:56 +08:00
|
|
|
install(EXPORT qeTargets
|
|
|
|
FILE qeTargets.cmake
|
|
|
|
NAMESPACE qe::
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/qe)
|
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
qeConfigVersion.cmake
|
|
|
|
VERSION ${PACKAGE_VERSION}
|
|
|
|
COMPATIBILITY AnyNewerVersion)
|
|
|
|
|
2020-03-05 17:37:23 +08:00
|
|
|
configure_file(cmake/qeConfig.cmake.in
|
2020-01-09 20:10:56 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/qeConfig.cmake @ONLY)
|
|
|
|
|
|
|
|
install(FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/qeConfigVersion.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/qeConfig.cmake
|
|
|
|
DESTINATION
|
|
|
|
${CMAKE_INSTALL_LIBDIR}/cmake/qe)
|
2019-06-07 20:29:05 +08:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Dependency graph generation
|
|
|
|
# Defines the custom target 'depgraph'
|
|
|
|
###########################################################
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeGraphVizOptions.cmake
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/CMakeGraphVizOptions.cmake COPYONLY)
|
|
|
|
add_custom_target(depgraph
|
|
|
|
"${CMAKE_COMMAND}" "--graphviz=depgraph" .
|
2020-01-09 06:40:15 +08:00
|
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
###########################################################
|
|
|
|
# Custom make targets
|
|
|
|
###########################################################
|
|
|
|
add_custom_target(pw
|
|
|
|
DEPENDS
|
|
|
|
qe_pw_exe
|
|
|
|
qe_pw_tools_ibrav2cell_exe
|
|
|
|
qe_pw_tools_cell2ibrav_exe
|
|
|
|
qe_pw_tools_ev_exe
|
|
|
|
qe_pw_tools_kpoints_exe
|
|
|
|
qe_pw_tools_pwi2xsf_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"basic code for scf, structure optimization, MD")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(ph
|
|
|
|
DEPENDS
|
|
|
|
qe_phonon_ph_exe
|
|
|
|
qe_phonon_dynmat_exe
|
|
|
|
qe_phonon_q2r_exe
|
|
|
|
qe_phonon_q2qstar_exe
|
|
|
|
qe_phonon_lambda_exe
|
|
|
|
qe_phonon_alpha2f_exe
|
|
|
|
qe_phonon_epa_exe
|
|
|
|
qe_phonon_fqha_exe
|
|
|
|
qe_plotphon_kforbands_exe
|
|
|
|
qe_plotphon_bandstognuplot_exe
|
|
|
|
qe_plotphon_eminmax_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"phonon code, Gamma-only and third-order derivatives")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(hp
|
|
|
|
DEPENDS
|
|
|
|
qe_hp_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"calculation of the Hubbard parameters from DFPT")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(pwcond
|
|
|
|
DEPENDS
|
|
|
|
qe_pwcond_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"ballistic conductance")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(neb
|
|
|
|
DEPENDS
|
|
|
|
qe_neb_exe
|
|
|
|
qe_neb_pathinterpolation_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"code for Nudged Elastic Band method")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(pp
|
|
|
|
DEPENDS
|
|
|
|
qe_pp_exe
|
|
|
|
qe_pp_opengrid_exe
|
|
|
|
qe_pp_average_exe
|
|
|
|
qe_pp_bands_exe
|
|
|
|
qe_pp_dos_exe
|
|
|
|
qe_pp_pawplot_exe
|
|
|
|
qe_pp_planavg_exe
|
|
|
|
qe_pp_plotband_exe
|
|
|
|
qe_pp_plotproj_exe
|
|
|
|
qe_pp_plotrho_exe
|
|
|
|
qe_pp_pmw_exe
|
|
|
|
qe_pp_xctest_exe
|
|
|
|
qe_pp_projwfc_exe
|
|
|
|
qe_pp_pw2wannier90_exe
|
|
|
|
qe_pp_pw2critic_exe
|
|
|
|
qe_pp_wfck2r_exe
|
|
|
|
qe_pp_initial_state_exe
|
|
|
|
qe_pp_pw2gw_exe
|
|
|
|
qe_pp_sumpdos_exe
|
|
|
|
qe_pp_epsilon_exe
|
|
|
|
qe_pp_wannierham_exe
|
|
|
|
qe_pp_wannierplot_exe
|
|
|
|
qe_pp_molecularpdos_exe
|
|
|
|
qe_pp_pw2bgw_exe
|
|
|
|
qe_pp_fermivelocity_exe
|
|
|
|
qe_pp_fermisurface_exe
|
|
|
|
qe_pp_fermiproj_exe
|
|
|
|
qe_pp_ppacf_exe
|
|
|
|
qe_pp_benchmarklibxc_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"postprocessing programs")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(pwall
|
|
|
|
DEPENDS
|
|
|
|
pw
|
|
|
|
ph
|
|
|
|
pp
|
|
|
|
pwcond
|
|
|
|
neb
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"same as \"make pw ph pp pwcond neb\"")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(cp
|
|
|
|
DEPENDS
|
|
|
|
qe_cpv_exe
|
|
|
|
qe_cpv_manycp_exe
|
|
|
|
qe_cpv_cppp_exe
|
|
|
|
qe_cpv_wfdd_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"CP code: Car-Parrinello molecular dynamics")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(tddfpt
|
|
|
|
DEPENDS
|
|
|
|
qe_tddfpt_turbolanczos_exe
|
|
|
|
qe_tddfpt_turbodavidson_exe
|
|
|
|
qe_tddfpt_turboeels_exe
|
|
|
|
qe_tddfpt_calculatespectrum_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"time dependent dft code")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(gwl
|
|
|
|
DEPENDS
|
|
|
|
qe_gww_util_grap_exe
|
|
|
|
qe_gww_util_abcoefftoeps_exe
|
|
|
|
qe_gww_util_memorypw4gww_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"GW with Lanczos chains")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(ld1
|
|
|
|
DEPENDS
|
|
|
|
qe_atomic_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"utilities for pseudopotential generation")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(upf
|
|
|
|
DEPENDS
|
2020-10-09 17:50:46 +08:00
|
|
|
#Library
|
|
|
|
qe_upflib
|
|
|
|
#Executables
|
|
|
|
qe_upflib_virtual_v2_exe
|
|
|
|
qe_upflib_upfconv_exe
|
2020-02-11 02:01:01 +08:00
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"utilities for pseudopotential conversion")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(xspectra
|
|
|
|
DEPENDS
|
|
|
|
qe_xspectra_exe
|
|
|
|
qe_xspectra_spectracorrection_exe
|
|
|
|
qe_xspectra_molecularnexafs_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"X-ray core-hole spectroscopy calculations")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(couple
|
|
|
|
DEPENDS
|
|
|
|
qe_couple
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"library interface for coupling to external codes")
|
2020-02-11 02:01:01 +08:00
|
|
|
|
|
|
|
add_custom_target(epw
|
|
|
|
DEPENDS
|
|
|
|
qe_epw_exe
|
|
|
|
COMMENT
|
2020-03-05 17:37:23 +08:00
|
|
|
"electron-Phonon Coupling with wannier functions")
|