forked from lijiext/lammps
Update CMakeLists.txt to avoid merge conflicts
This commit is contained in:
parent
b068690e13
commit
540026ca00
|
@ -11,6 +11,10 @@ get_filename_component(LAMMPS_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib
|
|||
get_filename_component(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib ABSOLUTE)
|
||||
get_filename_component(LAMMPS_DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../doc ABSOLUTE)
|
||||
|
||||
# by default, install into $HOME/.local (not /usr/local), so that no root access (and sudo!!) is needed
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/.local" CACHE PATH "default install path" FORCE )
|
||||
endif()
|
||||
|
||||
# To avoid conflicts with the conventional Makefile build system, we build everything here
|
||||
file(GLOB LIB_SOURCES ${LAMMPS_SOURCE_DIR}/[^.]*.cpp)
|
||||
|
@ -75,6 +79,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
|
|||
#release comes with -O3 by default
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
|
||||
|
||||
# check for files auto-generated by make-based buildsystem
|
||||
# this is fast, so check for it all the time
|
||||
|
@ -171,8 +176,9 @@ set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS DIPOLE GRANULAR
|
|||
USER-BOCS USER-CGDNA USER-MESO USER-CGSDK USER-COLVARS USER-DIFFRACTION
|
||||
USER-DPD USER-DRUDE USER-EFF USER-FEP USER-H5MD USER-LB USER-MANIFOLD
|
||||
USER-MEAMC USER-MGPT USER-MISC USER-MOFFF USER-MOLFILE USER-NETCDF
|
||||
USER-PHONON USER-PTM USER-QTB USER-REAXC USER-SCAFACOS USER-SMD USER-SMTBQ
|
||||
USER-SPH USER-TALLY USER-UEF USER-VTK USER-QUIP USER-QMMM)
|
||||
USER-PHONON USER-PLUMED USER-PTM USER-QTB USER-REAXC USER-SCAFACOS
|
||||
USER-SDPD USER-SMD USER-SMTBQ USER-SPH USER-TALLY USER-UEF USER-VTK
|
||||
USER-QUIP USER-QMMM)
|
||||
set(ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU)
|
||||
set(OTHER_PACKAGES CORESHELL QEQ)
|
||||
foreach(PKG ${DEFAULT_PACKAGES})
|
||||
|
@ -215,7 +221,7 @@ else()
|
|||
endif()
|
||||
|
||||
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS size limit")
|
||||
set(LAMMPS_SIZES "smallbig" CACHE STRING "LAMMPS integer sizes (smallsmall: all 32-bit, smallbig: 64-bit #atoms #timesteps, bigbig: also 64-bit imageint, 64-bit atom ids)")
|
||||
set(LAMMPS_SIZES_VALUES smallbig bigbig smallsmall)
|
||||
set_property(CACHE LAMMPS_SIZES PROPERTY STRINGS ${LAMMPS_SIZES_VALUES})
|
||||
validate_option(LAMMPS_SIZES LAMMPS_SIZES_VALUES)
|
||||
|
@ -303,7 +309,7 @@ pkg_depends(USER-SCAFACOS MPI)
|
|||
|
||||
find_package(OpenMP QUIET)
|
||||
option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND})
|
||||
if(BUILD_OMP OR PKG_USER-OMP OR PKG_KOKKOS OR PKG_USER-INTEL)
|
||||
if(BUILD_OMP OR PKG_KOKKOS OR PKG_USER-INTEL)
|
||||
find_package(OpenMP REQUIRED)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
|
@ -421,16 +427,30 @@ if(WITH_FFMPEG)
|
|||
add_definitions(-DLAMMPS_FFMPEG)
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CONFIGURE_REQUEST_PIC "--with-pic")
|
||||
set(CMAKE_REQUEST_PIC "-DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}")
|
||||
set(CUDA_REQUEST_PIC "-Xcompiler ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||
else()
|
||||
set(CONFIGURE_REQUEST_PIC)
|
||||
set(CMAKE_REQUEST_PIC)
|
||||
set(CUDA_REQUEST_PIC)
|
||||
endif()
|
||||
|
||||
|
||||
if(PKG_VORONOI)
|
||||
option(DOWNLOAD_VORO "Download voro++ (instead of using the system's one)" OFF)
|
||||
option(DOWNLOAD_VORO "Download and compile the Voro++ library instead of using an already installed one" OFF)
|
||||
if(DOWNLOAD_VORO)
|
||||
message(STATUS "Voro++ download requested - we will build our own")
|
||||
include(ExternalProject)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(VORO_BUILD_OPTIONS "CFLAGS=-fPIC")
|
||||
set(VORO_BUILD_CFLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}")
|
||||
else()
|
||||
set(VORO_BUILD_OPTIONS)
|
||||
set(VORO_BUILD_CFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BTYPE}}")
|
||||
endif()
|
||||
string(APPEND VORO_BUILD_CFLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(VORO_BUILD_OPTIONS CXX=${CMAKE_CXX_COMPILER} CFLAGS=${VORO_BUILD_CFLAGS})
|
||||
|
||||
ExternalProject_Add(voro_build
|
||||
URL http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz
|
||||
|
@ -444,7 +464,7 @@ if(PKG_VORONOI)
|
|||
else()
|
||||
find_package(VORO)
|
||||
if(NOT VORO_FOUND)
|
||||
message(FATAL_ERROR "VORO not found, help CMake to find it by setting VORO_LIBRARY and VORO_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it")
|
||||
message(FATAL_ERROR "Voro++ library not found. Help CMake to find it by setting VORO_LIBRARY and VORO_INCLUDE_DIR, or set DOWNLOAD_VORO=ON to download it")
|
||||
endif()
|
||||
endif()
|
||||
include_directories(${VORO_INCLUDE_DIRS})
|
||||
|
@ -452,26 +472,26 @@ if(PKG_VORONOI)
|
|||
endif()
|
||||
|
||||
if(PKG_LATTE)
|
||||
option(DOWNLOAD_LATTE "Download latte (instead of using the system's one)" OFF)
|
||||
option(DOWNLOAD_LATTE "Download the LATTE library instead of using an already installed one" OFF)
|
||||
if(DOWNLOAD_LATTE)
|
||||
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")
|
||||
message(STATUS "LATTE download requested - we will build our own")
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(latte_build
|
||||
URL https://github.com/lanl/LATTE/archive/v1.2.1.tar.gz
|
||||
URL_MD5 85ac414fdada2d04619c8f936344df14
|
||||
SOURCE_SUBDIR cmake
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE}
|
||||
)
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC}
|
||||
)
|
||||
ExternalProject_get_property(latte_build INSTALL_DIR)
|
||||
set(LATTE_LIBRARIES ${INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/liblatte.a)
|
||||
list(APPEND LAMMPS_DEPS latte_build)
|
||||
else()
|
||||
find_package(LATTE)
|
||||
if(NOT LATTE_FOUND)
|
||||
message(FATAL_ERROR "LATTE not found, help CMake to find it by setting LATTE_LIBRARY, or set DOWNLOAD_LATTE=ON to download it")
|
||||
message(FATAL_ERROR "LATTE library not found, help CMake to find it by setting LATTE_LIBRARY, or set DOWNLOAD_LATTE=ON to download it")
|
||||
endif()
|
||||
endif()
|
||||
list(APPEND LAMMPS_LINK_LIBS ${LATTE_LIBRARIES} ${LAPACK_LIBRARIES})
|
||||
|
@ -479,24 +499,22 @@ endif()
|
|||
|
||||
if(PKG_USER-SCAFACOS)
|
||||
find_package(GSL REQUIRED)
|
||||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS (instead of using the system's one)" OFF)
|
||||
option(DOWNLOAD_SCAFACOS "Download ScaFaCoS library instead of using an already installed one" OFF)
|
||||
if(DOWNLOAD_SCAFACOS)
|
||||
message(STATUS "ScaFaCoS download requested - we will build our own")
|
||||
include(ExternalProject)
|
||||
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>
|
||||
--with-internal-fftw --with-internal-pfft
|
||||
--with-internal-pnfft ${CONFIGURE_REQUEST_PIC}
|
||||
FC=${CMAKE_MPI_Fortran_COMPILER}
|
||||
CXX=${CMAKE_MPI_CXX_COMPILER}
|
||||
CC=${CMAKE_MPI_C_COMPILER}
|
||||
F77=
|
||||
)
|
||||
)
|
||||
ExternalProject_get_property(scafacos_build INSTALL_DIR)
|
||||
set(SCAFACOS_BUILD_DIR ${INSTALL_DIR})
|
||||
set(SCAFACOS_INCLUDE_DIRS ${SCAFACOS_BUILD_DIR}/include)
|
||||
|
@ -528,6 +546,54 @@ if(PKG_USER-SCAFACOS)
|
|||
include_directories(${SCAFACOS_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(PKG_USER-PLUMED)
|
||||
find_package(GSL REQUIRED)
|
||||
set(PLUMED_MODE "static" CACHE STRING "Linkage mode for Plumed2 library")
|
||||
set(PLUMED_MODE_VALUES static shared runtime)
|
||||
set_property(CACHE PLUMED_MODE PROPERTY STRINGS ${PLUMED_MODE_VALUES})
|
||||
validate_option(PLUMED_MODE PLUMED_MODE_VALUES)
|
||||
string(TOUPPER ${PLUMED_MODE} PLUMED_MODE)
|
||||
|
||||
option(DOWNLOAD_PLUMED "Download Plumed package instead of using an already installed one" OFF)
|
||||
if(DOWNLOAD_PLUMED)
|
||||
message(STATUS "PLUMED download requested - we will build our own")
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(plumed_build
|
||||
URL https://github.com/plumed/plumed2/releases/download/v2.4.3/plumed-src-2.4.3.tgz
|
||||
URL_MD5 b1be7c48971627febc11c61b70767fc5
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> ${CONFIGURE_REQUEST_PIC})
|
||||
ExternalProject_get_property(plumed_build INSTALL_DIR)
|
||||
set(PLUMED_INSTALL_DIR ${INSTALL_DIR})
|
||||
list(APPEND LAMMPS_DEPS plumed_build)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
add_definitions(-D__PLUMED_WRAPPER_CXX=1)
|
||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/plumed/obj/kernel.o
|
||||
"${PLUMED_INSTALL_DIR}/lib/plumed/obj/PlumedStatic.o" ${GSL_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${CMAKE_DL_LIBS})
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so)
|
||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumedWrapper.a -rdynamic ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
set(PLUMED_INCLUDE_DIRS "${PLUMED_INSTALL_DIR}/include")
|
||||
else()
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(PLUMED plumed REQUIRED)
|
||||
if(PLUMED_MODE STREQUAL "STATIC")
|
||||
add_definitions(-D__PLUMED_WRAPPER_CXX=1)
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.static)
|
||||
elseif(PLUMED_MODE STREQUAL "SHARED")
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.shared)
|
||||
elseif(PLUMED_MODE STREQUAL "RUNTIME")
|
||||
add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_LIBDIR}/libplumedKernel.so)
|
||||
include(${PLUMED_LIBDIR}/plumed/src/lib/Plumed.cmake.runtime)
|
||||
endif()
|
||||
list(APPEND LAMMPS_LINK_LIBS ${PLUMED_LOAD})
|
||||
endif()
|
||||
include_directories(${PLUMED_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(PKG_USER-MOLFILE)
|
||||
add_library(molfile INTERFACE)
|
||||
target_include_directories(molfile INTERFACE ${LAMMPS_LIB_SOURCE_DIR}/molfile)
|
||||
|
@ -543,8 +609,9 @@ if(PKG_USER-NETCDF)
|
|||
endif()
|
||||
|
||||
if(PKG_USER-SMD)
|
||||
option(DOWNLOAD_EIGEN3 "Download Eigen3 (instead of using the system's one)" OFF)
|
||||
option(DOWNLOAD_EIGEN3 "Download Eigen3 instead of using an already installed one)" OFF)
|
||||
if(DOWNLOAD_EIGEN3)
|
||||
message(STATUS "Eigen3 download requested - we will build our own")
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(Eigen3_build
|
||||
URL http://bitbucket.org/eigen/eigen/get/3.3.4.tar.gz
|
||||
|
@ -584,8 +651,9 @@ if(PKG_USER-VTK)
|
|||
endif()
|
||||
|
||||
if(PKG_KIM)
|
||||
option(DOWNLOAD_KIM "Download kim-api (instead of using the system's one)" OFF)
|
||||
option(DOWNLOAD_KIM "Download KIM-API v2 from OpenKIM instead of using an already installed one" OFF)
|
||||
if(DOWNLOAD_KIM)
|
||||
message(STATUS "KIM-API v2 download requested - we will build our own")
|
||||
enable_language(C)
|
||||
enable_language(Fortran)
|
||||
include(ExternalProject)
|
||||
|
@ -606,7 +674,7 @@ if(PKG_KIM)
|
|||
else()
|
||||
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")
|
||||
message(FATAL_ERROR "KIM-API v2 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-API-V2_LDFLAGS}")
|
||||
|
@ -619,12 +687,7 @@ if(PKG_MESSAGE)
|
|||
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.c
|
||||
${LAMMPS_LIB_SOURCE_DIR}/message/cslib/[^.]*.cpp)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(cslib SHARED ${cslib_SOURCES})
|
||||
else()
|
||||
add_library(cslib STATIC ${cslib_SOURCES})
|
||||
endif()
|
||||
|
||||
add_library(cslib STATIC ${cslib_SOURCES})
|
||||
if(BUILD_MPI)
|
||||
target_compile_definitions(cslib PRIVATE -DMPI_YES)
|
||||
set_target_properties(cslib PROPERTIES OUTPUT_NAME "csmpi")
|
||||
|
@ -649,10 +712,10 @@ endif()
|
|||
|
||||
if(PKG_MSCG)
|
||||
find_package(GSL REQUIRED)
|
||||
option(DOWNLOAD_MSCG "Download latte (instead of using the system's one)" OFF)
|
||||
option(DOWNLOAD_MSCG "Download MSCG library instead of using an already installed one)" OFF)
|
||||
if(DOWNLOAD_MSCG)
|
||||
if (CMAKE_VERSION VERSION_LESS "3.7") # due to SOURCE_SUBDIR
|
||||
message(FATAL_ERROR "For downlading LATTE you need at least cmake-3.7")
|
||||
message(FATAL_ERROR "For downlading MSCG you need at least cmake-3.7")
|
||||
endif()
|
||||
include(ExternalProject)
|
||||
if(NOT LAPACK_FOUND)
|
||||
|
@ -662,7 +725,7 @@ if(PKG_MSCG)
|
|||
URL https://github.com/uchicago-voth/MSCG-release/archive/1.7.3.1.tar.gz
|
||||
URL_MD5 8c45e269ee13f60b303edd7823866a91
|
||||
SOURCE_SUBDIR src/CMake
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_POSITION_INDEPENDENT_CODE=${CMAKE_POSITION_INDEPENDENT_CODE} ${EXTRA_MSCG_OPTS}
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> ${CMAKE_REQUEST_PIC} ${EXTRA_MSCG_OPTS}
|
||||
BUILD_COMMAND make mscg INSTALL_COMMAND ""
|
||||
)
|
||||
ExternalProject_get_property(mscg_build BINARY_DIR)
|
||||
|
@ -710,7 +773,7 @@ set(MATH_LIBRARIES "m" CACHE STRING "math library")
|
|||
mark_as_advanced( MATH_LIBRARIES )
|
||||
include(CheckLibraryExists)
|
||||
if (CMAKE_VERSION VERSION_LESS "3.4")
|
||||
enable_language(C) # check_library_exists isn't supported without a c compiler before v3.4
|
||||
enable_language(C) # check_library_exists isn't supported without a C compiler before v3.4
|
||||
endif()
|
||||
# RB: disabled this check because it breaks with KOKKOS CUDA enabled
|
||||
#foreach(FUNC sin cos)
|
||||
|
@ -748,6 +811,13 @@ foreach(PKG ${DEFAULT_PACKAGES})
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
# packages that need defines set
|
||||
foreach(PKG MPIIO)
|
||||
if(PKG_${PKG})
|
||||
add_definitions(-DLMP_${PKG})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# dedicated check for entire contents of accelerator packages
|
||||
foreach(PKG ${ACCEL_PACKAGES})
|
||||
set(${PKG}_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/${PKG})
|
||||
|
@ -776,7 +846,7 @@ foreach(SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD
|
|||
if(PKG_LIB STREQUAL awpmd)
|
||||
target_include_directories(awpmd PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/awpmd/systems/interact ${LAMMPS_LIB_SOURCE_DIR}/awpmd/ivutils/include)
|
||||
elseif(PKG_LIB STREQUAL h5md)
|
||||
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include)
|
||||
target_include_directories(h5md PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/h5md/include ${HDF5_INCLUDE_DIRS})
|
||||
elseif(PKG_LIB STREQUAL colvars)
|
||||
target_compile_options(colvars PRIVATE -DLEPTON)
|
||||
target_include_directories(colvars PRIVATE ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton/include)
|
||||
|
@ -792,6 +862,9 @@ if(PKG_USER-AWPMD)
|
|||
endif()
|
||||
|
||||
if(PKG_USER-ATC)
|
||||
if(LAMMPS_SIZES STREQUAL BIGBIG)
|
||||
message(FATAL_ERROR "The USER-ATC Package is not compatible with -DLAMMPS_BIGBIG")
|
||||
endif()
|
||||
target_link_libraries(atc ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
|
||||
|
@ -799,6 +872,7 @@ if(PKG_USER-H5MD)
|
|||
find_package(HDF5 REQUIRED)
|
||||
target_link_libraries(h5md ${HDF5_LIBRARIES})
|
||||
target_include_directories(h5md PRIVATE ${HDF5_INCLUDE_DIRS})
|
||||
include_directories(${HDF5_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -884,6 +958,20 @@ if(PKG_USER-OMP)
|
|||
include_directories(${USER-OMP_SOURCES_DIR})
|
||||
endif()
|
||||
|
||||
# Fix rigid/meso requires RIGID to be installed
|
||||
if(PKG_USER-SDPD)
|
||||
set(USER-SDPD_SOURCES_DIR ${LAMMPS_SOURCE_DIR}/USER-SDPD)
|
||||
|
||||
get_property(hlist GLOBAL PROPERTY FIX)
|
||||
if(NOT PKG_RIGID)
|
||||
list(REMOVE_ITEM hlist ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.h)
|
||||
list(REMOVE_ITEM LIB_SOURCES ${USER-SDPD_SOURCES_DIR}/fix_rigid_meso.cpp)
|
||||
endif()
|
||||
set_property(GLOBAL PROPERTY FIX "${hlist}")
|
||||
|
||||
include_directories(${USER-SDPD_SOURCES_DIR})
|
||||
endif()
|
||||
|
||||
if(PKG_KOKKOS)
|
||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
||||
|
@ -961,7 +1049,7 @@ if(PKG_USER-INTEL)
|
|||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)
|
||||
message(FATAL_ERROR "USER-INTEL is needed at least 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
message(FATAL_ERROR "USER-INTEL needs at least a 2016 intel compiler, found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
endif()
|
||||
|
||||
if(NOT BUILD_OMP)
|
||||
|
@ -1061,11 +1149,11 @@ if(PKG_GPU)
|
|||
find_package(CUDA REQUIRED)
|
||||
find_program(BIN2C bin2c)
|
||||
if(NOT BIN2C)
|
||||
message(FATAL_ERROR "Couldn't find bin2c, use -DBIN2C helping cmake to find it.")
|
||||
message(FATAL_ERROR "Could not find bin2c, use -DBIN2C=/path/to/bin2c to help cmake finding it.")
|
||||
endif()
|
||||
option(CUDPP_OPT "Enable CUDPP_OPT" ON)
|
||||
|
||||
set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM architecture (e.g. sm_60)")
|
||||
set(GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM primary architecture (e.g. sm_60)")
|
||||
|
||||
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/[^.]*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/[^.]*.cu)
|
||||
list(REMOVE_ITEM GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
|
||||
|
@ -1078,11 +1166,39 @@ if(PKG_GPU)
|
|||
file(GLOB GPU_LIB_CUDPP_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/cudpp_mini/[^.]*.cu)
|
||||
endif()
|
||||
|
||||
cuda_compile_cubin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS
|
||||
-DUNIX -O3 -Xptxas -v --use_fast_math -DNV_KERNEL -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC_SETTING})
|
||||
# build arch/gencode commands for nvcc based on CUDA toolkit version and use choice
|
||||
# --arch translates directly instead of JIT, so this should be for the preferred or most common architecture
|
||||
set(GPU_CUDA_GENCODE "-arch=${GPU_ARCH} ")
|
||||
# Fermi (GPU Arch 2.x) is supported by CUDA 3.2 to CUDA 8.0
|
||||
if((CUDA_VERSION VERSION_GREATER "3.1") AND (CUDA_VERSION VERSION_LESS "9.0"))
|
||||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_20,code=[sm_20,compute_20] ")
|
||||
endif()
|
||||
# Kepler (GPU Arch 3.x) is supported by CUDA 5 and later
|
||||
if(CUDA_VERSION VERSION_GREATER "4.9")
|
||||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_30,code=[sm_30,compute_30] -gencode arch=compute_35,code=[sm_35,compute_35] ")
|
||||
endif()
|
||||
# Maxwell (GPU Arch 5.x) is supported by CUDA 6 and later
|
||||
if(CUDA_VERSION VERSION_GREATER "5.9")
|
||||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] ")
|
||||
endif()
|
||||
# Pascal (GPU Arch 6.x) is supported by CUDA 8 and later
|
||||
if(CUDA_VERSION VERSION_GREATER "7.9")
|
||||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_60,code=[sm_60,compute_60] -gencode arch=compute_61,code=[sm_61,compute_61] ")
|
||||
endif()
|
||||
# Volta (GPU Arch 7.0) is supported by CUDA 9 and later
|
||||
if(CUDA_VERSION VERSION_GREATER "8.9")
|
||||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_70,code=[sm_70,compute_70] ")
|
||||
endif()
|
||||
# Turing (GPU Arch 7.5) is supported by CUDA 10 and later
|
||||
if(CUDA_VERSION VERSION_GREATER "9.9")
|
||||
string(APPEND GPU_CUDA_GENCODE "-gencode arch=compute_75,code=[sm_75,compute_75] ")
|
||||
endif()
|
||||
|
||||
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS $<$<BOOL:${BUILD_SHARED_LIBS}>:-Xcompiler=-fPIC>
|
||||
-DUNIX -O3 -Xptxas -v --use_fast_math -DUCL_CUDADR -arch=${GPU_ARCH} -D_${GPU_PREC_SETTING})
|
||||
cuda_compile_fatbin(GPU_GEN_OBJS ${GPU_LIB_CU} OPTIONS
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DNV_KERNEL -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING})
|
||||
|
||||
cuda_compile(GPU_OBJS ${GPU_LIB_CUDPP_CU} OPTIONS ${CUDA_REQUEST_PIC}
|
||||
-DUNIX -O3 --use_fast_math -Wno-deprecated-gpu-targets -DUCL_CUDADR ${GPU_CUDA_GENCODE} -D_${GPU_PREC_SETTING})
|
||||
|
||||
foreach(CU_OBJ ${GPU_GEN_OBJS})
|
||||
get_filename_component(CU_NAME ${CU_OBJ} NAME_WE)
|
||||
|
@ -1351,7 +1467,6 @@ foreach(PKG ${DEFAULT_PACKAGES} ${ACCEL_PACKAGES} ${OTHER_PACKAGES})
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE)
|
||||
get_directory_property(CPPFLAGS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||
include(FeatureSummary)
|
||||
feature_summary(DESCRIPTION "The following packages have been found:" WHAT PACKAGES_FOUND)
|
||||
|
@ -1382,7 +1497,7 @@ endif()
|
|||
if(CMAKE_EXE_LINKER_FLAGS)
|
||||
message(STATUS "Linker flags:
|
||||
Executable ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message(STATUS "Shared libraries ${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
else()
|
||||
|
|
Loading…
Reference in New Issue