update so it can be built either standalone or as subdir with LAMMPS

This commit is contained in:
Axel Kohlmeyer
2023-04-29 03:55:54 -04:00
parent 478058119b
commit 39a77064e0
2 changed files with 22 additions and 0 deletions

View File

@ -47,6 +47,10 @@ add_executable(phana
)
target_include_directories(phana PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
if(NOT LAMMPS_DIR)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/Modules)
set(LAMMPS_THIRDPARTY_URL "https://download.lammps.org/thirdparty")
endif()
find_package(FFTW3)
if(FFTW3_FOUND)
target_compile_definitions(phana PRIVATE FFTW3)
@ -56,12 +60,29 @@ endif()
# build bundeled libraries
add_subdirectory(tricubic)
# standalone build must build our own version of linalg
if(NOT LAMMPS_DIR)
if(NOT USE_INTERNAL_LINALG)
find_package(LAPACK)
find_package(BLAS)
endif()
if(NOT LAPACK_FOUND OR NOT BLAS_FOUND OR USE_INTERNAL_LINALG)
file(GLOB LINALG_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/linalg/[^.]*.cpp)
add_library(linalg STATIC ${LINALG_SOURCES})
set(BLAS_LIBRARIES "$<TARGET_FILE:linalg>")
set(LAPACK_LIBRARIES "$<TARGET_FILE:linalg>")
else()
list(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif()
endif()
option(USE_SPGLIB "Download and use spglib for phonon DOS and other optional properties" ON)
if(USE_SPGLIB)
set(SPGLIB_URL "https://github.com/spglib/spglib/archive/refs/tags/v1.11.2.1.tar.gz" CACHE STRING "URL for spglib v1.x tarball")
set(SPGLIB_MD5 "3089782bc85b5034dd4765a18ee70bc7" CACHE STRING "MD5 checksum for spglib tarball")
mark_as_advanced(SPGLIB_URL)
mark_as_advanced(SPGLIB_MD5)
include(LAMMPSUtils)
GetFallbackURL(SPGLIB_URL SPGLIB_FALLBACK)
include(ExternalProject)

View File

@ -0,0 +1 @@
#define VERSION @CMAKE_PROJECT_VERSION@