From d494752788453a47de409cd84715a324f14fbd1e Mon Sep 17 00:00:00 2001 From: Erik Lindahl Date: Fri, 11 May 2018 16:06:59 +0200 Subject: [PATCH] Use default CMake path variables Remove our homegrown path variables for binaries, libraries, manpages and data in favor of the ones documented as part of CMake. The 'gromacs' part of the data directory has been moved to a separate GMX_INSTALL_DATASUBDIR variable. This enables Gromacs-2018 docker builds with multiple different accelerations installed with different binary/library subdirectories. Change-Id: I1618428c94ea2cfb90dc1ff5261b26a9307c1a94 --- CMakeLists.txt | 42 ++++++++----------- admin/copyright.py | 2 +- docs/CMakeLists.txt | 2 +- docs/dev-manual/build-system.rst | 11 ++--- docs/dev-manual/relocatable-binaries.rst | 8 ++-- docs/install-guide/index.rst | 11 +++-- scripts/CMakeLists.txt | 14 +++---- scripts/GMXRC.bash.cmakein | 8 ++-- scripts/GMXRC.cmakein | 4 +- scripts/GMXRC.csh.cmakein | 8 ++-- scripts/GMXRC.zsh.cmakein | 2 +- share/CMakeLists.txt | 6 +-- share/template/CMakeLists.txt | 8 ++-- src/buildinfo.h.cmakein | 6 +-- src/config.h.cmakein | 2 +- src/gromacs/CMakeLists.txt | 12 +++--- src/gromacs/InstallLibInfo.cmake | 12 +++--- .../commandline/cmdlineprogramcontext.cpp | 4 +- src/gromacs/gpu_utils/ocl_compiler.cpp | 2 +- src/gromacs/libgromacs.pc.cmakein | 2 +- src/gromacs/utility/datafilefinder.cpp | 2 +- src/programs/CMakeLists.txt | 12 +++--- 22 files changed, 88 insertions(+), 92 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73469b7703..ef9be348b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by +# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -808,36 +808,28 @@ else() set(GMX_SHARED_LINKER_FLAGS ${GMX_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}) endif() + ######################################################################## # Specify install locations ######################################################################## # Use GNUInstallDirs to set paths on multiarch systems. include(GNUInstallDirs) -# Customization for the installation tree paths. -set(GMX_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING - "Library installation directory (default: ${CMAKE_INSTALL_LIBDIR})") -set(GMX_DATA_INSTALL_DIR gromacs CACHE STRING - "Data installation directory under share/ (default: gromacs)") -mark_as_advanced(GMX_LIB_INSTALL_DIR GMX_DATA_INSTALL_DIR) - -# These variables are used internally to provide a central location for -# customizing the install locations. -set(LIB_INSTALL_DIR ${GMX_LIB_INSTALL_DIR}) -set(BIN_INSTALL_DIR bin) -# This variable also gets written into config.h for use in finding the data -# directories. -set(DATA_INSTALL_DIR share/${GMX_DATA_INSTALL_DIR}) -set(MAN_INSTALL_DIR share/man) +set(GMX_INSTALL_DATASUBDIR "gromacs" CACHE STRING "Subdirectory for GROMACS data under CMAKE_INSTALL_DATADIR") +mark_as_advanced(GMX_INSTALL_DATASUBDIR) + +# Internal convenience so we do not have to join two path segments in the code +set(GMX_INSTALL_GMXDATADIR ${CMAKE_INSTALL_DATADIR}/${GMX_INSTALL_DATASUBDIR}) + # If the nesting level wrt. the installation root is changed, # gromacs-config.cmake.cmakein needs to be adapted. -set(CMAKE_INSTALL_DIR share/cmake) +set(GMX_INSTALL_CMAKEDIR ${CMAKE_INSTALL_DATAROOTDIR}/cmake) + # TODO: Make GMXRC adapt if this is changed -set(PKGCONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/pkgconfig) -set(OCL_INSTALL_DIR ${DATA_INSTALL_DIR}/opencl) -set(INCL_INSTALL_DIR include) +set(GMX_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +set(GMX_INSTALL_OCLDIR ${GMX_INSTALL_GMXDATADIR}/opencl) -list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${INCL_INSTALL_DIR}) +list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${CMAKE_INSTALL_INCLUDEDIR}) # Binary and library suffix options include(gmxManageSuffixes) @@ -855,7 +847,7 @@ else() # install to lib/, then the installation RPATH works also in the build # tree. This makes installation slightly faster (no need to rewrite the # RPATHs), and makes the binaries in the build tree relocatable. - if(GMX_LIB_INSTALL_DIR STREQUAL "lib") + if(CMAKE_INSTALL_LIBDIR STREQUAL "lib") set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) if(POLICY CMP0068) cmake_policy(SET CMP0068 NEW) # From CMake-3.9 @@ -865,10 +857,10 @@ else() # Set the RPATH as relative to the executable location to make the # binaries relocatable. if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") #Assume OS X >=10.5 - set(CMAKE_INSTALL_RPATH "@executable_path/../${GMX_LIB_INSTALL_DIR}") + set(CMAKE_INSTALL_RPATH "@executable_path/../${CMAKE_INSTALL_LIBDIR}") set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_RPATH}) else() - set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${GMX_LIB_INSTALL_DIR}") + set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}") endif() set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(CMAKE_MACOSX_RPATH 1) @@ -876,7 +868,7 @@ endif() #COPYING file: Only necessary for binary distributions. #Simpler to always install. -install(FILES COPYING DESTINATION ${DATA_INSTALL_DIR} COMPONENT data) +install(FILES COPYING DESTINATION ${GMX_INSTALL_GMXDATADIR} COMPONENT data) if (GMX_BUILD_FOR_COVERAGE) # Code heavy with asserts makes conditional coverage close to useless metric, diff --git a/admin/copyright.py b/admin/copyright.py index 1851cb0f8d..7e38ed8ab1 100755 --- a/admin/copyright.py +++ b/admin/copyright.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python # # This file is part of the GROMACS molecular simulation package. # diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 3909260f72..c8c2ee360d 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -305,7 +305,7 @@ if (MAN_PAGE_DIR) # Trailing slash on directory is significant for # install(DIRECTORY). See CMake docs. install(DIRECTORY ${MAN_PAGE_DIR}/ - DESTINATION ${MAN_INSTALL_DIR}/man1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT man OPTIONAL FILES_MATCHING PATTERN "*.1") endif() diff --git a/docs/dev-manual/build-system.rst b/docs/dev-manual/build-system.rst index 459a9a737a..dd6a69a5a0 100644 --- a/docs/dev-manual/build-system.rst +++ b/docs/dev-manual/build-system.rst @@ -208,11 +208,12 @@ Variables affecting compilation/linking subcounters which are available. Defaults to ``OFF``. -.. cmake:: GMX_DATA_INSTALL_DIR +.. cmake:: GMX_INSTALL_DATASUBDIR - Sets the directory under :file:`share/` where data files are installed. - The default is ``gromacs``, which puts the files under - file:`share/gromacs/`. + Sets the subdirectory under CMAKE_INSTALL_DATADIR where GROMACS-specific + read-only architecture-independent data files are installed. The default + is ``gromacs``, which means the files will go under ``share/gromacs``. + To alter the ``share`` part, change CMAKE_INSTALL_DATADIR. See :doc:`relocatable-binaries` for how this influences the build. .. cmake:: GMX_DOUBLE @@ -265,7 +266,7 @@ Variables affecting compilation/linking Pass additional CUDA-only compiler flags to clang using this variable. -.. cmake:: GMX_LIB_INSTALL_DIR +.. cmake:: CMAKE_INSTALL_LIBDIR Sets the installation directory for libraries (default is determined by standard CMake package ``GNUInstallDirs``). diff --git a/docs/dev-manual/relocatable-binaries.rst b/docs/dev-manual/relocatable-binaries.rst index e29907d2d1..732bde013f 100644 --- a/docs/dev-manual/relocatable-binaries.rst +++ b/docs/dev-manual/relocatable-binaries.rst @@ -113,10 +113,10 @@ implementation, which works like this: contains :file:`share/{gromacs}/top/gurgle.dat`, this directory is returned as the installation prefix. The file name ``gurgle.dat`` and the location are considered unique enough to ensure that the correct directory has been - found. The installation directory for the data files can be customized - during CMake configuration by setting ``GMX_DATA_INSTALL_DIR``, which - affects the *gromacs* part in the above path (both in the installation - structure and in this search logic). + found. The installation directory for read-only architecture-independent + data files can be customized during CMake configuration by setting + ``CMAKE_INSTALL_DATADIR``, and the subdirectory under this that hosts the + GROMACS-specific data is set by ``GMX_INSTALL_DATASUBDIR``. Note that this search does not resolve symbolic links or normalize the input path beforehand: if there are ``..`` components *and* symbolic links in the diff --git a/docs/install-guide/index.rst b/docs/install-guide/index.rst index 3d1d8c38d9..e46eeecaeb 100644 --- a/docs/install-guide/index.rst +++ b/docs/install-guide/index.rst @@ -821,12 +821,14 @@ CMakeLists.txt. The standard location for executables and some scripts. Some of the scripts hardcode the absolute installation prefix, which needs to be changed if the scripts are relocated. + The name of the directory can be changed using ``CMAKE_INSTALL_BINDIR`` CMake + variable. ``include/gromacs/`` The standard location for installed headers. ``lib/`` The standard location for libraries. The default depends on the system, and is determined by CMake. - The name of the directory can be changed using ``GMX_LIB_INSTALL_DIR`` CMake + The name of the directory can be changed using ``CMAKE_INSTALL_LIBDIR`` CMake variable. ``lib/pkgconfig/`` Information about the installed ``libgromacs`` library for ``pkg-config`` is @@ -836,9 +838,10 @@ CMakeLists.txt. ``share/cmake/`` CMake package configuration files are installed here. ``share/gromacs/`` - Various data files and some documentation go here. - The ``gromacs`` part can be changed using ``GMX_DATA_INSTALL_DIR``. Using this - CMake variable is the preferred way of changing the installation path for + Various data files and some documentation go here. The first part can + be changed using ``CMAKE_INSTALL_DATADIR``, and the second by using + ``GMX_INSTALL_DATASUBDIR`` Using these CMake variables is the preferred + way of changing the installation path for ``share/gromacs/top/``, since the path to this directory is built into ``libgromacs`` as well as some scripts, both as a relative and as an absolute path (the latter as a fallback if everything else fails). diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 521589d2cf..43aebd6db8 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2010,2014, by the GROMACS development team, led by +# Copyright (c) 2010,2014,2018, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -37,10 +37,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GMXRC.bash.cmakein ${CMAKE_CURRENT_BI configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GMXRC.csh.cmakein ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GMXRC.zsh.cmakein ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh @ONLY) -install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) -install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.bash DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) -install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) -install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.bash DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) -install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/demux.pl DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) -install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/xplor2gmx.pl DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) +install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/demux.pl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) +install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/xplor2gmx.pl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) diff --git a/scripts/GMXRC.bash.cmakein b/scripts/GMXRC.bash.cmakein index 18457a6377..7de4e848a8 100644 --- a/scripts/GMXRC.bash.cmakein +++ b/scripts/GMXRC.bash.cmakein @@ -51,10 +51,10 @@ MANPATH=$tmppath # If you move gromacs, change the first line. ########################################################## GMXPREFIX=@CMAKE_INSTALL_PREFIX@ -GMXBIN=${GMXPREFIX}/@BIN_INSTALL_DIR@ -GMXLDLIB=${GMXPREFIX}/@LIB_INSTALL_DIR@ -GMXMAN=${GMXPREFIX}/@MAN_INSTALL_DIR@ -GMXDATA=${GMXPREFIX}/@DATA_INSTALL_DIR@ +GMXBIN=${GMXPREFIX}/@CMAKE_INSTALL_BINDIR@ +GMXLDLIB=${GMXPREFIX}/@CMAKE_INSTALL_LIBDIR@ +GMXMAN=${GMXPREFIX}/@CMAKE_INSTALL_MANDIR@ +GMXDATA=${GMXPREFIX}/@GMX_INSTALL_GMXDATADIR@ GROMACS_DIR=${GMXPREFIX} LD_LIBRARY_PATH=${GMXLDLIB}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH} diff --git a/scripts/GMXRC.cmakein b/scripts/GMXRC.cmakein index 1ecf954885..c141b29615 100644 --- a/scripts/GMXRC.cmakein +++ b/scripts/GMXRC.cmakein @@ -10,9 +10,9 @@ echo $shell | grep -q csh && goto CSH # if we got here, shell is bsh/bash/zsh/ksh -. @CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/GMXRC.bash +. @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/GMXRC.bash return # csh/tcsh jump here CSH: -source @CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/GMXRC.csh +source @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/GMXRC.csh diff --git a/scripts/GMXRC.csh.cmakein b/scripts/GMXRC.csh.cmakein index 16a85df5c3..315fccf812 100644 --- a/scripts/GMXRC.csh.cmakein +++ b/scripts/GMXRC.csh.cmakein @@ -71,10 +71,10 @@ setenv MANPATH $tmppath # If you move gromacs, change the first line. ########################################################## setenv GMXPREFIX @CMAKE_INSTALL_PREFIX@ -setenv GMXBIN ${GMXPREFIX}/@BIN_INSTALL_DIR@ -setenv GMXLDLIB ${GMXPREFIX}/@LIB_INSTALL_DIR@ -setenv GMXMAN ${GMXPREFIX}/@MAN_INSTALL_DIR@ -setenv GMXDATA ${GMXPREFIX}/@DATA_INSTALL_DIR@ +setenv GMXBIN ${GMXPREFIX}/@CMAKE_INSTALL_BINDIR@ +setenv GMXLDLIB ${GMXPREFIX}/@CMAKE_INSTALL_LIBDIR@ +setenv GMXMAN ${GMXPREFIX}/@CMAKE_INSTALL_MANDIR@ +setenv GMXDATA ${GMXPREFIX}/@GMX_INSTALL_GMXDATADIR@ setenv GROMACS_DIR ${GMXPREFIX} #make them begin with : diff --git a/scripts/GMXRC.zsh.cmakein b/scripts/GMXRC.zsh.cmakein index 97287547ea..0558f350a9 100644 --- a/scripts/GMXRC.zsh.cmakein +++ b/scripts/GMXRC.zsh.cmakein @@ -1,3 +1,3 @@ # zsh configuration file for Gromacs # only kept for backwards compatibility -source @CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/GMXRC.bash +source @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/GMXRC.bash diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index e82d2d5baa..2934003259 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by +# Copyright (c) 2009,2010,2011,2012,2013,2014,2018, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -35,9 +35,9 @@ add_subdirectory(template) install(FILES README.tutor README_FreeEnergyModifications.txt - DESTINATION ${DATA_INSTALL_DIR} + DESTINATION ${GMX_INSTALL_GMXDATADIR} COMPONENT data) install(DIRECTORY top - DESTINATION ${DATA_INSTALL_DIR} + DESTINATION ${GMX_INSTALL_GMXDATADIR} COMPONENT data PATTERN "*~" EXCLUDE) diff --git a/share/template/CMakeLists.txt b/share/template/CMakeLists.txt index feee762fdd..d33e783d9f 100644 --- a/share/template/CMakeLists.txt +++ b/share/template/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2011,2012,2014,2016, by the GROMACS development team, led by +# Copyright (c) 2011,2012,2014,2016,2018, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -44,14 +44,14 @@ endif() configure_file(README.cmakein README @ONLY) install(FILES CMakeLists.txt.template - DESTINATION ${DATA_INSTALL_DIR}/template + DESTINATION ${GMX_INSTALL_GMXDATADIR}/template RENAME CMakeLists.txt COMPONENT development) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/README template.cpp Makefile.pkg - DESTINATION ${DATA_INSTALL_DIR}/template + DESTINATION ${GMX_INSTALL_GMXDATADIR}/template COMPONENT development) install(FILES cmake/FindGROMACS.cmake - DESTINATION ${DATA_INSTALL_DIR}/template/cmake + DESTINATION ${GMX_INSTALL_GMXDATADIR}/template/cmake COMPONENT development) diff --git a/src/buildinfo.h.cmakein b/src/buildinfo.h.cmakein index 21a31e23b3..1e32a4c381 100644 --- a/src/buildinfo.h.cmakein +++ b/src/buildinfo.h.cmakein @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -87,8 +87,8 @@ /** Binary directory for the build */ #define CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@" -/** Location of data files in the installation directory */ -#define DATA_INSTALL_DIR "@DATA_INSTALL_DIR@" +/** Location of GROMACS-specific data files */ +#define GMX_INSTALL_GMXDATADIR "@GMX_INSTALL_GMXDATADIR@" /** CUDA compiler version information */ #define CUDA_COMPILER_INFO "@CUDA_COMPILER_INFO@" diff --git a/src/config.h.cmakein b/src/config.h.cmakein index bd7e658901..8943387687 100644 --- a/src/config.h.cmakein +++ b/src/config.h.cmakein @@ -251,7 +251,7 @@ #cmakedefine01 HAVE_NVML /* Define relative path to OpenCL kernels */ -#define OCL_INSTALL_DIR "@OCL_INSTALL_DIR@" +#define GMX_INSTALL_OCLDIR "@GMX_INSTALL_OCLDIR@" /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #cmakedefine01 HAVE_FSEEKO diff --git a/src/gromacs/CMakeLists.txt b/src/gromacs/CMakeLists.txt index 3fc93c45fd..2be0593086 100644 --- a/src/gromacs/CMakeLists.txt +++ b/src/gromacs/CMakeLists.txt @@ -61,7 +61,7 @@ function (gmx_install_headers) if (NOT GMX_BUILD_MDRUN_ONLY) file(RELATIVE_PATH _dest ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_LIST_DIR}) install(FILES ${ARGN} - DESTINATION "${INCL_INSTALL_DIR}/${_dest}" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_dest}" COMPONENT development) endif() _gmx_add_files_to_property(GMX_INSTALLED_HEADERS ${ARGN}) @@ -226,9 +226,9 @@ gmx_write_installed_header_list() if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS) install(TARGETS libgromacs EXPORT libgromacs - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif() @@ -247,7 +247,7 @@ if (INSTALL_CUDART_LIB) #can be set manual by user #install also name-links (linker uses those) file(GLOB CUDA_LIBS ${CUDA_LIB}*) install(FILES ${CUDA_LIBS} DESTINATION - ${LIB_INSTALL_DIR} COMPONENT libraries) + ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) endif() endforeach() else() @@ -259,7 +259,7 @@ if(GMX_USE_OPENCL) set(OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS}) install(FILES ${OPENCL_KERNELS} DESTINATION - ${OCL_INSTALL_DIR} COMPONENT libraries) + ${GMX_INSTALL_OCLDIR} COMPONENT libraries) endif() if (BUILD_TESTING) diff --git a/src/gromacs/InstallLibInfo.cmake b/src/gromacs/InstallLibInfo.cmake index ccc12719ca..af244430e9 100644 --- a/src/gromacs/InstallLibInfo.cmake +++ b/src/gromacs/InstallLibInfo.cmake @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2014,2016, by the GROMACS development team, led by +# Copyright (c) 2014,2016,2018, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -51,7 +51,7 @@ function (do_pkgconfig) configure_file(libgromacs.pc.cmakein libgromacs.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgromacs.pc - DESTINATION ${PKGCONFIG_INSTALL_DIR} + DESTINATION ${GMX_INSTALL_PKGCONFIGDIR} RENAME "libgromacs${GMX_LIBS_SUFFIX}.pc" COMPONENT development) endfunction() @@ -60,7 +60,7 @@ function (do_cmake_config) # Install everything into a subdirectory, because # 1. CMake expects things to be there for CMAKE_PREFIX_PATH to work, and # 2. This nicely isolates files for different suffixes from each other. - set(CMAKE_PACKAGE_DIR ${CMAKE_INSTALL_DIR}/gromacs${GMX_LIBS_SUFFIX}) + set(GMX_INSTALL_CMAKEPKGDIR ${GMX_INSTALL_CMAKEDIR}/gromacs${GMX_LIBS_SUFFIX}) # Install import definitions that take care of the library locations and # library dependencies. @@ -70,7 +70,7 @@ function (do_cmake_config) endif() install(EXPORT libgromacs FILE ${EXPORT_FILE_NAME} - DESTINATION ${CMAKE_PACKAGE_DIR} + DESTINATION ${GMX_INSTALL_CMAKEPKGDIR} COMPONENT libraries) get_filename_component(GROMACS_CXX_COMPILER ${CMAKE_CXX_COMPILER} REALPATH) @@ -83,11 +83,11 @@ function (do_cmake_config) # find_package(GROMACS NAMES gromacs_d) to find them, without also # specifying CONFIGS. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gromacs-config.cmake - DESTINATION ${CMAKE_PACKAGE_DIR} + DESTINATION ${GMX_INSTALL_CMAKEPKGDIR} RENAME "gromacs${GMX_LIBS_SUFFIX}-config.cmake" COMPONENT development) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gromacs-config-version.cmake - DESTINATION ${CMAKE_PACKAGE_DIR} + DESTINATION ${GMX_INSTALL_CMAKEPKGDIR} RENAME "gromacs${GMX_LIBS_SUFFIX}-config-version.cmake" COMPONENT development) endfunction() diff --git a/src/gromacs/commandline/cmdlineprogramcontext.cpp b/src/gromacs/commandline/cmdlineprogramcontext.cpp index dc15cd2df7..70692bbcb0 100644 --- a/src/gromacs/commandline/cmdlineprogramcontext.cpp +++ b/src/gromacs/commandline/cmdlineprogramcontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -186,7 +186,7 @@ bool isAcceptableLibraryPath(const std::string &path) */ bool isAcceptableLibraryPathPrefix(const std::string &path) { - std::string testPath = Path::join(path, DATA_INSTALL_DIR, "top"); + std::string testPath = Path::join(path, GMX_INSTALL_GMXDATADIR, "top"); if (isAcceptableLibraryPath(testPath)) { return true; diff --git a/src/gromacs/gpu_utils/ocl_compiler.cpp b/src/gromacs/gpu_utils/ocl_compiler.cpp index 950c323fab..957c6bc453 100644 --- a/src/gromacs/gpu_utils/ocl_compiler.cpp +++ b/src/gromacs/gpu_utils/ocl_compiler.cpp @@ -229,7 +229,7 @@ getKernelRootPath() InstallationPrefixInfo info = getProgramContext().installationPrefix(); std::string dataPathSuffix = (info.bSourceLayout ? "src/gromacs/mdlib/nbnxn_ocl" : - OCL_INSTALL_DIR); + GMX_INSTALL_OCLDIR); kernelRootPath = Path::join(info.path, dataPathSuffix); } else diff --git a/src/gromacs/libgromacs.pc.cmakein b/src/gromacs/libgromacs.pc.cmakein index 228845ea85..f4caaa51f6 100644 --- a/src/gromacs/libgromacs.pc.cmakein +++ b/src/gromacs/libgromacs.pc.cmakein @@ -1,4 +1,4 @@ -libdir=@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@ +libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ Name: libgromacs@GMX_LIBS_SUFFIX@ Description: Gromacs library diff --git a/src/gromacs/utility/datafilefinder.cpp b/src/gromacs/utility/datafilefinder.cpp index 0ebd30a4f5..dd7c769483 100644 --- a/src/gromacs/utility/datafilefinder.cpp +++ b/src/gromacs/utility/datafilefinder.cpp @@ -83,7 +83,7 @@ std::string DataFileFinder::Impl::getDefaultPath() if (!isNullOrEmpty(installPrefix.path)) { const char *const dataPath - = installPrefix.bSourceLayout ? "share" : DATA_INSTALL_DIR; + = installPrefix.bSourceLayout ? "share" : GMX_INSTALL_GMXDATADIR; return Path::join(installPrefix.path, dataPath, "top"); } return std::string(); diff --git a/src/programs/CMakeLists.txt b/src/programs/CMakeLists.txt index 81e7e29301..d56eb87a25 100644 --- a/src/programs/CMakeLists.txt +++ b/src/programs/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by +# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2018, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -52,11 +52,11 @@ elseif(GMX_BUILD_MDRUN_ONLY) set_target_properties(mdrun PROPERTIES OUTPUT_NAME "${BINARY_NAME}" COMPILE_FLAGS "${OpenMP_C_FLAGS}") - install(TARGETS mdrun DESTINATION ${BIN_INSTALL_DIR} COMPONENT mdrun) + install(TARGETS mdrun DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT mdrun) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash "complete -o nospace -F _gmx_mdrun_compl ${BINARY_NAME}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash - DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) + DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) else() file(GLOB GMX_MAIN_SOURCES gmx.cpp legacymodules.cpp) if(GMX_X11) @@ -81,7 +81,7 @@ else() OUTPUT_NAME "${BINARY_NAME}" COMPILE_FLAGS "${OpenMP_C_FLAGS}") install(TARGETS gmx - RUNTIME DESTINATION ${BIN_INSTALL_DIR}) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ######################## # Completion generation @@ -108,11 +108,11 @@ else() endif() if (SOURCE_IS_SOURCE_DISTRIBUTION OR GMX_BUILD_HELP) install(DIRECTORY ${COMPLETION_DIR}/ - DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime OPTIONAL) + DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime OPTIONAL) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash "complete -o nospace -F _gmx_compl ${BINARY_NAME}") install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash - DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime) + DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime) endif() gmx_cpack_add_generated_source_directory(completion) -- 2.22.0