cmake: tweaks for EXAALT superbuild, add latte_fix

This commit is contained in:
Christoph Junghans 2017-09-08 11:33:49 -06:00
parent 2f6be88c4a
commit fce633aa5f
2 changed files with 29 additions and 6 deletions

View File

@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.1)
project(lammps) project(lammps)
set(SOVERSION 0) set(SOVERSION 0)
set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) set(LAMMPS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src)
set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib) set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib)
#To not conflict with old Makefile build system, we build everything here #To not conflict with old Makefile build system, we build everything here
@ -16,7 +16,7 @@ file(GLOB LMP_SOURCES ${LAMMPS_SOURCE_DIR}/main.cpp)
list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES}) list(REMOVE_ITEM LIB_SOURCES ${LMP_SOURCES})
# Cmake modules/macros are in a subdirectory to keep this file cleaner # Cmake modules/macros are in a subdirectory to keep this file cleaner
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Modules) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Modules)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS)
#release comes with -O3 by default #release comes with -O3 by default
@ -85,7 +85,7 @@ option(ENABLE_ALL "Build all default packages" OFF)
set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR set(DEFAULT_PACKAGES ASPHERE BODY CLASS2 COLLOID COMPRESS CORESHELL DIPOLE GRANULAR
KSPACE MANYBODY MC MEAM MISC MOLECULE PERI QEQ KSPACE MANYBODY MC MEAM MISC MOLECULE PERI QEQ
REAX REPLICA RIGID SHOCK SNAP SRD) REAX REPLICA RIGID SHOCK SNAP SRD)
set(OTHER_PACKAGES KIM PYTHON MSCG MPIIO VORONOI POEMS set(OTHER_PACKAGES KIM PYTHON MSCG MPIIO VORONOI POEMS LATTE
USER-ATC USER-AWPMD USER-CGDNA USER-ATC USER-AWPMD USER-CGDNA
USER-CGSDK USER-COLVARS USER-DIFFRACTION USER-DPD USER-DRUDE USER-EFF 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-FEP USER-H5MD USER-LB USER-MANIFOLD USER-MEAMC USER-MGPT USER-MISC
@ -182,7 +182,7 @@ if(ENABLE_PYTHON)
-c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))" -c "import distutils.sysconfig as cg; print(cg.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))"
OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_VARIABLE PYTHON_INSTDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
endif() endif()
install(FILES ${CMAKE_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR}) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../python/lammps.py DESTINATION ${PYTHON_INSTDIR})
if(NOT BUILD_SHARED_LIBS) if(NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON") message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON")
endif() endif()
@ -221,6 +221,11 @@ if(ENABLE_VORONOI)
list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES}) list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES})
endif() endif()
if(ENABLE_LATTE)
find_package(LATTE REQUIRED)
list(APPEND LAMMPS_LINK_LIBS ${LATTE_LIBRARIES})
endif()
if(ENABLE_USER-MOLFILE) if(ENABLE_USER-MOLFILE)
list(APPEND LAMMPS_LINK_LIBS ${CMAKE_DL_LIBS}) list(APPEND LAMMPS_LINK_LIBS ${CMAKE_DL_LIBS})
endif() endif()
@ -477,7 +482,7 @@ if(ENABLE_GPU)
get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES)
file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp) file(GLOB GPU_LIB_SOURCES ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cpp)
file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_SOURCE_DIR}/gpu/*.cu) file(GLOB GPU_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/*.cu ${CMAKE_CURRENT_SOURCE_DIR}/gpu/*.cu)
file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu) file(GLOB_RECURSE GPU_NOT_LIB_CU ${LAMMPS_LIB_SOURCE_DIR}/gpu/lal_pppm.cu)
list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU}) list(REMOVE_ITEM GPU_LIB_CU ${GPU_NOT_LIB_CU})
include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu) include_directories(${GPU_SOURCES_DIR} ${LAMMPS_LIB_SOURCE_DIR}/gpu ${LAMMPS_LIB_BINARY_DIR}/gpu)

View File

@ -0,0 +1,18 @@
# - Find latte
# Find the native LATTE libraries.
#
# LATTE_LIBRARIES - List of libraries when using fftw3.
# LATTE_FOUND - True if fftw3 found.
#
find_library(LATTE_LIBRARY NAMES latte)
set(LATTE_LIBRARIES ${LATTE_LIBRARY})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LATTE_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(LATTE DEFAULT_MSG LATTE_LIBRARY)
mark_as_advanced(LATTE_LIBRARY)