forked from lijiext/lammps
fix liblammps install
This commit is contained in:
parent
62928a1637
commit
9207f6540e
|
@ -49,6 +49,7 @@ endif()
|
|||
include(GNUInstallDirs)
|
||||
|
||||
set(LAMMPS_LINK_LIBS)
|
||||
set(LAMMPS_API_DEFINES)
|
||||
option(ENABLE_MPI "Build MPI version" OFF)
|
||||
if(ENABLE_MPI)
|
||||
find_package(MPI REQUIRED)
|
||||
|
@ -69,6 +70,7 @@ endif()
|
|||
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})
|
||||
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES} -D${LAMMPS_SIZE_LIMIT}")
|
||||
|
||||
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})
|
||||
|
@ -76,6 +78,7 @@ add_definitions(-DLAMMPS_MEMALIGN=${LAMMPS_MEMALIGN})
|
|||
option(LAMMPS_EXCEPTIONS "enable the use of C++ exceptions for error messages (useful for library interface)" OFF)
|
||||
if(LAMMPS_EXCEPTIONS)
|
||||
add_definitions(-DLAMMPS_EXCEPTIONS)
|
||||
set(LAMMPS_API_DEFINES "${LAMMPS_API_DEFINES -DLAMMPS_EXCEPTIONS")
|
||||
endif()
|
||||
|
||||
option(CMAKE_VERBOSE_MAKEFILE "Verbose makefile" OFF)
|
||||
|
@ -578,7 +581,9 @@ target_link_libraries(lammps ${LAMMPS_LINK_LIBS})
|
|||
set_target_properties(lammps PROPERTIES SOVERSION ${SOVERSION})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
install(TARGETS lammps LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(FILES ${LAMMPS_SOURCE_DIR}/lammps.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(FILES ${LAMMPS_SOURCE_DIR}/library.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/lammps)
|
||||
configure_file(pkgconfig/liblammps.pc.in ${CMAKE_CURRENT_BINARY_DIR}/liblammps.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liblammps.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
|
||||
add_executable(lmp ${LMP_SOURCES})
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# pkg-config file for lammps
|
||||
# https://people.freedesktop.org/~dbn/pkg-config-guide.html
|
||||
# Usage: cc `pkg-config --cflags --libs liblammps` -o myapp myapp.c
|
||||
# after you added @CMAKE_INSTALL_FULL_LIBDIR@/pkg-config to PKG_CONFIG_PATH,
|
||||
# e.g. export PKG_CONFIG_PATH=@CMAKE_INSTALL_FULL_LIBDIR@/pkgconfig
|
||||
|
||||
prefix=@CMAKE_INSTALL_FULL_PREFIX@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
|
||||
Name: liblammps
|
||||
Description: Large-scale Atomic/Molecular Massively Parallel Simulator Library
|
||||
URL: http://lammps.sandia.gov
|
||||
Version:
|
||||
Requires:
|
||||
Libs: -L${libdir} -llammps
|
||||
Libs.private: -lm
|
||||
Cflags: -I${includedir} @LAMMPS_API_DEFINES@
|
Loading…
Reference in New Issue