2017-07-20 08:34:07 +08:00
########################################
# CMake build system
# This file is part of LAMMPS
# Created by Christoph Junghans and Richard Berger
2018-06-09 06:18:02 +08:00
cmake_minimum_required ( VERSION 2.8.12 )
2017-07-13 05:54:44 +08:00
2018-06-09 06:18:02 +08:00
project ( lammps CXX )
2017-07-13 05:54:44 +08:00
set ( SOVERSION 0 )
2017-09-09 01:33:49 +08:00
set ( LAMMPS_SOURCE_DIR ${ CMAKE_CURRENT_SOURCE_DIR } /../src )
set ( LAMMPS_LIB_SOURCE_DIR ${ CMAKE_CURRENT_SOURCE_DIR } /../lib )
2017-07-16 04:33:36 +08:00
set ( LAMMPS_LIB_BINARY_DIR ${ CMAKE_BINARY_DIR } /lib )
2017-07-13 05:54:44 +08:00
2017-07-20 08:34:07 +08:00
#To not conflict with old Makefile build system, we build everything here
2017-07-17 11:43:29 +08:00
file ( GLOB LIB_SOURCES ${ LAMMPS_SOURCE_DIR } /*.cpp )
file ( GLOB LMP_SOURCES ${ LAMMPS_SOURCE_DIR } /main.cpp )
list ( REMOVE_ITEM LIB_SOURCES ${ LMP_SOURCES } )
2017-07-15 05:55:36 +08:00
# Cmake modules/macros are in a subdirectory to keep this file cleaner
2017-09-09 01:33:49 +08:00
set ( CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /Modules )
2017-07-15 06:49:05 +08:00
2017-07-26 09:09:20 +08:00
if ( NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS )
2017-07-13 05:54:44 +08:00
#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 )
2017-07-26 09:09:20 +08:00
endif ( NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS )
2017-07-13 05:54:44 +08:00
2018-05-10 12:09:19 +08:00
file ( GLOB SRC_FILES ${ LAMMPS_SOURCE_DIR } /*.cpp )
list ( SORT SRC_FILES )
2018-05-10 05:26:59 +08:00
# check for files installed by make-based buildsystem
2018-05-10 12:09:19 +08:00
# only run this time consuming check if there are new files
if ( NOT SRC_FILES STREQUAL SRC_FILES_CACHED )
file ( GLOB SRC_PKG_FILES ${ LAMMPS_SOURCE_DIR } /*/*.cpp )
message ( STATUS "Running check for installed package (this might take a while)" )
foreach ( _SRC SRC_PKG_FILES )
get_filename_component ( FILENAME "${_SRC}" NAME )
if ( EXISTS ${ LAMMPS_SOURCE_DIR } / ${ FILENAME } )
message ( FATAL_ERROR "Found packages installed by the make-based buildsystem, please run 'make -C ${LAMMPS_SOURCE_DIR} no-all purge'" )
endif ( )
endforeach ( )
set ( SRC_FILES_CACHED "${SRC_FILES}" CACHE INTERNAL "List of file in LAMMPS_SOURCE_DIR" FORCE )
2017-08-19 17:29:16 +08:00
endif ( )
2017-07-18 01:52:06 +08:00
2017-07-13 05:54:44 +08:00
######################################################################
# compiler tests
# these need ot be done early (before further tests).
#####################################################################
include ( CheckCCompilerFlag )
2017-10-04 01:08:56 +08:00
if ( ${ CMAKE_CXX_COMPILER_ID } STREQUAL "Intel" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -restrict" )
endif ( )
2018-06-12 04:29:38 +08:00
option ( ENABLE_COVERAGE "Enable code coverage" OFF )
if ( ENABLE_COVERAGE )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" )
endif ( )
2017-07-13 05:54:44 +08:00
########################################################################
# User input options #
########################################################################
2018-06-23 01:11:09 +08:00
option ( BUILD_EXE "Build lmp binary" ON )
if ( BUILD_EXE )
set ( LAMMPS_MACHINE "" CACHE STRING "Suffix to append to lmp binary (WON'T enable any features automatically" )
mark_as_advanced ( LAMMPS_MACHINE )
if ( LAMMPS_MACHINE )
set ( LAMMPS_MACHINE "_${LAMMPS_MACHINE}" )
endif ( )
endif ( )
2018-06-23 01:06:12 +08:00
option ( BUILD_LIB "Build LAMMPS library" OFF )
if ( BUILD_LIB )
option ( BUILD_SHARED_LIBS "Build shared library" OFF )
if ( BUILD_SHARED_LIBS ) # for all pkg libs, mpi_stubs and linalg
set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
endif ( )
set ( LIB_SUFFIX "" CACHE STRING "Suffix to append to liblammps and pkg-config file" )
mark_as_advanced ( LIB_SUFFIX )
if ( LIB_SUFFIX )
set ( LIB_SUFFIX "_${LIB_SUFFIX}" )
endif ( )
2017-08-28 08:40:55 +08:00
endif ( )
2018-06-23 01:11:09 +08:00
if ( NOT BUILD_EXE AND NOT BUILD_LIB )
message ( FATAL_ERROR "You need to at least enable one of two following options: BUILD_LIB or BUILD_EXE" )
endif ( )
2018-05-12 05:33:18 +08:00
option ( DEVELOPER_MODE "Enable developer mode" OFF )
mark_as_advanced ( DEVELOPER_MODE )
2018-05-12 07:50:50 +08:00
option ( CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF )
2017-07-13 05:54:44 +08:00
include ( GNUInstallDirs )
2017-07-15 04:21:21 +08:00
set ( LAMMPS_LINK_LIBS )
2017-09-21 02:01:26 +08:00
set ( LAMMPS_DEPS )
2017-08-29 04:11:21 +08:00
set ( LAMMPS_API_DEFINES )
2018-05-10 13:12:00 +08:00
find_package ( MPI QUIET )
option ( BUILD_MPI "Build MPI version" ${ MPI_FOUND } )
if ( BUILD_MPI )
2017-07-15 04:21:21 +08:00
find_package ( MPI REQUIRED )
2018-05-11 09:20:06 +08:00
include_directories ( ${ MPI_CXX_INCLUDE_PATH } )
2017-07-15 04:21:21 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ MPI_CXX_LIBRARIES } )
2017-07-18 03:28:34 +08:00
option ( LAMMPS_LONGLONG_TO_LONG "Workaround if your system or MPI version does not recognize 'long long' data types" OFF )
2017-07-18 03:26:46 +08:00
if ( LAMMPS_LONGLONG_TO_LONG )
add_definitions ( -DLAMMPS_LONGLONG_TO_LONG )
endif ( )
2017-07-17 12:53:53 +08:00
else ( )
2018-05-10 12:16:19 +08:00
enable_language ( C )
2017-07-17 12:53:53 +08:00
file ( GLOB MPI_SOURCES ${ LAMMPS_SOURCE_DIR } /STUBS/mpi.c )
2017-08-29 03:17:27 +08:00
add_library ( mpi_stubs STATIC ${ MPI_SOURCES } )
2017-07-17 12:53:53 +08:00
include_directories ( ${ LAMMPS_SOURCE_DIR } /STUBS )
2017-08-27 22:58:47 +08:00
list ( APPEND LAMMPS_LINK_LIBS mpi_stubs )
2017-07-13 05:54:44 +08:00
endif ( )
2017-07-18 02:22:28 +08:00
set ( LAMMPS_SIZE_LIMIT "LAMMPS_SMALLBIG" CACHE STRING "Lammps size limit" )
set_property ( CACHE LAMMPS_SIZE_LIMIT PROPERTY STRINGS LAMMPS_SMALLBIG LAMMPS_BIGBIG LAMMPS_SMALLSMALL )
add_definitions ( -D ${ LAMMPS_SIZE_LIMIT } )
2017-08-29 04:11:21 +08:00
set ( LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${LAMMPS_SIZE_LIMIT}" )
2017-07-18 02:22:28 +08:00
2017-07-18 03:26:46 +08:00
set ( LAMMPS_MEMALIGN "64" CACHE STRING "enables the use of the posix_memalign() call instead of malloc() when large chunks or memory are allocated by LAMMPS" )
add_definitions ( -DLAMMPS_MEMALIGN= ${ LAMMPS_MEMALIGN } )
2017-08-01 01:48:22 +08:00
option ( LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF )
if ( LAMMPS_EXCEPTIONS )
add_definitions ( -DLAMMPS_EXCEPTIONS )
2017-10-01 05:44:15 +08:00
set ( LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -DLAMMPS_EXCEPTIONS" )
2017-08-01 01:48:22 +08:00
endif ( )
2017-07-13 05:54:44 +08:00
option ( CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF )
2017-07-21 06:14:02 +08:00
option ( ENABLE_TESTING "Enable testing" OFF )
if ( ENABLE_TESTING )
enable_testing ( )
endif ( ENABLE_TESTING )
2017-07-21 05:15:29 +08:00
set ( DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR
2018-06-28 09:02:10 +08:00
K S P A C E M A N Y B O D Y M C M E A M M I S C M O L E C U L E P E R I Q E Q R E A X R E P L I C A R I G I D S H O C K S N A P S R D
K I M P Y T H O N M S C G M P I I O V O R O N O I P O E M S L A T T E U S E R - A T C U S E R - A W P M D U S E R - B O C S U S E R - C G D N A
U S E R - M E S O U S E R - C G S D K U S E R - C O L V A R S U S E R - D I F F R A C T I O N U S E R - D P D U S E R - D R U D E U S E R - E F F
2017-07-17 07:52:43 +08:00
U S E R - F E P U S E R - H 5 M D U S E R - L B U S E R - M A N I F O L D U S E R - M E A M C U S E R - M G P T U S E R - M I S C
2018-01-21 23:10:38 +08:00
U S E R - M O F F F U S E R - M O L F I L E U S E R - N E T C D F U S E R - P H O N O N U S E R - Q T B U S E R - R E A X C U S E R - S M D
2017-10-08 02:38:41 +08:00
U S E R - S M T B Q U S E R - S P H U S E R - T A L L Y U S E R - U E F U S E R - V T K U S E R - Q U I P U S E R - Q M M M )
2017-07-18 01:01:08 +08:00
set ( ACCEL_PACKAGES USER-OMP KOKKOS OPT USER-INTEL GPU )
2018-06-28 09:02:10 +08:00
foreach ( PKG ${ DEFAULT_PACKAGES } ${ ACCEL_PACKAGES } )
2018-05-11 21:51:59 +08:00
option ( PKG_ ${ PKG } "Build ${PKG} Package" OFF )
2017-07-15 06:49:05 +08:00
endforeach ( )
2017-07-17 01:14:08 +08:00
macro ( pkg_depends PKG1 PKG2 )
2018-05-20 21:27:22 +08:00
if ( PKG_ ${ PKG1 } AND NOT ( PKG_ ${ PKG2 } OR BUILD_ ${ PKG2 } ) )
2017-07-17 06:18:58 +08:00
message ( FATAL_ERROR "${PKG1} package needs LAMMPS to be build with ${PKG2}" )
2017-07-17 01:14:08 +08:00
endif ( )
endmacro ( )
pkg_depends ( MPIIO MPI )
pkg_depends ( QEQ MANYBODY )
2017-07-17 06:18:58 +08:00
pkg_depends ( USER-ATC MANYBODY )
2017-07-17 07:01:28 +08:00
pkg_depends ( USER-LB MPI )
2017-07-17 07:52:43 +08:00
pkg_depends ( USER-MISC MANYBODY )
pkg_depends ( USER-PHONON KSPACE )
2018-05-20 21:54:00 +08:00
pkg_depends ( CORESHELL KSPACE )
2017-07-16 22:32:14 +08:00
2017-07-20 08:34:07 +08:00
######################################################
# packages with special compiler needs or external libs
######################################################
2018-05-11 21:51:59 +08:00
if ( PKG_REAX OR PKG_MEAM OR PKG_USER-QUIP OR PKG_USER-QMMM OR PKG_LATTE )
2017-07-17 11:31:57 +08:00
enable_language ( Fortran )
endif ( )
2018-05-20 01:07:19 +08:00
if ( PKG_MEAM OR PKG_USER-H5MD OR PKG_USER-QMMM )
2018-05-10 13:02:00 +08:00
enable_language ( C )
endif ( )
2018-05-10 13:09:23 +08:00
find_package ( OpenMP QUIET )
option ( BUILD_OMP "Build with OpenMP support" ${ OpenMP_FOUND } )
2018-05-11 21:51:59 +08:00
if ( BUILD_OMP OR PKG_USER-OMP OR PKG_KOKKOS OR PKG_USER-INTEL )
2017-07-17 11:31:57 +08:00
find_package ( OpenMP REQUIRED )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_KSPACE )
2018-05-11 02:52:04 +08:00
option ( FFT_SINGLE "Use single precision FFT instead of double" OFF )
set ( FFTW "FFTW3" )
if ( FFT_SINGLE )
set ( FFTW "FFTW3F" )
add_definitions ( -DFFT_SINGLE )
endif ( )
find_package ( ${ FFTW } QUIET )
if ( ${ FFTW } _FOUND )
2018-05-11 06:11:10 +08:00
set ( FFT "${FFTW}" CACHE STRING "FFT library for KSPACE package" )
2018-05-11 02:52:04 +08:00
else ( )
set ( FFT "KISSFFT" CACHE STRING "FFT library for KSPACE package" )
endif ( )
set_property ( CACHE FFT PROPERTY STRINGS KISSFFT ${ FFTW } MKL )
2017-07-20 08:54:15 +08:00
if ( NOT FFT STREQUAL "KISSFFT" )
find_package ( ${ FFT } REQUIRED )
2018-05-11 02:52:04 +08:00
if ( NOT FFT STREQUAL "FFTW3F" )
2018-05-12 05:27:24 +08:00
add_definitions ( -DFFT_FFTW )
2018-05-11 02:52:04 +08:00
else ( )
add_definitions ( -DFFT_ ${ FFT } )
endif ( )
2017-07-20 08:54:15 +08:00
include_directories ( ${ ${FFT } _INCLUDE_DIRS} )
list ( APPEND LAMMPS_LINK_LIBS ${ ${FFT } _LIBRARIES} )
endif ( )
2017-07-18 03:21:42 +08:00
set ( PACK_OPTIMIZATION "PACK_ARRAY" CACHE STRING "Optimization for FFT" )
2017-07-22 01:38:02 +08:00
set_property ( CACHE PACK_OPTIMIZATION PROPERTY STRINGS PACK_ARRAY PACK_POINTER PACK_MEMCPY )
2017-07-20 00:35:48 +08:00
if ( NOT PACK_OPTIMIZATION STREQUAL "PACK_ARRAY" )
add_definitions ( -D ${ PACK_OPTIMIZATION } )
endif ( )
2017-07-18 03:21:42 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE )
2017-07-17 11:43:29 +08:00
find_package ( LAPACK )
2017-08-27 15:54:40 +08:00
if ( NOT LAPACK_FOUND )
2017-07-17 11:43:29 +08:00
enable_language ( Fortran )
2018-05-19 05:17:13 +08:00
file ( GLOB LAPACK_SOURCES ${ LAMMPS_LIB_SOURCE_DIR } /linalg/*.[fF] )
2017-08-29 03:17:27 +08:00
add_library ( linalg STATIC ${ LAPACK_SOURCES } )
2017-08-27 15:54:40 +08:00
set ( LAPACK_LIBRARIES linalg )
2017-07-17 11:43:29 +08:00
endif ( )
2017-07-17 06:18:58 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_PYTHON )
2017-07-20 05:15:24 +08:00
find_package ( PythonInterp REQUIRED )
2017-07-16 22:22:19 +08:00
find_package ( PythonLibs REQUIRED )
add_definitions ( -DLMP_PYTHON )
include_directories ( ${ PYTHON_INCLUDE_DIR } )
list ( APPEND LAMMPS_LINK_LIBS ${ PYTHON_LIBRARY } )
2018-06-25 20:29:24 +08:00
if ( BUILD_LIB AND BUILD_SHARED_LIBS )
2018-01-14 05:17:23 +08:00
if ( NOT PYTHON_INSTDIR )
execute_process ( COMMAND ${ PYTHON_EXECUTABLE }
- c " i m p o r t d i s t u t i l s . s y s c o n f i g a s c g ; print ( cg.get_python_lib(1,0,prefix=' ${ CMAKE_INSTALL_PREFIX } ' ) ) "
O U T P U T _ V A R I A B L E P Y T H O N _ I N S T D I R O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
endif ( )
install ( FILES ${ CMAKE_CURRENT_SOURCE_DIR } /../python/lammps.py DESTINATION ${ PYTHON_INSTDIR } )
2017-07-20 05:15:24 +08:00
endif ( )
2017-07-16 07:29:33 +08:00
endif ( )
2018-05-10 05:54:04 +08:00
find_package ( JPEG QUIET )
2018-05-11 21:51:59 +08:00
option ( WITH_JPEG "Enable JPEG support" ${ JPEG_FOUND } )
if ( WITH_JPEG )
2018-05-10 05:54:04 +08:00
find_package ( JPEG REQUIRED )
2017-07-14 12:54:48 +08:00
add_definitions ( -DLAMMPS_JPEG )
include_directories ( ${ JPEG_INCLUDE_DIR } )
2017-07-15 04:21:21 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ JPEG_LIBRARIES } )
2017-07-14 12:54:48 +08:00
endif ( )
2018-05-10 05:54:04 +08:00
find_package ( PNG QUIET )
find_package ( ZLIB QUIET )
2017-07-15 04:44:44 +08:00
if ( PNG_FOUND AND ZLIB_FOUND )
2018-05-11 10:33:18 +08:00
option ( WITH_PNG "Enable PNG support" ON )
2018-05-10 05:54:04 +08:00
else ( )
2018-05-11 10:33:18 +08:00
option ( WITH_PNG "Enable PNG support" OFF )
2018-05-10 05:54:04 +08:00
endif ( )
2018-05-11 10:33:18 +08:00
if ( WITH_PNG )
2018-05-10 05:54:04 +08:00
find_package ( PNG REQUIRED )
find_package ( ZLIB REQUIRED )
2017-07-15 04:44:44 +08:00
include_directories ( ${ PNG_INCLUDE_DIRS } ${ ZLIB_INCLUDE_DIRS } )
list ( APPEND LAMMPS_LINK_LIBS ${ PNG_LIBRARIES } ${ ZLIB_LIBRARIES } )
2017-07-14 16:53:07 +08:00
add_definitions ( -DLAMMPS_PNG )
2017-07-15 04:44:44 +08:00
endif ( )
2017-07-14 16:53:07 +08:00
2017-07-23 03:57:15 +08:00
find_program ( GZIP_EXECUTABLE gzip )
find_package_handle_standard_args ( GZIP REQUIRED_VARS GZIP_EXECUTABLE )
2018-05-11 10:33:18 +08:00
option ( WITH_GZIP "Enable GZIP support" ${ GZIP_FOUND } )
if ( WITH_GZIP )
2018-05-10 05:54:04 +08:00
if ( NOT GZIP_FOUND )
message ( FATAL_ERROR "gzip executable not found" )
endif ( )
2017-07-15 04:49:53 +08:00
add_definitions ( -DLAMMPS_GZIP )
endif ( )
2017-07-23 03:57:15 +08:00
find_program ( FFMPEG_EXECUTABLE ffmpeg )
find_package_handle_standard_args ( FFMPEG REQUIRED_VARS FFMPEG_EXECUTABLE )
2018-05-11 10:33:18 +08:00
option ( WITH_FFMPEG "Enable FFMPEG support" ${ FFMPEG_FOUND } )
if ( WITH_FFMPEG )
2018-05-10 05:54:04 +08:00
if ( NOT FFMPEG_FOUND )
message ( FATAL_ERROR "ffmpeg executable not found" )
endif ( )
2017-07-18 04:01:05 +08:00
add_definitions ( -DLAMMPS_FFMPEG )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_VORONOI )
2018-05-11 02:31:55 +08:00
option ( DOWNLOAD_VORO "Download voro++ (instead of using the system's one)" OFF )
if ( DOWNLOAD_VORO )
include ( ExternalProject )
ExternalProject_Add ( voro_build
U R L h t t p : / / m a t h . l b l . g o v / v o r o + + / d o w n l o a d / d i r / v o r o + + - 0 . 4 . 6 . t a r . g z
U R L _ M D 5 2 3 3 8 b 8 2 4 c 3 b 7 b 2 5 5 9 0 e 1 8 e 8 d f 5 d 6 8 a f 9
C O N F I G U R E _ C O M M A N D " " B U I L D _ I N _ S O U R C E 1 I N S T A L L _ C O M M A N D " "
)
ExternalProject_get_property ( voro_build SOURCE_DIR )
set ( VORO_LIBRARIES ${ SOURCE_DIR } /src/libvoro++.a )
set ( VORO_INCLUDE_DIRS ${ SOURCE_DIR } /src )
list ( APPEND LAMMPS_DEPS voro_build )
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" )
endif ( )
endif ( )
2017-07-17 01:29:31 +08:00
include_directories ( ${ VORO_INCLUDE_DIRS } )
list ( APPEND LAMMPS_LINK_LIBS ${ VORO_LIBRARIES } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_LATTE )
2018-05-11 01:09:15 +08:00
option ( DOWNLOAD_LATTE "Download latte (instead of using the system's one)" OFF )
if ( DOWNLOAD_LATTE )
2017-09-21 02:01:26 +08:00
message ( STATUS "LATTE not found - we will build our own" )
include ( ExternalProject )
ExternalProject_Add ( latte_build
2018-04-11 07:26:16 +08:00
U R L h t t p s : / / g i t h u b . c o m / l a n l / L A T T E / a r c h i v e / v 1 . 1 . 1 . t a r . g z
U R L _ M D 5 c b 8 6 f 1 d 2 4 7 3 c e 0 0 a a 6 1 f f 6 a 0 2 3 1 5 4 b 0 3
2017-09-21 02:01:26 +08:00
S O U R C E _ S U B D I R c m a k e
C M A K E _ A R G S - D C M A K E _ I N S T A L L _ P R E F I X = < I N S T A L L _ D I R > - D C M A K E _ P O S I T I O N _ I N D E P E N D E N T _ C O D E = $ { C M A K E _ P O S I T I O N _ I N D E P E N D E N T _ C O D E }
)
ExternalProject_get_property ( latte_build INSTALL_DIR )
set ( LATTE_LIBRARIES ${ INSTALL_DIR } / ${ CMAKE_INSTALL_LIBDIR } /liblatte.a )
list ( APPEND LAMMPS_DEPS latte_build )
2018-05-11 01:09:15 +08:00
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" )
endif ( )
2017-09-21 02:01:26 +08:00
endif ( )
2018-06-09 06:14:28 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ LATTE_LIBRARIES } ${ LAPACK_LIBRARIES } )
2017-09-09 01:33:49 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-MOLFILE )
2017-08-28 02:23:30 +08:00
add_library ( molfile INTERFACE )
target_include_directories ( molfile INTERFACE ${ LAMMPS_LIB_SOURCE_DIR } /molfile )
target_link_libraries ( molfile INTERFACE ${ CMAKE_DL_LIBS } )
list ( APPEND LAMMPS_LINK_LIBS molfile )
2017-07-17 07:52:43 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-NETCDF )
2017-07-17 07:52:43 +08:00
find_package ( NetCDF REQUIRED )
include_directories ( NETCDF_INCLUDE_DIR )
list ( APPEND LAMMPS_LINK_LIBS ${ NETCDF_LIBRARY } )
add_definitions ( -DLMP_HAS_NETCDF -DNC_64BIT_DATA=0x0020 )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-SMD )
2018-05-11 01:04:56 +08:00
option ( DOWNLOAD_Eigen3 "Download Eigen3 (instead of using the system's one)" OFF )
if ( DOWNLOAD_Eigen3 )
include ( ExternalProject )
ExternalProject_Add ( Eigen3_build
U R L h t t p : / / b i t b u c k e t . o r g / e i g e n / e i g e n / g e t / 3 . 3 . 4 . t a r . g z
U R L _ M D 5 1 a 4 7 e 7 8 e f e 3 6 5 a 9 7 d e 0 c 0 2 2 d 1 2 7 6 0 7 c 3
2018-05-18 10:07:43 +08:00
C O N F I G U R E _ C O M M A N D " " B U I L D _ C O M M A N D " " I N S T A L L _ C O M M A N D " "
)
ExternalProject_get_property ( Eigen3_build SOURCE_DIR )
set ( EIGEN3_INCLUDE_DIR ${ SOURCE_DIR } )
2018-05-11 01:04:56 +08:00
list ( APPEND LAMMPS_DEPS Eigen3_build )
else ( )
2018-05-11 01:09:15 +08:00
find_package ( Eigen3 )
2018-05-11 01:04:56 +08:00
if ( NOT Eigen3_FOUND )
message ( FATAL_ERROR "Eigen3 not found, help CMake to find it by setting EIGEN3_INCLUDE_DIR, or set DOWNLOAD_Eigen3=ON to download it" )
endif ( )
endif ( )
2017-07-17 07:52:43 +08:00
include_directories ( ${ EIGEN3_INCLUDE_DIR } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-QUIP )
2017-07-17 11:31:57 +08:00
find_package ( QUIP REQUIRED )
2018-06-09 06:14:28 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ QUIP_LIBRARIES } ${ LAPACK_LIBRARIES } )
2017-07-17 11:31:57 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-QMMM )
2018-05-10 12:42:33 +08:00
message ( WARNING "Building QMMM with CMake is still experimental" )
2017-07-17 12:07:21 +08:00
find_package ( QE REQUIRED )
include_directories ( ${ QE_INCLUDE_DIRS } )
2018-06-09 06:14:28 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ QE_LIBRARIES } )
2017-07-17 12:07:21 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-VTK )
2017-07-20 08:34:07 +08:00
find_package ( VTK REQUIRED NO_MODULE )
include ( ${ VTK_USE_FILE } )
add_definitions ( -DLAMMPS_VTK )
list ( APPEND LAMMPS_LINK_LIBS ${ VTK_LIBRARIES } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_KIM )
2018-05-12 23:48:15 +08:00
option ( DOWNLOAD_KIM "Download kim-api (instead of using the system's one)" OFF )
if ( DOWNLOAD_KIM )
2018-04-07 07:22:54 +08:00
include ( ExternalProject )
ExternalProject_Add ( kim_build
2018-05-12 23:43:13 +08:00
U R L h t t p s : / / g i t h u b . c o m / o p e n k i m / k i m - a p i / a r c h i v e / v 1 . 9 . 5 . t a r . g z
U R L _ M D 5 9 f 6 6 e f c 1 2 8 d a 3 3 0 3 9 e 3 0 6 5 9 f 3 6 f c 6 d 0 0
2018-04-07 07:22:54 +08:00
B U I L D _ I N _ S O U R C E 1
C O N F I G U R E _ C O M M A N D < S O U R C E _ D I R > / c o n f i g u r e - - p r e f i x = < I N S T A L L _ D I R >
)
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 )
list ( APPEND LAMMPS_DEPS kim_build )
2018-05-12 23:48:15 +08:00
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" )
endif ( )
2018-04-07 07:22:54 +08:00
endif ( )
2017-07-20 08:34:07 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ KIM_LIBRARIES } )
include_directories ( ${ KIM_INCLUDE_DIRS } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_MSCG )
2017-07-20 08:34:07 +08:00
find_package ( GSL REQUIRED )
2018-05-18 07:23:54 +08:00
option ( DOWNLOAD_MSCG "Download latte (instead of using the system's one)" OFF )
if ( DOWNLOAD_MSCG )
include ( ExternalProject )
if ( NOT LAPACK_FOUND )
set ( EXTRA_MSCG_OPTS "-DLAPACK_LIBRARIES=${CMAKE_CURRENT_BINARY_DIR}/liblinalg.a" )
endif ( )
ExternalProject_Add ( mscg_build
2018-05-18 10:01:33 +08:00
U R L h t t p s : / / g i t h u b . c o m / u c h i c a g o - v o t h / M S C G - r e l e a s e / a r c h i v e / 1 . 7 . 3 . 1 . t a r . g z
2018-05-18 07:23:54 +08:00
U R L _ M D 5 8 c 4 5 e 2 6 9 e e 1 3 f 6 0 b 3 0 3 e d d 7 8 2 3 8 6 6 a 9 1
S O U R C E _ S U B D I R s r c / C M a k e
C M A K E _ A R G S - D C M A K E _ I N S T A L L _ P R E F I X = < I N S T A L L _ D I R > - D C M A K E _ P O S I T I O N _ I N D E P E N D E N T _ C O D E = $ { C M A K E _ P O S I T I O N _ I N D E P E N D E N T _ C O D E } $ { E X T R A _ M S C G _ O P T S }
2018-05-18 10:01:33 +08:00
B U I L D _ C O M M A N D m a k e m s c g I N S T A L L _ C O M M A N D " "
2018-05-18 07:23:54 +08:00
)
2018-05-18 10:01:33 +08:00
ExternalProject_get_property ( mscg_build BINARY_DIR )
set ( MSCG_LIBRARIES ${ BINARY_DIR } /libmscg.a )
ExternalProject_get_property ( mscg_build SOURCE_DIR )
set ( MSCG_INCLUDE_DIRS ${ SOURCE_DIR } /src )
2018-05-18 07:23:54 +08:00
list ( APPEND LAMMPS_DEPS mscg_build )
if ( NOT LAPACK_FOUND )
2018-05-19 05:06:54 +08:00
file ( MAKE_DIRECTORY ${ MSCG_INCLUDE_DIRS } )
2018-05-18 07:23:54 +08:00
add_dependencies ( mscg_build linalg )
endif ( )
else ( )
find_package ( MSCG )
if ( NOT MSCG_FOUND )
message ( FATAL_ERROR "MSCG not found, help CMake to find it by setting MSCG_LIBRARY and MSCG_INCLUDE_DIRS, or set DOWNLOAD_MSCG=ON to download it" )
2017-07-20 08:34:07 +08:00
endif ( )
endif ( )
2018-05-18 10:01:33 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ MSCG_LIBRARIES } ${ GSL_LIBRARIES } ${ LAPACK_LIBRARIES } )
2018-05-18 07:23:54 +08:00
include_directories ( ${ MSCG_INCLUDE_DIRS } )
2017-07-20 08:34:07 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_COMPRESS )
2018-05-10 12:24:22 +08:00
find_package ( ZLIB REQUIRED )
include_directories ( ${ ZLIB_INCLUDE_DIRS } )
list ( APPEND LAMMPS_LINK_LIBS ${ ZLIB_LIBRARIES } )
endif ( )
2017-07-13 05:54:44 +08:00
########################################################################
# Basic system tests (standard libraries, headers, functions, types) #
########################################################################
2018-05-10 12:16:19 +08:00
include ( CheckIncludeFileCXX )
2017-07-13 05:54:44 +08:00
foreach ( HEADER math.h )
2018-05-10 12:16:19 +08:00
check_include_file_cxx ( ${ HEADER } FOUND_ ${ HEADER } )
2017-07-13 05:54:44 +08:00
if ( NOT FOUND_ ${ HEADER } )
message ( FATAL_ERROR "Could not find needed header - ${HEADER}" )
endif ( NOT FOUND_ ${ HEADER } )
endforeach ( HEADER )
set ( MATH_LIBRARIES "m" CACHE STRING "math library" )
mark_as_advanced ( MATH_LIBRARIES )
include ( CheckLibraryExists )
2018-06-23 07:05:55 +08:00
if ( CMAKE_VERSION VERSION_LESS "3.4" )
2018-06-25 20:31:09 +08:00
enable_language ( C ) # check_library_exists isn't supported without a c compiler before v3.4
2018-06-23 07:05:55 +08:00
endif ( )
2017-07-13 05:54:44 +08:00
foreach ( FUNC sin cos )
check_library_exists ( ${ MATH_LIBRARIES } ${ FUNC } "" FOUND_ ${ FUNC } _ ${ MATH_LIBRARIES } )
if ( NOT FOUND_ ${ FUNC } _ ${ MATH_LIBRARIES } )
message ( FATAL_ERROR "Could not find needed math function - ${FUNC}" )
endif ( NOT FOUND_ ${ FUNC } _ ${ MATH_LIBRARIES } )
endforeach ( FUNC )
2017-07-15 04:21:21 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ MATH_LIBRARIES } )
2017-07-13 05:54:44 +08:00
######################################
2017-09-09 10:20:47 +08:00
# Generate Basic Style files
2017-07-13 05:54:44 +08:00
######################################
2017-07-15 06:49:05 +08:00
include ( StyleHeaderUtils )
RegisterStyles ( ${ LAMMPS_SOURCE_DIR } )
2017-07-20 08:34:07 +08:00
##############################################
# add sources of enabled packages
############################################
2018-06-28 09:02:10 +08:00
foreach ( PKG ${ DEFAULT_PACKAGES } )
2017-08-19 18:33:27 +08:00
set ( ${ PKG } _SOURCES_DIR ${ LAMMPS_SOURCE_DIR } / ${ PKG } )
# ignore PKG files which were manually installed in src folder
# headers are ignored during RegisterStyles
file ( GLOB ${ PKG } _SOURCES ${ ${PKG } _SOURCES_DIR}/*.cpp )
file ( GLOB ${ PKG } _HEADERS ${ ${PKG } _SOURCES_DIR}/*.h )
2017-07-15 06:49:05 +08:00
2017-08-19 18:33:27 +08:00
foreach ( PKG_FILE in ${ ${PKG } _SOURCES} )
get_filename_component ( FNAME ${ PKG_FILE } NAME )
2017-08-20 22:49:30 +08:00
list ( REMOVE_ITEM LIB_SOURCES ${ LAMMPS_SOURCE_DIR } / ${ FNAME } )
2017-08-19 18:33:27 +08:00
endforeach ( )
foreach ( PKG_FILE in ${ ${PKG } _HEADERS} )
get_filename_component ( FNAME ${ PKG_FILE } NAME )
DetectAndRemovePackageHeader ( ${ LAMMPS_SOURCE_DIR } / ${ FNAME } )
endforeach ( )
2017-07-15 06:49:05 +08:00
2018-05-11 21:51:59 +08:00
if ( PKG_ ${ PKG } )
2017-07-15 06:49:05 +08:00
# detects styles in package and adds them to global list
RegisterStyles ( ${ ${PKG } _SOURCES_DIR} )
2017-07-14 12:54:48 +08:00
list ( APPEND LIB_SOURCES ${ ${PKG } _SOURCES} )
2017-07-15 06:49:05 +08:00
include_directories ( ${ ${PKG } _SOURCES_DIR} )
2017-07-14 12:54:48 +08:00
endif ( )
endforeach ( )
2017-07-14 13:27:55 +08:00
2017-07-20 08:34:07 +08:00
##############################################
# add lib sources of (simple) enabled packages
############################################
2017-07-17 07:52:43 +08:00
foreach ( SIMPLE_LIB REAX MEAM POEMS USER-ATC USER-AWPMD USER-COLVARS USER-H5MD
2017-08-28 02:23:30 +08:00
U S E R - Q M M M )
2018-05-11 21:51:59 +08:00
if ( PKG_ ${ SIMPLE_LIB } )
2017-08-22 01:12:36 +08:00
string ( REGEX REPLACE "^USER-" "" PKG_LIB "${SIMPLE_LIB}" )
string ( TOLOWER "${PKG_LIB}" PKG_LIB )
file ( GLOB_RECURSE ${ PKG_LIB } _SOURCES ${ LAMMPS_LIB_SOURCE_DIR } / ${ PKG_LIB } /*.F
$ { L A M M P S _ L I B _ S O U R C E _ D I R } / $ { P K G _ L I B } / * . c $ { L A M M P S _ L I B _ S O U R C E _ D I R } / $ { P K G _ L I B } / * . c p p )
2017-08-29 03:17:27 +08:00
add_library ( ${ PKG_LIB } STATIC ${ ${PKG_LIB } _SOURCES} )
2017-08-28 02:23:30 +08:00
list ( APPEND LAMMPS_LINK_LIBS ${ PKG_LIB } )
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 )
2018-01-14 04:57:24 +08:00
elseif ( PKG_LIB STREQUAL colvars )
target_compile_options ( colvars PRIVATE -DLEPTON )
2018-01-15 01:01:19 +08:00
target_include_directories ( colvars PRIVATE ${ LAMMPS_LIB_SOURCE_DIR } /colvars/lepton/include )
target_include_directories ( colvars PUBLIC ${ LAMMPS_LIB_SOURCE_DIR } /colvars )
2017-08-28 02:23:30 +08:00
else ( )
target_include_directories ( ${ PKG_LIB } PUBLIC ${ LAMMPS_LIB_SOURCE_DIR } / ${ PKG_LIB } )
2017-08-27 15:04:32 +08:00
endif ( )
2017-07-17 01:07:36 +08:00
endif ( )
endforeach ( )
2017-07-16 22:22:19 +08:00
2018-05-11 21:51:59 +08:00
if ( PKG_USER-AWPMD )
2017-08-27 15:54:40 +08:00
target_link_libraries ( awpmd ${ LAPACK_LIBRARIES } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-ATC )
2017-08-27 15:54:40 +08:00
target_link_libraries ( atc ${ LAPACK_LIBRARIES } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-H5MD )
2017-08-22 05:04:03 +08:00
find_package ( HDF5 REQUIRED )
target_link_libraries ( h5md ${ HDF5_LIBRARIES } )
2017-08-27 15:04:32 +08:00
target_include_directories ( h5md PRIVATE ${ HDF5_INCLUDE_DIRS } )
2017-08-22 05:04:03 +08:00
endif ( )
2017-09-09 10:20:47 +08:00
2017-08-22 05:04:03 +08:00
2017-07-16 22:22:19 +08:00
######################################################################
2017-07-15 06:49:05 +08:00
# packages which selectively include variants based on enabled styles
# e.g. accelerator packages
2017-07-16 22:22:19 +08:00
######################################################################
2018-05-11 21:51:59 +08:00
if ( PKG_USER-OMP )
2017-07-17 10:19:20 +08:00
set ( USER-OMP_SOURCES_DIR ${ LAMMPS_SOURCE_DIR } /USER-OMP )
set ( USER-OMP_SOURCES ${ USER-OMP_SOURCES_DIR } /thr_data.cpp
$ { U S E R - O M P _ S O U R C E S _ D I R } / t h r _ o m p . c p p
$ { U S E R - O M P _ S O U R C E S _ D I R } / f i x _ n h _ o m p . c p p
$ { U S E R - O M P _ S O U R C E S _ D I R } / f i x _ n h _ s p h e r e _ o m p . c p p )
set_property ( GLOBAL PROPERTY "OMP_SOURCES" "${USER-OMP_SOURCES}" )
2017-07-15 11:07:53 +08:00
# detects styles which have USER-OMP version
2017-07-17 10:19:20 +08:00
RegisterStylesExt ( ${ USER-OMP_SOURCES_DIR } omp OMP_SOURCES )
2017-07-15 11:07:53 +08:00
2017-07-17 10:19:20 +08:00
get_property ( USER-OMP_SOURCES GLOBAL PROPERTY OMP_SOURCES )
2017-07-15 11:07:53 +08:00
2017-07-17 10:19:20 +08:00
list ( APPEND LIB_SOURCES ${ USER-OMP_SOURCES } )
include_directories ( ${ USER-OMP_SOURCES_DIR } )
2017-07-15 11:07:53 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_KOKKOS )
2017-07-20 08:34:07 +08:00
set ( LAMMPS_LIB_KOKKOS_SRC_DIR ${ LAMMPS_LIB_SOURCE_DIR } /kokkos )
set ( LAMMPS_LIB_KOKKOS_BIN_DIR ${ LAMMPS_LIB_BINARY_DIR } /kokkos )
add_definitions ( -DLMP_KOKKOS )
add_subdirectory ( ${ LAMMPS_LIB_KOKKOS_SRC_DIR } ${ LAMMPS_LIB_KOKKOS_BIN_DIR } )
set ( Kokkos_INCLUDE_DIRS ${ LAMMPS_LIB_KOKKOS_SRC_DIR } /core/src
$ { L A M M P S _ L I B _ K O K K O S _ S R C _ D I R } / c o n t a i n e r s / s r c
$ { L A M M P S _ L I B _ K O K K O S _ S R C _ D I R } / a l g o r i t h m s / s r c
$ { L A M M P S _ L I B _ K O K K O S _ B I N _ D I R } )
include_directories ( ${ Kokkos_INCLUDE_DIRS } )
list ( APPEND LAMMPS_LINK_LIBS kokkos )
set ( KOKKOS_PKG_SOURCES_DIR ${ LAMMPS_SOURCE_DIR } /KOKKOS )
set ( KOKKOS_PKG_SOURCES ${ KOKKOS_PKG_SOURCES_DIR } /kokkos.cpp
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / a t o m _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / a t o m _ v e c _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / c o m m _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / c o m m _ t i l e d _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / n e i g h b o r _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / n e i g h _ l i s t _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / n e i g h _ b o n d _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / f i x _ n h _ k o k k o s . c p p
2017-12-20 16:13:08 +08:00
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / n b i n _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / n p a i r _ k o k k o s . c p p
2017-07-20 08:34:07 +08:00
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / d o m a i n _ k o k k o s . c p p
$ { K O K K O S _ P K G _ S O U R C E S _ D I R } / m o d i f y _ k o k k o s . c p p )
set_property ( GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}" )
# detects styles which have KOKKOS version
RegisterStylesExt ( ${ KOKKOS_PKG_SOURCES_DIR } kokkos KOKKOS_PKG_SOURCES )
2017-12-20 16:13:08 +08:00
# register kokkos-only styles
2017-12-20 17:51:46 +08:00
RegisterNBinStyle ( ${ KOKKOS_PKG_SOURCES_DIR } /nbin_kokkos.h )
RegisterNPairStyle ( ${ KOKKOS_PKG_SOURCES_DIR } /npair_kokkos.h )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-DPD )
2017-12-20 17:51:46 +08:00
get_property ( KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES )
list ( APPEND KOKKOS_PKG_SOURCES ${ KOKKOS_PKG_SOURCES_DIR } /npair_ssa_kokkos.cpp )
RegisterNPairStyle ( ${ KOKKOS_PKG_SOURCES_DIR } /npair_ssa_kokkos.h )
set_property ( GLOBAL PROPERTY "KOKKOS_PKG_SOURCES" "${KOKKOS_PKG_SOURCES}" )
endif ( )
2017-12-20 16:13:08 +08:00
2017-07-20 08:34:07 +08:00
get_property ( KOKKOS_PKG_SOURCES GLOBAL PROPERTY KOKKOS_PKG_SOURCES )
list ( APPEND LIB_SOURCES ${ KOKKOS_PKG_SOURCES } )
include_directories ( ${ KOKKOS_PKG_SOURCES_DIR } )
2017-07-16 04:33:36 +08:00
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_OPT )
2017-07-17 08:52:38 +08:00
set ( OPT_SOURCES_DIR ${ LAMMPS_SOURCE_DIR } /OPT )
set ( OPT_SOURCES )
set_property ( GLOBAL PROPERTY "OPT_SOURCES" "${OPT_SOURCES}" )
# detects styles which have OPT version
RegisterStylesExt ( ${ OPT_SOURCES_DIR } opt OPT_SOURCES )
get_property ( OPT_SOURCES GLOBAL PROPERTY OPT_SOURCES )
list ( APPEND LIB_SOURCES ${ OPT_SOURCES } )
include_directories ( ${ OPT_SOURCES_DIR } )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_USER-INTEL )
2018-05-12 05:33:18 +08:00
if ( NOT DEVELOPER_MODE )
if ( NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
message ( FATAL_ERROR "USER-INTEL is only useful together with intel compiler" )
endif ( )
2018-05-12 07:48:31 +08:00
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}" )
2018-05-12 05:33:18 +08:00
endif ( )
2018-05-12 01:53:34 +08:00
endif ( )
2018-06-28 03:22:22 +08:00
option ( INJECT_KNL_FLAG "Inject flags for KNL build" OFF )
if ( INJECT_KNL_FLAG )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xMIC-AVX512" )
endif ( )
2018-05-12 05:33:18 +08:00
option ( INJECT_INTEL_FLAG "Inject OMG fast flags for USER-INTEL" ON )
if ( INJECT_INTEL_FLAG AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel" )
2018-05-12 07:48:31 +08:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.3 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 17.4 )
2018-05-12 05:33:18 +08:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xCOMMON-AVX512" )
else ( )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost" )
2018-05-12 05:27:24 +08:00
endif ( )
2018-05-12 05:33:18 +08:00
include ( CheckCXXCompilerFlag )
foreach ( _FLAG -qopenmp -qno-offload -fno-alias -ansi-alias -restrict -DLMP_INTEL_USELRT -DLMP_USE_MKL_RNG -O2 "-fp-model fast=2" -no-prec-div -qoverride-limits -qopt-zmm-usage=high )
check_cxx_compiler_flag ( "${__FLAG}" COMPILER_SUPPORTS ${ _FLAG } )
if ( COMPILER_SUPPORTS ${ _FLAG } )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_FLAG}" )
endif ( )
endforeach ( )
endif ( )
2017-07-17 12:52:59 +08:00
set ( USER-INTEL_SOURCES_DIR ${ LAMMPS_SOURCE_DIR } /USER-INTEL )
set ( USER-INTEL_SOURCES ${ USER-INTEL_SOURCES_DIR } /intel_preprocess.h
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / i n t e l _ b u f f e r s . h
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / i n t e l _ b u f f e r s . c p p
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / m a t h _ e x t r a _ i n t e l . h
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / n b i n _ i n t e l . h
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / n b i n _ i n t e l . c p p
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / n p a i r _ i n t e l . h
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / n p a i r _ i n t e l . c p p
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / i n t e l _ s i m d . h
$ { U S E R - I N T E L _ S O U R C E S _ D I R } / i n t e l _ i n t r i n s i c s . h )
set_property ( GLOBAL PROPERTY "USER-INTEL_SOURCES" "${USER-INTEL_SOURCES}" )
# detects styles which have USER-INTEL version
RegisterStylesExt ( ${ USER-INTEL_SOURCES_DIR } opt USER-INTEL_SOURCES )
get_property ( USER-INTEL_SOURCES GLOBAL PROPERTY USER-INTEL_SOURCES )
list ( APPEND LIB_SOURCES ${ USER-INTEL_SOURCES } )
include_directories ( ${ USER-INTEL_SOURCES_DIR } )
endif ( )
2017-07-15 06:49:05 +08:00
2018-05-11 21:51:59 +08:00
if ( PKG_GPU )
2018-06-09 06:18:02 +08:00
if ( CMAKE_VERSION VERSION_LESS "3.1" )
message ( FATAL_ERROR "For the GPU package you need at least cmake-3.1" )
endif ( )
2017-09-09 10:20:47 +08:00
set ( GPU_SOURCES_DIR ${ LAMMPS_SOURCE_DIR } /GPU )
set ( GPU_SOURCES ${ GPU_SOURCES_DIR } /gpu_extra.h
$ { G P U _ S O U R C E S _ D I R } / f i x _ g p u . h
$ { G P U _ S O U R C E S _ D I R } / f i x _ g p u . c p p )
2017-08-28 04:58:19 +08:00
2017-09-09 10:20:47 +08:00
set ( GPU_API "OpenCL" CACHE STRING "API used by GPU package" )
set_property ( CACHE GPU_API PROPERTY STRINGS OpenCL CUDA )
2017-08-29 13:04:39 +08:00
2017-09-09 10:20:47 +08:00
set ( GPU_PREC "SINGLE_DOUBLE" CACHE STRING "LAMMPS GPU precision size" )
2017-07-19 03:47:03 +08:00
set_property ( CACHE GPU_PREC PROPERTY STRINGS SINGLE_DOUBLE SINGLE_SINGLE DOUBLE_DOUBLE )
2017-07-17 13:03:11 +08:00
2017-09-09 10:20:47 +08:00
file ( GLOB GPU_LIB_SOURCES ${ LAMMPS_LIB_SOURCE_DIR } /gpu/*.cpp )
2017-07-19 06:01:35 +08:00
file ( MAKE_DIRECTORY ${ LAMMPS_LIB_BINARY_DIR } /gpu )
2017-08-29 13:04:39 +08:00
2017-09-09 10:20:47 +08:00
if ( GPU_API STREQUAL "CUDA" )
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." )
endif ( )
option ( CUDPP_OPT "Enable CUDPP_OPT" ON )
set ( GPU_ARCH "sm_30" CACHE STRING "LAMMPS GPU CUDA SM architecture" )
set_property ( CACHE GPU_ARCH PROPERTY STRINGS sm_10 sm_20 sm_30 sm_60 )
2017-09-16 06:18:13 +08:00
file ( GLOB GPU_LIB_CU ${ LAMMPS_LIB_SOURCE_DIR } /gpu/*.cu ${ CMAKE_CURRENT_SOURCE_DIR } /gpu/*.cu )
2017-09-09 10:20:47 +08:00
list ( REMOVE_ITEM GPU_LIB_CU ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_pppm.cu )
cuda_include_directories ( ${ LAMMPS_LIB_SOURCE_DIR } /gpu ${ LAMMPS_LIB_BINARY_DIR } /gpu )
if ( CUDPP_OPT )
cuda_include_directories ( ${ LAMMPS_LIB_SOURCE_DIR } /gpu/cudpp_mini )
file ( GLOB GPU_LIB_CUDPP_SOURCES ${ LAMMPS_LIB_SOURCE_DIR } /gpu/cudpp_mini/*.cpp )
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
- D U N I X - O 3 - X p t x a s - v - - u s e _ f a s t _ m a t h - D N V _ K E R N E L - D U C L _ C U D A D R - a r c h = $ { G P U _ A R C H } - D _ $ { G P U _ P R E C } )
cuda_compile ( GPU_OBJS ${ GPU_LIB_CUDPP_CU } OPTIONS $< $<BOOL:${BUILD_SHARED_LIBS} > :-Xcompiler=-fPIC>
- D U N I X - O 3 - X p t x a s - v - - u s e _ f a s t _ m a t h - D U C L _ C U D A D R - a r c h = $ { G P U _ A R C H } - D _ $ { G P U _ P R E C } )
foreach ( CU_OBJ ${ GPU_GEN_OBJS } )
get_filename_component ( CU_NAME ${ CU_OBJ } NAME_WE )
string ( REGEX REPLACE "^.*_lal_" "" CU_NAME "${CU_NAME}" )
add_custom_command ( OUTPUT ${ LAMMPS_LIB_BINARY_DIR } /gpu/ ${ CU_NAME } _cubin.h
C O M M A N D $ { B I N 2 C } - c - n $ { C U _ N A M E } $ { C U _ O B J } > $ { L A M M P S _ L I B _ B I N A R Y _ D I R } / g p u / $ { C U _ N A M E } _ c u b i n . h
D E P E N D S $ { C U _ O B J }
C O M M E N T " G e n e r a t i n g $ { C U _ N A M E } _ c u b i n . h " )
list ( APPEND GPU_LIB_SOURCES ${ LAMMPS_LIB_BINARY_DIR } /gpu/ ${ CU_NAME } _cubin.h )
endforeach ( )
set_directory_properties ( PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${LAMMPS_LIB_BINARY_DIR}/gpu/*_cubin.h" )
add_library ( gpu STATIC ${ GPU_LIB_SOURCES } ${ GPU_LIB_CUDPP_SOURCES } ${ GPU_OBJS } )
target_link_libraries ( gpu ${ CUDA_LIBRARIES } ${ CUDA_CUDA_LIBRARY } )
target_include_directories ( gpu PRIVATE ${ LAMMPS_LIB_BINARY_DIR } /gpu ${ CUDA_INCLUDE_DIRS } )
target_compile_definitions ( gpu PRIVATE -D_ ${ GPU_PREC } -DMPI_GERYON -DUCL_NO_EXIT )
if ( CUDPP_OPT )
target_include_directories ( gpu PRIVATE ${ LAMMPS_LIB_SOURCE_DIR } /gpu/cudpp_mini )
target_compile_definitions ( gpu PRIVATE -DUSE_CUDPP )
endif ( )
list ( APPEND LAMMPS_LINK_LIBS gpu )
add_executable ( nvc_get_devices ${ LAMMPS_LIB_SOURCE_DIR } /gpu/geryon/ucl_get_devices.cpp )
target_compile_definitions ( nvc_get_devices PRIVATE -DUCL_CUDADR )
target_link_libraries ( nvc_get_devices PRIVATE ${ CUDA_LIBRARIES } ${ CUDA_CUDA_LIBRARY } )
target_include_directories ( nvc_get_devices PRIVATE ${ CUDA_INCLUDE_DIRS } )
elseif ( GPU_API STREQUAL "OpenCL" )
find_package ( OpenCL REQUIRED )
2017-09-09 20:51:24 +08:00
set ( OCL_TUNE "GENERIC" CACHE STRING "OpenCL Device Tuning" )
set_property ( CACHE OCL_TUNE PROPERTY STRINGS INTEL FERMI KEPLER CYPRESS GENERIC )
include ( OpenCLUtils )
set ( OCL_COMMON_HEADERS ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_preprocessor.h ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_aux_fun1.h )
file ( GLOB GPU_LIB_CU ${ LAMMPS_LIB_SOURCE_DIR } /gpu/*.cu )
list ( REMOVE_ITEM GPU_LIB_CU ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_gayberne.cu ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_gayberne_lj.cu )
foreach ( GPU_KERNEL ${ GPU_LIB_CU } )
get_filename_component ( basename ${ GPU_KERNEL } NAME_WE )
string ( SUBSTRING ${ basename } 4 -1 KERNEL_NAME )
GenerateOpenCLHeader ( ${ KERNEL_NAME } ${ CMAKE_CURRENT_BINARY_DIR } /gpu/ ${ KERNEL_NAME } _cl.h ${ OCL_COMMON_HEADERS } ${ GPU_KERNEL } )
list ( APPEND GPU_LIB_SOURCES ${ CMAKE_CURRENT_BINARY_DIR } /gpu/ ${ KERNEL_NAME } _cl.h )
endforeach ( )
GenerateOpenCLHeader ( gayberne ${ CMAKE_CURRENT_BINARY_DIR } /gpu/gayberne_cl.h ${ OCL_COMMON_HEADERS } ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_ellipsoid_extra.h ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_gayberne.cu )
GenerateOpenCLHeader ( gayberne_lj ${ CMAKE_CURRENT_BINARY_DIR } /gpu/gayberne_lj_cl.h ${ OCL_COMMON_HEADERS } ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_ellipsoid_extra.h ${ LAMMPS_LIB_SOURCE_DIR } /gpu/lal_gayberne_lj.cu )
list ( APPEND GPU_LIB_SOURCES ${ CMAKE_CURRENT_BINARY_DIR } /gpu/gayberne_cl.h ${ CMAKE_CURRENT_BINARY_DIR } /gpu/gayberne_lj_cl.h )
add_library ( gpu STATIC ${ GPU_LIB_SOURCES } )
target_link_libraries ( gpu ${ OpenCL_LIBRARIES } )
target_include_directories ( gpu PRIVATE ${ CMAKE_CURRENT_BINARY_DIR } /gpu ${ OpenCL_INCLUDE_DIRS } )
2018-05-23 08:21:58 +08:00
target_compile_definitions ( gpu PRIVATE -D_ ${ GPU_PREC } -D ${ OCL_TUNE } _OCL -DMPI_GERYON -DUCL_NO_EXIT )
2017-09-09 20:51:24 +08:00
target_compile_definitions ( gpu PRIVATE -DUSE_OPENCL )
list ( APPEND LAMMPS_LINK_LIBS gpu )
add_executable ( ocl_get_devices ${ LAMMPS_LIB_SOURCE_DIR } /gpu/geryon/ucl_get_devices.cpp )
target_compile_definitions ( ocl_get_devices PRIVATE -DUCL_OPENCL )
target_link_libraries ( ocl_get_devices PRIVATE ${ OpenCL_LIBRARIES } )
target_include_directories ( ocl_get_devices PRIVATE ${ OpenCL_INCLUDE_DIRS } )
2017-09-09 10:20:47 +08:00
endif ( )
2017-08-28 04:58:19 +08:00
# GPU package
2017-08-29 13:04:39 +08:00
FindStyleHeaders ( ${ GPU_SOURCES_DIR } FIX_CLASS fix_ FIX )
2017-07-17 13:03:11 +08:00
set_property ( GLOBAL PROPERTY "GPU_SOURCES" "${GPU_SOURCES}" )
# detects styles which have GPU version
2017-08-29 13:04:39 +08:00
RegisterStylesExt ( ${ GPU_SOURCES_DIR } gpu GPU_SOURCES )
2017-07-17 13:03:11 +08:00
get_property ( GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES )
2017-08-28 04:58:19 +08:00
list ( APPEND LIB_SOURCES ${ GPU_SOURCES } )
2017-08-29 13:04:39 +08:00
include_directories ( ${ GPU_SOURCES_DIR } )
2017-07-17 13:03:11 +08:00
endif ( )
2017-07-15 06:49:05 +08:00
######################################################
# Generate style headers based on global list of
2017-09-09 10:20:47 +08:00
# styles registered during package selection
2017-07-15 06:49:05 +08:00
######################################################
set ( LAMMPS_STYLE_HEADERS_DIR ${ CMAKE_CURRENT_BINARY_DIR } /styles )
GenerateStyleHeaders ( ${ LAMMPS_STYLE_HEADERS_DIR } )
2017-07-14 17:00:38 +08:00
include_directories ( ${ LAMMPS_SOURCE_DIR } )
2017-07-15 06:49:05 +08:00
include_directories ( ${ LAMMPS_STYLE_HEADERS_DIR } )
2017-07-20 08:34:07 +08:00
###########################################
# Actually add executable and lib to build
############################################
2018-06-19 06:11:31 +08:00
get_property ( LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES )
list ( FIND LANGUAGES "Fortran" _index )
if ( ${ _index } GREATER -1 )
list ( APPEND LAMMPS_LINK_LIBS ${ CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES } )
endif ( )
2018-05-10 12:24:22 +08:00
list ( REMOVE_DUPLICATES LAMMPS_LINK_LIBS )
2018-06-23 01:06:12 +08:00
if ( BUILD_LIB )
add_library ( lammps ${ LIB_SOURCES } )
target_link_libraries ( lammps ${ LAMMPS_LINK_LIBS } )
if ( LAMMPS_DEPS )
add_dependencies ( lammps ${ LAMMPS_DEPS } )
endif ( )
set_target_properties ( lammps PROPERTIES OUTPUT_NAME lammps ${ LIB_SUFFIX } )
if ( BUILD_SHARED_LIBS )
set_target_properties ( lammps PROPERTIES SOVERSION ${ SOVERSION } )
install ( TARGETS lammps LIBRARY DESTINATION ${ CMAKE_INSTALL_LIBDIR } ARCHIVE DESTINATION ${ CMAKE_INSTALL_LIBDIR } )
install ( FILES ${ LAMMPS_SOURCE_DIR } /library.h DESTINATION ${ CMAKE_INSTALL_INCLUDEDIR } /lammps )
configure_file ( pkgconfig/liblammps.pc.in ${ CMAKE_CURRENT_BINARY_DIR } /liblammps ${ LIB_SUFFIX } .pc @ONLY )
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /liblammps ${ LIB_SUFFIX } .pc DESTINATION ${ CMAKE_INSTALL_LIBDIR } /pkgconfig )
endif ( )
else ( )
list ( APPEND LMP_SOURCES ${ LIB_SOURCES } )
2017-07-15 08:33:27 +08:00
endif ( )
2017-07-13 05:54:44 +08:00
2018-06-23 01:11:09 +08:00
if ( BUILD_EXE )
add_executable ( lmp ${ LMP_SOURCES } )
if ( BUILD_LIB )
target_link_libraries ( lmp lammps )
else ( )
target_link_libraries ( lmp ${ LAMMPS_LINK_LIBS } )
if ( LAMMPS_DEPS )
add_dependencies ( lmp ${ LAMMPS_DEPS } )
endif ( )
2018-06-23 01:06:12 +08:00
endif ( )
2018-06-23 01:11:09 +08:00
set_target_properties ( lmp PROPERTIES OUTPUT_NAME lmp ${ LAMMPS_MACHINE } )
install ( TARGETS lmp DESTINATION ${ CMAKE_INSTALL_BINDIR } )
if ( ENABLE_TESTING )
add_test ( ShowHelp lmp ${ LAMMPS_MACHINE } -help )
endif ( )
2017-07-21 06:14:02 +08:00
endif ( )
2017-07-15 07:41:13 +08:00
2018-06-12 04:29:38 +08:00
###############################################################################
# Testing
#
# Requires latest gcovr (for GCC 8.1 support):#
# pip install git+https://github.com/gcovr/gcovr.git
###############################################################################
if ( ENABLE_COVERAGE )
2018-06-16 12:40:10 +08:00
find_program ( GCOVR_BINARY gcovr )
find_package_handle_standard_args ( GCOVR DEFAULT_MSG GCOVR_BINARY )
2018-06-12 04:29:38 +08:00
if ( GCOVR_FOUND )
get_filename_component ( ABSOLUTE_LAMMPS_SOURCE_DIR ${ LAMMPS_SOURCE_DIR } ABSOLUTE )
add_custom_target (
g e n _ c o v e r a g e _ x m l
C O M M A N D $ { G C O V R _ B I N A R Y } - s - x - r $ { A B S O L U T E _ L A M M P S _ S O U R C E _ D I R } - - o b j e c t - d i r e c t o r y = $ { C M A K E _ B I N A R Y _ D I R } - o c o v e r a g e . x m l
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R }
C O M M E N T " G e n e r a t i n g X M L C o v e r a g e R e p o r t . . . "
)
add_custom_target (
g e n _ c o v e r a g e _ h t m l
C O M M A N D $ { G C O V R _ B I N A R Y } - s - - h t m l - - h t m l - d e t a i l s - r $ { A B S O L U T E _ L A M M P S _ S O U R C E _ D I R } - - o b j e c t - d i r e c t o r y = $ { C M A K E _ B I N A R Y _ D I R } - o c o v e r a g e . h t m l
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ B I N A R Y _ D I R }
C O M M E N T " G e n e r a t i n g H T M L C o v e r a g e R e p o r t . . . "
)
endif ( )
endif ( )
###############################################################################
2017-07-20 08:34:07 +08:00
# Print package summary
2018-06-12 04:29:38 +08:00
###############################################################################
2018-06-28 09:02:10 +08:00
foreach ( PKG ${ DEFAULT_PACKAGES } ${ ACCEL_PACKAGES } )
2018-05-11 21:51:59 +08:00
if ( PKG_ ${ PKG } )
2017-07-15 07:41:13 +08:00
message ( STATUS "Building package: ${PKG}" )
endif ( )
endforeach ( )
2017-08-20 23:17:49 +08:00
string ( TOUPPER "${CMAKE_BUILD_TYPE}" BTYPE )
2018-05-10 05:19:52 +08:00
get_directory_property ( CPPFLAGS DIRECTORY ${ CMAKE_SOURCE_DIR } COMPILE_DEFINITIONS )
include ( FeatureSummary )
2018-06-23 01:43:52 +08:00
feature_summary ( DEFAULT_DESCRIPTION WHAT PACKAGES_FOUND )
2017-08-20 23:17:49 +08:00
message ( STATUS " <<< Build configuration >>>
B u i l d t y p e $ { C M A K E _ B U I L D _ T Y P E }
I n s t a l l p a t h $ { C M A K E _ I N S T A L L _ P R E F I X }
C o m p i l e r s a n d F l a g s :
C + + C o m p i l e r $ { C M A K E _ C X X _ C O M P I L E R }
T y p e $ { C M A K E _ C X X _ C O M P I L E R _ I D }
2018-05-10 05:19:52 +08:00
V e r s i o n $ { C M A K E _ C X X _ C O M P I L E R _ V E R S I O N }
C + + F l a g s $ { C M A K E _ C X X _ F L A G S } $ { C M A K E _ C X X _ F L A G S _ $ { B T Y P E } }
2018-05-11 04:30:45 +08:00
D e f i n e s $ { C P P F L A G S } " )
2017-08-20 23:17:49 +08:00
get_property ( LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES )
2018-05-11 04:30:45 +08:00
list ( FIND LANGUAGES "Fortran" _index )
if ( ${ _index } GREATER -1 )
2017-08-20 23:17:49 +08:00
message ( STATUS " Fortran Compiler ${ CMAKE_Fortran_COMPILER }
T y p e $ { C M A K E _ F o r t r a n _ C O M P I L E R _ I D }
2018-05-11 04:30:45 +08:00
V e r s i o n $ { C M A K E _ F o r t r a n _ C O M P I L E R _ V E R S I O N }
2017-08-20 23:17:49 +08:00
F o r t r a n F l a g s $ { C M A K E _ F o r t r a n _ F L A G S } $ { C M A K E _ F o r t r a n _ F L A G S _ $ { B T Y P E } } " )
endif ( )
2018-05-11 04:30:45 +08:00
list ( FIND LANGUAGES "C" _index )
if ( ${ _index } GREATER -1 )
message ( STATUS " C Compiler ${ CMAKE_C_COMPILER }
T y p e $ { C M A K E _ C _ C O M P I L E R _ I D }
V e r s i o n $ { C M A K E _ C _ C O M P I L E R _ V E R S I O N }
C F l a g s $ { C M A K E _ C _ F L A G S } $ { C M A K E _ C _ F L A G S _ $ { B T Y P E } } " )
endif ( )
if ( CMAKE_EXE_LINKER_FLAGS )
message ( STATUS " Linker flags:
2017-08-20 23:17:49 +08:00
E x e c u t a b l e $ { C M A K E _ E X E _ L I N K E R _ F L A G S } " )
2018-05-11 04:30:45 +08:00
endif ( )
2017-08-20 23:17:49 +08:00
if ( BUILD_SHARED_LIBS )
2018-05-10 05:19:52 +08:00
message ( STATUS "Shared libraries ${CMAKE_SHARED_LINKER_FLAGS}" )
2017-08-20 23:17:49 +08:00
else ( )
2018-05-10 05:19:52 +08:00
message ( STATUS "Static libraries ${CMAKE_STATIC_LINKER_FLAGS}" )
2017-08-20 23:17:49 +08:00
endif ( )
message ( STATUS "Link libraries: ${LAMMPS_LINK_LIBS}" )
2018-05-10 13:12:00 +08:00
if ( BUILD_MPI )
2018-05-11 09:20:06 +08:00
message ( STATUS "Using mpi with headers in ${MPI_CXX_INCLUDE_PATH} and ${MPI_CXX_LIBRARIES}" )
2018-05-10 05:19:52 +08:00
endif ( )
2018-06-28 03:23:35 +08:00
if ( PKG_GPU )
2018-05-11 02:36:09 +08:00
message ( STATUS "GPU Api: ${GPU_API}" )
if ( GPU_API STREQUAL "CUDA" )
message ( STATUS "GPU Arch: ${GPU_ARCH}" )
elseif ( GPU_API STREQUAL "OpenCL" )
message ( STATUS "OCL Tune: ${OCL_TUNE}" )
endif ( )
2018-06-22 23:02:10 +08:00
message ( STATUS "GPU Precision: ${GPU_PREC}" )
2018-05-11 02:36:09 +08:00
endif ( )
2018-06-28 03:25:56 +08:00
if ( PKG_KOKKOS )
message ( STATUS "Kokkos Arch: ${KOKKOS_ARCH}" )
endif ( )
2018-05-11 21:51:59 +08:00
if ( PKG_KSPACE )
2018-05-12 05:27:24 +08:00
message ( STATUS "Using ${FFT} as FFT" )
2018-05-11 06:11:10 +08:00
endif ( )