From fce633aa5f4de7b55801a55578c907579d254bca Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Fri, 8 Sep 2017 11:33:49 -0600 Subject: [PATCH] cmake: tweaks for EXAALT superbuild, add latte_fix --- cmake/CMakeLists.txt | 17 +++++++++++------ cmake/Modules/FindLATTE.cmake | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 cmake/Modules/FindLATTE.cmake diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 76c28fcb72..2dabfb788d 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -6,8 +6,8 @@ cmake_minimum_required(VERSION 3.1) project(lammps) set(SOVERSION 0) -set(LAMMPS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../src) -set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_SOURCE_DIR}/../lib) +set(LAMMPS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src) +set(LAMMPS_LIB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib) set(LAMMPS_LIB_BINARY_DIR ${CMAKE_BINARY_DIR}/lib) #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}) # 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) #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 KSPACE MANYBODY MC MEAM MISC MOLECULE PERI QEQ 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-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 @@ -182,7 +182,7 @@ if(ENABLE_PYTHON) -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) 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) message(FATAL_ERROR "Python package need lammps to be build shared, use -DBUILD_SHARED_LIBS=ON") endif() @@ -221,6 +221,11 @@ if(ENABLE_VORONOI) list(APPEND LAMMPS_LINK_LIBS ${VORO_LIBRARIES}) endif() +if(ENABLE_LATTE) + find_package(LATTE REQUIRED) + list(APPEND LAMMPS_LINK_LIBS ${LATTE_LIBRARIES}) +endif() + if(ENABLE_USER-MOLFILE) list(APPEND LAMMPS_LINK_LIBS ${CMAKE_DL_LIBS}) endif() @@ -477,7 +482,7 @@ if(ENABLE_GPU) get_property(GPU_SOURCES GLOBAL PROPERTY GPU_SOURCES) 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) 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) diff --git a/cmake/Modules/FindLATTE.cmake b/cmake/Modules/FindLATTE.cmake new file mode 100644 index 0000000000..686c67940f --- /dev/null +++ b/cmake/Modules/FindLATTE.cmake @@ -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)