forked from lijiext/lammps
Update cmake build to work with cmake-based KIM
This commit is contained in:
parent
9ed6f2fc43
commit
dd61ded311
|
@ -454,7 +454,7 @@ endif()
|
|||
if(PKG_LATTE)
|
||||
option(DOWNLOAD_LATTE "Download latte (instead of using the system's one)" OFF)
|
||||
if(DOWNLOAD_LATTE)
|
||||
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
|
||||
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
|
||||
message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
|
||||
endif()
|
||||
message(STATUS "LATTE not found - we will build our own")
|
||||
|
@ -485,15 +485,15 @@ if(PKG_USER-SCAFACOS)
|
|||
ExternalProject_Add(scafacos_build
|
||||
URL https://github.com/scafacos/scafacos/releases/download/v1.0.1/scafacos-1.0.1.tar.gz
|
||||
URL_MD5 bd46d74e3296bd8a444d731bb10c1738
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
--disable-doc
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
--disable-doc
|
||||
--enable-fcs-solvers=fmm,p2nfft,direct,ewald,p3m
|
||||
--with-internal-fftw
|
||||
--with-internal-pfft
|
||||
--with-internal-pnfft
|
||||
$<$<BOOL:${BUILD_SHARED_LIBS}>:--with-pic>
|
||||
FC=${CMAKE_MPI_Fortran_COMPILER}
|
||||
CXX=${CMAKE_MPI_CXX_COMPILER}
|
||||
$<$<BOOL:${BUILD_SHARED_LIBS}>:--with-pic>
|
||||
FC=${CMAKE_MPI_Fortran_COMPILER}
|
||||
CXX=${CMAKE_MPI_CXX_COMPILER}
|
||||
CC=${CMAKE_MPI_C_COMPILER}
|
||||
F77=
|
||||
)
|
||||
|
@ -547,7 +547,7 @@ if(PKG_USER-SMD)
|
|||
if(DOWNLOAD_EIGEN3)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(Eigen3_build
|
||||
URL http://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz
|
||||
URL http://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz
|
||||
URL_MD5 1a47e78efe365a97de0c022d127607c3
|
||||
CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ""
|
||||
)
|
||||
|
@ -588,23 +588,23 @@ if(PKG_KIM)
|
|||
if(DOWNLOAD_KIM)
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(kim_build
|
||||
URL https://github.com/openkim/kim-api/archive/v1.9.5.tar.gz
|
||||
URL_MD5 9f66efc128da33039e30659f36fc6d00
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
|
||||
URL https://s3.openkim.org/kim-api/kim-api-v2.0.0-beta.2.txz
|
||||
URL_MD5 1fbdbb734059cf0dc9d807e6dd6cc8ea
|
||||
BINARY_DIR build
|
||||
CMAKE_ARGS -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_Fortran_COMPILER=gfortran-8 -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_BUILD_TYPE=Release
|
||||
)
|
||||
ExternalProject_get_property(kim_build INSTALL_DIR)
|
||||
set(KIM_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api-v1)
|
||||
set(KIM_LIBRARIES ${INSTALL_DIR}/lib/libkim-api-v1.so)
|
||||
set(KIM-API-V2_INCLUDE_DIRS ${INSTALL_DIR}/include/kim-api-v2)
|
||||
set(KIM-API-V2_LIBRARIES ${INSTALL_DIR}/lib/libkim-api-v2.2${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
list(APPEND LAMMPS_DEPS kim_build)
|
||||
else()
|
||||
find_package(KIM)
|
||||
if(NOT KIM_FOUND)
|
||||
message(FATAL_ERROR "KIM not found, help CMake to find it by setting KIM_LIBRARY and KIM_INCLUDE_DIR, or set DOWNLOAD_KIM=ON to download it")
|
||||
find_package(KIM-API-V2)
|
||||
if(NOT KIM-API-V2_FOUND)
|
||||
message(FATAL_ERROR "KIM not found, help CMake to find it by setting PKG_CONFIG_PATH, or set DOWNLOAD_KIM=ON to download it")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND LAMMPS_LINK_LIBS ${KIM_LIBRARIES})
|
||||
include_directories(${KIM_INCLUDE_DIRS})
|
||||
list(APPEND LAMMPS_LINK_LIBS ${KIM-API-V3_LIBRARIES})
|
||||
include_directories(${KIM-API-V2_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(PKG_MESSAGE)
|
||||
|
@ -645,7 +645,7 @@ if(PKG_MSCG)
|
|||
find_package(GSL REQUIRED)
|
||||
option(DOWNLOAD_MSCG "Download latte (instead of using the system's one)" OFF)
|
||||
if(DOWNLOAD_MSCG)
|
||||
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
|
||||
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
|
||||
message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
|
||||
endif()
|
||||
include(ExternalProject)
|
||||
|
@ -1020,7 +1020,7 @@ if(PKG_USER-INTEL)
|
|||
endif()
|
||||
|
||||
if(PKG_GPU)
|
||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if (CMAKE_VERSION VERSION_LESS "3.1")
|
||||
message(FATAL_ERROR "For the GPU package you need at least cmake-3.1")
|
||||
endif()
|
||||
set(GPU_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/GPU)
|
||||
|
@ -1224,7 +1224,7 @@ if(BUILD_EXE)
|
|||
add_dependencies(lmp ${LAMMPS_DEPS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
set_target_properties(lmp PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
|
||||
install(TARGETS lmp DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ${LAMMPS_DOC_DIR}/lammps.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 RENAME ${LAMMPS_BINARY}.1)
|
||||
|
@ -1361,14 +1361,14 @@ message(STATUS "<<< Build configuration >>>
|
|||
get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
||||
list (FIND LANGUAGES "Fortran" _index)
|
||||
if (${_index} GREATER -1)
|
||||
message(STATUS "Fortran Compiler ${CMAKE_Fortran_COMPILER}
|
||||
message(STATUS "Fortran Compiler ${CMAKE_Fortran_COMPILER}
|
||||
Type ${CMAKE_Fortran_COMPILER_ID}
|
||||
Version ${CMAKE_Fortran_COMPILER_VERSION}
|
||||
Fortran Flags ${CMAKE_Fortran_FLAGS} ${CMAKE_Fortran_FLAGS_${BTYPE}}")
|
||||
endif()
|
||||
list (FIND LANGUAGES "C" _index)
|
||||
if (${_index} GREATER -1)
|
||||
message(STATUS "C Compiler ${CMAKE_C_COMPILER}
|
||||
message(STATUS "C Compiler ${CMAKE_C_COMPILER}
|
||||
Type ${CMAKE_C_COMPILER_ID}
|
||||
Version ${CMAKE_C_COMPILER_VERSION}
|
||||
C Flags ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BTYPE}}")
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
# The contents of this file are subject to the terms of the Common Development
|
||||
# and Distribution License Version 1.0 (the "License").
|
||||
#
|
||||
# You can obtain a copy of the license at
|
||||
# http://www.opensource.org/licenses/CDDL-1.0. See the License for the
|
||||
# specific language governing permissions and limitations under the License.
|
||||
#
|
||||
# When distributing Covered Code, include this CDDL HEADER in each file and
|
||||
# include the License file in a prominent location with the name LICENSE.CDDL.
|
||||
# If applicable, add the following below this CDDL HEADER, with the fields
|
||||
# enclosed by brackets "[]" replaced with your own identifying information:
|
||||
#
|
||||
# Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
|
||||
#
|
||||
# CDDL HEADER END
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2013--2018, Regents of the University of Minnesota.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Richard Berger
|
||||
# Christoph Junghans
|
||||
# Ryan S. Elliott
|
||||
#
|
||||
|
||||
#
|
||||
# Release: This file is part of the kim-api.git repository.
|
||||
#
|
||||
|
||||
|
||||
# - Find KIM-API-V2
|
||||
#
|
||||
# sets standard pkg_check_modules variables plus:
|
||||
#
|
||||
# KIM-API-V2-CMAKE_C_COMPILER
|
||||
# KIM-API-V2-CMAKE_CXX_COMPILER
|
||||
# KIM-API-V2-CMAKE_Fortran_COMPILER
|
||||
#
|
||||
find_package(PkgConfig REQUIRED)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
pkg_check_modules(KIM-API-V2 REQUIRED libkim-api-v2>=2.0)
|
||||
|
||||
pkg_get_variable(KIM-API-V2-CMAKE_C_COMPILER libkim-api-v2 CMAKE_C_COMPILER)
|
||||
pkg_get_variable(KIM-API-V2-CMAKE_CXX_COMPILER libkim-api-v2 CMAKE_CXX_COMPILER)
|
||||
pkg_get_variable(KIM-API-V2_CMAKE_Fortran_COMPILER libkim-api-v2 CMAKE_Fortran_COMPILER)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set KIM-API-V2_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
find_package_handle_standard_args(KIM-API-V2 REQUIRED_VARS KIM-API-V2_LIBRARIES)
|
|
@ -1,22 +0,0 @@
|
|||
# - Find kim
|
||||
# Find the native KIM headers and libraries.
|
||||
#
|
||||
# KIM_INCLUDE_DIRS - where to find kim.h, etc.
|
||||
# KIM_LIBRARIES - List of libraries when using kim.
|
||||
# KIM_FOUND - True if kim found.
|
||||
#
|
||||
|
||||
find_path(KIM_INCLUDE_DIR KIM_SimulatorHeaders.hpp PATH_SUFFIXES kim-api-v2)
|
||||
|
||||
find_library(KIM_LIBRARY NAMES kim-api-v2)
|
||||
|
||||
set(KIM_LIBRARIES ${KIM_LIBRARY})
|
||||
set(KIM_INCLUDE_DIRS ${KIM_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set KIM_FOUND to TRUE
|
||||
# if all listed variables are TRUE
|
||||
|
||||
find_package_handle_standard_args(KIM DEFAULT_MSG KIM_LIBRARY KIM_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(KIM_INCLUDE_DIR KIM_LIBRARY )
|
Loading…
Reference in New Issue