diff --git a/.gitmodules b/.gitmodules index 217319cb1e..453de3209a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,3 @@ -[submodule "deps/LibRI"] - path = deps/LibRI - url = https://github.com/abacusmodeling/LibRI.git - branch = master -[submodule "deps/LibComm"] - path = deps/LibComm - url = https://github.com/abacusmodeling/LibComm.git - branch = master [submodule "deps/libpaw_interface"] path = deps/libpaw_interface url = https://github.com/wenfei-li/libpaw_interface diff --git a/CMakeLists.txt b/CMakeLists.txt index 62dfd41073..85069429b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,13 +538,10 @@ endif() if(ENABLE_LIBRI) set_if_higher(CMAKE_CXX_STANDARD 14) if(LIBRI_DIR) - include_directories(${LIBRI_DIR}/include) - elseif(GIT_SUBMODULE) - git_submodule_update() - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/LibRI/include) else() - message(FATAL_ERROR "Must provide LIBRI_DIR for RI related features.") + find_package(LibRI REQUIRED) endif() + include_directories(${LIBRI_DIR}/include) target_link_libraries(${ABACUS_BIN_NAME} ri module_exx_symmetry) add_compile_definitions(__EXX EXX_DM=3 EXX_H_COMM=2 TEST_EXX_LCAO=0 TEST_EXX_RADIAL=1) @@ -555,13 +552,10 @@ if(ENABLE_LIBRI OR DEFINED LIBCOMM_DIR) endif() if(ENABLE_LIBCOMM) if(LIBCOMM_DIR) - include_directories(${LIBCOMM_DIR}/include) - elseif(GIT_SUBMODULE) - git_submodule_update() - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/deps/LibComm/include) else() - message(FATAL_ERROR "Must provide LIBCOMM_DIR for RI related features.") + find_package(LibComm REQUIRED) endif() + include_directories(${LIBCOMM_DIR}/include) endif() if(ENABLE_PAW) diff --git a/cmake/FindLibComm.cmake b/cmake/FindLibComm.cmake new file mode 100644 index 0000000000..9921badb93 --- /dev/null +++ b/cmake/FindLibComm.cmake @@ -0,0 +1,30 @@ +############################################################################### +# - Find LibComm +# Find the native LibComm files. +# +# LIBCOMM_FOUND - True if LibComm is found. +# LIBCOMM_DIR - Where to find LibComm files. + +find_path(LIBCOMM_DIR + include/Comm/Comm_Tools.h + HINTS ${LIBCOMM_DIR} + HINTS ${LibComm_DIR} + HINTS ${libcomm_DIR} +) + +if(NOT LIBCOMM_DIR) + include(FetchContent) + FetchContent_Declare( + LibComm + URL https://github.com/abacusmodeling/LibComm/archive/refs/tags/v0.1.1.tar.gz + ) + FetchContent_Populate(LibComm) + set(LIBCOMM_DIR ${libcomm_SOURCE_DIR}) +endif() +# Handle the QUIET and REQUIRED arguments and +# set LIBCOMM_FOUND to TRUE if all variables are non-zero. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibComm DEFAULT_MSG LIBCOMM_DIR) + +# Copy the results to the output variables and target. +mark_as_advanced(LIBCOMM_DIR) diff --git a/cmake/FindLibRI.cmake b/cmake/FindLibRI.cmake new file mode 100644 index 0000000000..b8f060a483 --- /dev/null +++ b/cmake/FindLibRI.cmake @@ -0,0 +1,30 @@ +############################################################################### +# - Find LibRI +# Find the native LibRI files. +# +# LIBRI_FOUND - True if LibRI is found. +# LIBRI_DIR - Where to find LibRI files. + +find_path(LIBRI_DIR + include/RI/version.h + HINTS ${LIBRI_DIR} + HINTS ${LibRI_DIR} + HINTS ${libri_DIR} +) + +if(NOT LIBRI_DIR) + include(FetchContent) + FetchContent_Declare( + LibRI + URL https://github.com/abacusmodeling/LibRI/archive/refs/tags/v0.2.1.1.tar.gz + ) + FetchContent_Populate(LibRI) + set(LIBRI_DIR ${libri_SOURCE_DIR}) +endif() +# Handle the QUIET and REQUIRED arguments and +# set LIBRI_FOUND to TRUE if all variables are non-zero. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LibRI DEFAULT_MSG LIBRI_DIR) + +# Copy the results to the output variables and target. +mark_as_advanced(LIBRI_DIR) diff --git a/deps/LibComm b/deps/LibComm deleted file mode 160000 index ec984514b4..0000000000 --- a/deps/LibComm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ec984514b44480e98bd1578bcacca7a19c849724 diff --git a/deps/LibRI b/deps/LibRI deleted file mode 160000 index bd299faeaa..0000000000 --- a/deps/LibRI +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bd299faeaa184b912e4bdf5c0e182dfb7f47272a diff --git a/toolchain/scripts/stage4/install_libcomm.sh b/toolchain/scripts/stage4/install_libcomm.sh index 96c7f3c76b..76a1c8c55f 100755 --- a/toolchain/scripts/stage4/install_libcomm.sh +++ b/toolchain/scripts/stage4/install_libcomm.sh @@ -12,7 +12,7 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)" libcomm_ver="0.1.1" -libcomm_sha256="3764c934c895bfd9d8fd766d46e6e3d03230f8076e3edbcc31e10ff8f30075a4" +libcomm_sha256="fa162a197678654f15d91a5a917cce7fb2748bd9b0e344363edea2db87547b72" source "${SCRIPT_DIR}"/common_vars.sh source "${SCRIPT_DIR}"/tool_kit.sh source "${SCRIPT_DIR}"/signal_trap.sh