Merge pull request #4394 from rbberger/find-package-pace

ml-pace: allow linking to existing pace library
This commit is contained in:
Axel Kohlmeyer
2025-01-09 19:41:19 -05:00
committed by GitHub
2 changed files with 57 additions and 45 deletions

View File

@ -1,12 +1,17 @@
# PACE library support for ML-PACE package # PACE library support for ML-PACE package
find_package(pace QUIET)
if(pace_FOUND)
find_package(pace)
target_link_libraries(lammps PRIVATE pace::pace)
else()
# set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW # set policy to silence warnings about timestamps of downloaded files. review occasionally if it may be set to NEW
if(POLICY CMP0135) if(POLICY CMP0135)
cmake_policy(SET CMP0135 OLD) cmake_policy(SET CMP0135 OLD)
endif() endif()
set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix.tar.gz" CACHE STRING "URL for PACE evaluator library sources") set(PACELIB_URL "https://github.com/ICAMS/lammps-user-pace/archive/refs/tags/v.2023.11.25.fix2.tar.gz" CACHE STRING "URL for PACE evaluator library sources")
set(PACELIB_MD5 "b45de9a633f42ed65422567e3ce56f9f" CACHE STRING "MD5 checksum of PACE evaluator library tarball") set(PACELIB_MD5 "a53bd87cfee8b07d9f44bc17aad69c3f" CACHE STRING "MD5 checksum of PACE evaluator library tarball")
mark_as_advanced(PACELIB_URL) mark_as_advanced(PACELIB_URL)
mark_as_advanced(PACELIB_MD5) mark_as_advanced(PACELIB_MD5)
GetFallbackURL(PACELIB_URL PACELIB_FALLBACK) GetFallbackURL(PACELIB_URL PACELIB_FALLBACK)
@ -42,9 +47,16 @@ else()
get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace) get_newest_file(${CMAKE_BINARY_DIR}/lammps-user-pace-* lib-pace)
endif() endif()
# some preinstalled yaml-cpp versions don't provide a namespaced target
find_package(yaml-cpp QUIET)
if(TARGET yaml-cpp AND NOT TARGET yaml-cpp::yaml-cpp)
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
endif()
add_subdirectory(${lib-pace} build-pace) add_subdirectory(${lib-pace} build-pace)
set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE}) set_target_properties(pace PROPERTIES CXX_EXTENSIONS ON OUTPUT_NAME lammps_pace${LAMMPS_MACHINE})
if(CMAKE_PROJECT_NAME STREQUAL "lammps") if(CMAKE_PROJECT_NAME STREQUAL "lammps")
target_link_libraries(lammps PRIVATE pace) target_link_libraries(lammps PRIVATE pace)
endif() endif()
endif()

View File

@ -18,11 +18,11 @@ from install_helpers import fullpath, geturl, checkmd5sum, getfallback
# settings # settings
thisdir = fullpath('.') thisdir = fullpath('.')
version ='v.2023.11.25.fix' version ='v.2023.11.25.fix2'
# known checksums for different PACE versions. used to validate the download. # known checksums for different PACE versions. used to validate the download.
checksums = { \ checksums = { \
'v.2023.11.25.fix': 'b45de9a633f42ed65422567e3ce56f9f' 'v.2023.11.25.fix2': 'a53bd87cfee8b07d9f44bc17aad69c3f'
} }
parser = ArgumentParser(prog='Install.py', description="LAMMPS library build wrapper script") parser = ArgumentParser(prog='Install.py', description="LAMMPS library build wrapper script")