Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,21 @@ if(MKLROOT)
list(APPEND math_libs -lifcore)
endif()
else()
# In compatibility to builtin FindLAPACK.cmake before v3.5.4
if(DEFINED LAPACK_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${LAPACK_DIR}")
endif()
if(DEFINED LAPACK_LIBRARY)
set(LAPACK_LIBRARIES ${LAPACK_LIBRARY})
endif()
if(DEFINED BLAS_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${BLAS_DIR}")
endif()

find_package(FFTW3 REQUIRED)
find_package(LAPACK REQUIRED)
include_directories(${FFTW3_INCLUDE_DIRS})
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK)
list(APPEND math_libs FFTW3::FFTW3 LAPACK::LAPACK BLAS::BLAS)

if(ENABLE_LCAO)
find_package(ScaLAPACK REQUIRED)
Expand Down Expand Up @@ -733,4 +744,4 @@ endif()
if(ENABLE_RAPIDJSON)
target_link_libraries(${ABACUS_BIN_NAME}
json_output)
endif()
endif()
19 changes: 19 additions & 0 deletions cmake/FindELPA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@

find_package(PkgConfig)

# Compatible layer towards old manual routines
if(DEFINED ELPA_INCLUDE_DIR)
set(ELPA_INCLUDE_DIRS ${ELPA_INCLUDE_DIR})
endif()
if(DEFINED ELPA_LIBRARIES)
set(ELPA_LINK_LIBRARIES ${ELPA_LIBRARIES})
endif()

find_path(ELPA_INCLUDE_DIRS
elpa/elpa.h
HINTS ${ELPA_DIR}
PATH_SUFFIXES "include" "include/elpa"
)
# Fix #3589
# First if judges if ELPA dir specified
if(ELPA_INCLUDE_DIRS MATCHES "^/usr/include/elpa/.*")
# Second if judges if global visible ELPA header found
if(DEFINED ELPA_DIR OR CMAKE_PREFIX_PATH MATCHES ".*elpa.*")
unset(ELPA_INCLUDE_DIRS)
endif()
endif()
if(USE_OPENMP)
find_library(ELPA_LINK_LIBRARIES
NAMES elpa_openmp elpa
Expand All @@ -28,6 +44,9 @@ else()
)
endif()

# Incompatible with ELPA earlier than 2021.11.001
# Before ELPA 2021.11.001, its pkg-config file
# is named like "elpa-2021.05.002.pc".
if(NOT ELPA_INCLUDE_DIRS AND PKG_CONFIG_FOUND)
if(DEFINED ELPA_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${ELPA_DIR}")
Expand Down
31 changes: 0 additions & 31 deletions cmake/FindLAPACK.cmake

This file was deleted.

17 changes: 10 additions & 7 deletions cmake/FindLibxc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ include(FindPackageHandleStandardArgs)
if(DEFINED Libxc_DIR)
string(APPEND CMAKE_PREFIX_PATH ";${Libxc_DIR}")
endif()
# Using CMake interface as default.
# Using pkg-config interface as default, to
# avoid linking to wrong global visible Libxc instead of
# specified one.
# NO REQUIRED here, otherwhile it would throw error
# with no LibXC found.
find_package(Libxc HINTS
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_search_module(Libxc IMPORTED_TARGET GLOBAL libxc)
find_package_handle_standard_args(Libxc DEFAULT_MSG Libxc_LINK_LIBRARIES Libxc_INCLUDE_DIRS)
endif()
if(NOT Libxc_FOUND)
find_package(Libxc REQUIRED HINTS
${Libxc_DIR}/share/cmake/Libxc
${Libxc_DIR}/lib/cmake/Libxc
${Libxc_DIR}/lib64/cmake/Libxc
)
if(NOT TARGET Libxc::xc)
find_package(PkgConfig REQUIRED)
pkg_search_module(Libxc REQUIRED IMPORTED_TARGET GLOBAL libxc)
find_package_handle_standard_args(Libxc DEFAULT_MSG Libxc_LINK_LIBRARIES Libxc_INCLUDE_DIRS)
endif()


# Copy the results to the output variables and target.
# if find_package() above works, Libxc::xc would be present and
# below would be skipped.
Expand Down