From 9207f6540e848212d6fe2512edc3a52880cbcbc3 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Mon, 28 Aug 2017 14:11:21 -0600 Subject: [PATCH] fix liblammps install --- cmake/CMakeLists.txt | 7 ++++++- cmake/pkgconfig/liblammps.pc.in | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 cmake/pkgconfig/liblammps.pc.in diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4296a040c8..d143f5bc2f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -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}) diff --git a/cmake/pkgconfig/liblammps.pc.in b/cmake/pkgconfig/liblammps.pc.in new file mode 100644 index 0000000000..643b4ba501 --- /dev/null +++ b/cmake/pkgconfig/liblammps.pc.in @@ -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@