Unverified Commit 191044ab authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1588 from akohlmey/cmake-installation-folder-bugfix

Fix bugs with CMake potentials and frc folder installation. Include base C++ headers for library install, too, so one can use the C++ interface as well.
parents 35cee904 e0b20c4f
Loading
Loading
Loading
Loading
+39 −5
Original line number Diff line number Diff line
@@ -497,10 +497,44 @@ if(BUILD_LIB)
  if(LAMMPS_DEPS)
    add_dependencies(lammps ${LAMMPS_DEPS})
  endif()
  set(LAMMPS_CXX_HEADERS
    angle.h
    atom.h
    bond.h
    citeme.h
    comm.h
    compute.h
    dihedral.h
    domain.h
    error.h
    fix.h
    force.h
    group.h
    improper.h
    input.h
    kspace.h
    lammps.h
    lattice.h
    lmppython.h
    memory.h
    modify.h
    neighbor.h
    neigh_list.h
    output.h
    pair.h
    pointers.h
    region.h
    timer.h
    universe.h
    update.h
    variable.h)
  list(TRANSFORM LAMMPS_CXX_HEADERS PREPEND ${LAMMPS_SOURCE_DIR}/)

  set_target_properties(lammps PROPERTIES OUTPUT_NAME lammps${LAMMPS_LIB_SUFFIX})
  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)
  install(FILES ${LAMMPS_CXX_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
  configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_LIB_SUFFIX}.pc @ONLY)
  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps${LAMMPS_LIB_SUFFIX}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
  configure_file(FindLAMMPS.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindLAMMPS${LAMMPS_LIB_SUFFIX}.cmake @ONLY)
@@ -551,11 +585,11 @@ include(Documentation)
###############################################################################
# Install potential and force field files in data directory
###############################################################################
set(LAMMPS_INSTALL_POTENTIALS_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/potentials)
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_POTENTIALS_DIR})

set(LAMMPS_INSTALL_FRC_FILES_DIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps/frc_files)
install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files/ DESTINATION ${LAMMPS_INSTALL_FRC_FILES_DIR})
set(LAMMPS_INSTALL_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}/lammps)
install(DIRECTORY ${LAMMPS_POTENTIALS_DIR} DESTINATION ${LAMMPS_INSTALL_DATADIR})
if(BUILD_TOOLS)
  install(DIRECTORY ${LAMMPS_TOOLS_DIR}/msi2lmp/frc_files DESTINATION ${LAMMPS_INSTALL_DATADIR})
endif()

configure_file(etc/profile.d/lammps.sh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.sh @ONLY)
configure_file(etc/profile.d/lammps.csh.in ${CMAKE_BINARY_DIR}/etc/profile.d/lammps.csh @ONLY)
+2 −2
Original line number Diff line number Diff line
# set environment for LAMMPS and msi2lmp executables
# to find potential and force field files
if ( "$?LAMMPS_POTENTIALS" == 0 ) setenv LAMMPS_POTENTIALS @LAMMPS_POTENTIALS_DIR@
if ( "$?MSI2LMP_LIBRARY" == 0 ) setenv MSI2LMP_LIBRARY @LAMMPS_FRC_FILES_DIR@
if ( "$?LAMMPS_POTENTIALS" == 0 ) setenv LAMMPS_POTENTIALS @LAMMPS_INSTALL_DATADIR@/potentials
if ( "$?MSI2LMP_LIBRARY" == 0 ) setenv MSI2LMP_LIBRARY @LAMMPS_INSTALL_DATADIR@/frc_files
+2 −2
Original line number Diff line number Diff line
# set environment for LAMMPS and msi2lmp executables
# to find potential and force field files
LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS-@LAMMPS_POTENTIALS_DIR@}
MSI2LMP_LIBRARY=${MSI2LMP_LIBRARY-@LAMMPS_FRC_FILES_DIR@}
LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS-@LAMMPS_INSTALL_DATADIR@/potentials}
MSI2LMP_LIBRARY=${MSI2LMP_LIBRARY-@LAMMPS_INSTALL_DATADIR@/frc_files}
export LAMMPS_POTENTIALS MSI2LMP_LIBRARY
+8 −2
Original line number Diff line number Diff line
@@ -52,11 +52,17 @@ LAMMPS or need to re-compile LAMMPS repeatedly, installation of the
ccache (= Compiler Cache) software may speed up repeated compilation
even more.

After compilation, you can optionally copy the LAMMPS executable and
library into your system folders (by default under $HOME/.local) with:
After compilation, you may optionally install the LAMMPS executable into
your system with:

make install    # optional, copy LAMMPS executable & library elsewhere :pre

This will install the lammps executable and library (if requested), some
tools (if configured) and additional files like library API headers,
manpages, potential and force field files. The location of the installation
tree is set by the CMake variable "CMAKE_INSTALL_PREFIX" which defaults
to $\{HOME\}/.local

:line

There are 3 variants of CMake: a command-line version (cmake), a text mode
+1 −0
Original line number Diff line number Diff line
@@ -1539,6 +1539,7 @@ Mandelli
Manh
manifoldforce
Manolopoulos
manpages
manybody
MANYBODY
Maras