diff --git a/CMakeLists.txt b/CMakeLists.txt index f5688fdc20..9d2e1c9b4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -690,6 +690,13 @@ endif() if(CP2K_USE_DFTD4) find_package(dftd4 REQUIRED) + + get_target_property(CP2K_DFTD4_LINK_LIBRARIES dftd4::dftd4 + INTERFACE_LINK_LIBRARIES) + get_target_property(CP2K_DFTD4_LIB_LINK_LIBRARIES dftd4::dftd4-lib + INTERFACE_LINK_LIBRARIES) + get_target_property(CP2K_DFTD4_INCLUDE_DIR dftd4::dftd4-lib + INTERFACE_INCLUDE_DIRECTORIES) endif() # SIRIUS @@ -847,9 +854,10 @@ endif() if(CP2K_USE_DFTD4) message( - " - DFTD4 :\n" " - include modules : ${DFTD4_DFTD4};${DFTD4_MCTC}\n" - " - include directories : ${DFTD4_INCLUDE_DIR}\n" - " - libraries : ${DFTD4_LIBDIR}\n\n") + " - DFTD4 :\n" + " - include directories : ${CP2K_DFTD4_INCLUDE_DIR}\n" + " - libraries : ${CP2K_DFTD4_LINK_LIBRARIES};${CP2K_DFTD4_LIB_LINK_LIBRARIES}\n\n" + ) endif() if(CP2K_USE_SIRIUS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e5d2e3f861..f4b59b0abc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1600,9 +1600,6 @@ endif() add_library(cp2k_link_libs INTERFACE) -include_directories(${DFTD4_DFTD4}) -include_directories(${DFTD4_MCTC}) - # the order is important so keep it that way target_link_libraries( cp2k_link_libs diff --git a/tools/docker/Dockerfile.test_spack b/tools/docker/Dockerfile.test_spack index b3b92abf38..43b5f7654d 100644 --- a/tools/docker/Dockerfile.test_spack +++ b/tools/docker/Dockerfile.test_spack @@ -42,7 +42,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ # Install a recent developer version of Spack. WORKDIR /opt/spack -ARG SPACK_VERSION=847f560a6eff23f2177f3e8a2c143d309bb06acf +ARG SPACK_VERSION=56495a8cd81640302a9d3a22249ce42bc4698a38 RUN git init --quiet && \ git remote add origin https://github.com/spack/spack.git && \ git fetch --quiet --depth 1 origin ${SPACK_VERSION} --no-tags && \ @@ -54,7 +54,7 @@ RUN spack compiler find RUN spack external find --all --not-buildable # Enable Spack build cache -ARG SPACK_BUILD_CACHE=develop-2025-01-12 +ARG SPACK_BUILD_CACHE=develop-2025-01-26 RUN spack mirror add ${SPACK_BUILD_CACHE} https://binaries.spack.io/${SPACK_BUILD_CACHE} && \ spack mirror add develop https://binaries.spack.io/develop && \ spack buildcache keys --install --trust --force && \ diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index ea95e8403d..aeb5516d7f 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -849,7 +849,7 @@ RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ # Install a recent developer version of Spack. WORKDIR /opt/spack -ARG SPACK_VERSION=847f560a6eff23f2177f3e8a2c143d309bb06acf +ARG SPACK_VERSION=56495a8cd81640302a9d3a22249ce42bc4698a38 RUN git init --quiet && \ git remote add origin https://github.com/spack/spack.git && \ git fetch --quiet --depth 1 origin ${{SPACK_VERSION}} --no-tags && \ @@ -861,7 +861,7 @@ RUN spack compiler find RUN spack external find --all --not-buildable # Enable Spack build cache -ARG SPACK_BUILD_CACHE=develop-2025-01-12 +ARG SPACK_BUILD_CACHE=develop-2025-01-26 RUN spack mirror add ${{SPACK_BUILD_CACHE}} https://binaries.spack.io/${{SPACK_BUILD_CACHE}} && \ spack mirror add develop https://binaries.spack.io/develop && \ spack buildcache keys --install --trust --force && \ diff --git a/tools/docker/scripts/build_cp2k_cmake.sh b/tools/docker/scripts/build_cp2k_cmake.sh index c259ec6dcf..9668462b4d 100755 --- a/tools/docker/scripts/build_cp2k_cmake.sh +++ b/tools/docker/scripts/build_cp2k_cmake.sh @@ -84,6 +84,7 @@ if [[ "${PROFILE}" == "spack" ]] && [[ "${VERSION}" == "psmp" ]]; then -DCP2K_USE_SIRIUS=ON \ -DCP2K_USE_LIBTORCH=OFF \ -DCP2K_USE_DLAF=ON \ + -DCP2K_USE_DFTD4=ON \ .. |& tee ./cmake.log CMAKE_EXIT_CODE=$? diff --git a/tools/spack/cp2k-dependencies.yaml b/tools/spack/cp2k-dependencies.yaml index 09e955777b..db2d465a39 100644 --- a/tools/spack/cp2k-dependencies.yaml +++ b/tools/spack/cp2k-dependencies.yaml @@ -18,6 +18,7 @@ spack: - "sirius @7.6.1 +fortran +pugixml ~apps" - "libvori@220621" - "spla@1.6.1 +fortran" + - "dftd4@3.6.0 build_system=cmake" # Unfortunately, ScaLAPACK 2.2.1 has not yet been packaged by Spack. # https://github.com/Reference-ScaLAPACK/scalapack/tree/v2.2.1 # which contains https://github.com/Reference-ScaLAPACK/scalapack/pull/26