From 9b72659a553fb95f7be9ee0ff413dbecf895a379 Mon Sep 17 00:00:00 2001 From: Teemu Murtola Date: Sat, 16 May 2015 09:20:27 +0300 Subject: [PATCH] Move a few defines to buildinfo.h Move CMAKE_INSTALL_PREFIX, CMAKE_SOURCE_DIR, and related defines to buildinfo.h to reduce exposure of these defines. In particular, this removes the need for a ~full rebuild when changing the installation prefix. Remove GMX_BINARY_SUFFIX from config.h, as it is no longer used in any source code. Change-Id: I830e8df15806a22f40726947c92d2612245d8d25 --- docs/install-guide/index.rst | 5 ++--- src/buildinfo.h.cmakein | 14 +++++++++++++- src/config.h.cmakein | 15 --------------- src/gromacs/commandline/cmdlineprogramcontext.cpp | 1 + .../commandline/tests/cmdlinemodulemanager.cpp | 3 --- .../commandline/tests/cmdlineprogramcontext.cpp | 3 ++- src/gromacs/utility/datafilefinder.cpp | 3 +-- src/gromacs/utility/errorformat.cpp | 5 ++--- src/testutils/testinit.cpp | 3 +-- 9 files changed, 22 insertions(+), 30 deletions(-) diff --git a/docs/install-guide/index.rst b/docs/install-guide/index.rst index ef7131afc0..ab66e61707 100644 --- a/docs/install-guide/index.rst +++ b/docs/install-guide/index.rst @@ -379,9 +379,8 @@ configuration, in particular if you need to resolve errors. A key thing to consider here is the setting of ``CMAKE_INSTALL_PREFIX``. You will need to be able to write to this -directory in order to install |Gromacs| later, and if you change your -mind later, changing it in the cache triggers a full re-build, -unfortunately. So if you do not have super-user privileges on your +directory in order to install |Gromacs| later. +So if you do not have super-user privileges on your machine, then you will need to choose a sensible location within your home directory for your |Gromacs| installation. Even if you do have super-user privileges, you should use them only for the installation diff --git a/src/buildinfo.h.cmakein b/src/buildinfo.h.cmakein index cb094830c1..333250ce08 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, by the GROMACS development team, led by + * Copyright (c) 2012,2013,2014,2015, 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. @@ -78,6 +78,18 @@ /** C++ compiler flags used to build */ #define BUILD_CXXFLAGS "@BUILD_CXXFLAGS@" +/** Installation prefix (default location of data files) */ +#define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" + +/** Source directory for the build */ +#define CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@" + +/** 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@" + /** CUDA nvcc compiler version information */ #define CUDA_NVCC_COMPILER_INFO "@CUDA_NVCC_COMPILER_INFO@" diff --git a/src/config.h.cmakein b/src/config.h.cmakein index d5acd94d29..a480f1cdfe 100644 --- a/src/config.h.cmakein +++ b/src/config.h.cmakein @@ -47,21 +47,6 @@ /* TODO: For now, disable Doxygen warnings from here */ /*! \cond */ -/* Binary suffix for the created binaries */ -#define GMX_BINARY_SUFFIX "@GMX_BINARY_SUFFIX@" - -/* Installation prefix (default location of data files) */ -#define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" - -/* Location of data files in the installation directory */ -#define DATA_INSTALL_DIR "@DATA_INSTALL_DIR@" - -/* Source directory for the build */ -#cmakedefine CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@" - -/* Binary directory for the build */ -#cmakedefine CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@" - /* IEEE754 floating-point format. Memory layout is defined by macros * GMX_IEEE754_BIG_ENDIAN_BYTE_ORDER and GMX_IEEE754_BIG_ENDIAN_WORD_ORDER. */ diff --git a/src/gromacs/commandline/cmdlineprogramcontext.cpp b/src/gromacs/commandline/cmdlineprogramcontext.cpp index 0846466980..ebfa26613b 100644 --- a/src/gromacs/commandline/cmdlineprogramcontext.cpp +++ b/src/gromacs/commandline/cmdlineprogramcontext.cpp @@ -55,6 +55,7 @@ #include "thread_mpi/mutex.h" +#include "buildinfo.h" #include "gromacs/utility/exceptions.h" #include "gromacs/utility/file.h" #include "gromacs/utility/gmxassert.h" diff --git a/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp b/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp index 6a420e921e..d680cfef6e 100644 --- a/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp +++ b/src/gromacs/commandline/tests/cmdlinemodulemanager.cpp @@ -39,13 +39,10 @@ * \author Teemu Murtola * \ingroup module_commandline */ -// For GMX_BINARY_SUFFIX #include "gmxpre.h" #include "gromacs/commandline/cmdlinemodulemanager.h" -#include "config.h" - #include #include diff --git a/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp b/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp index edfb9491d1..3ffdad11aa 100644 --- a/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp +++ b/src/gromacs/commandline/tests/cmdlineprogramcontext.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2013,2014, by the GROMACS development team, led by + * Copyright (c) 2013,2014,2015, 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,6 +51,7 @@ #include #include +#include "buildinfo.h" #include "gromacs/utility/classhelpers.h" #include "gromacs/utility/path.h" diff --git a/src/gromacs/utility/datafilefinder.cpp b/src/gromacs/utility/datafilefinder.cpp index bdf673df5d..2bc6a9b875 100644 --- a/src/gromacs/utility/datafilefinder.cpp +++ b/src/gromacs/utility/datafilefinder.cpp @@ -43,13 +43,12 @@ #include "datafilefinder.h" -#include "config.h" - #include #include #include +#include "buildinfo.h" #include "gromacs/utility/directoryenumerator.h" #include "gromacs/utility/exceptions.h" #include "gromacs/utility/file.h" diff --git a/src/gromacs/utility/errorformat.cpp b/src/gromacs/utility/errorformat.cpp index a8f7159c29..74cfeabb32 100644 --- a/src/gromacs/utility/errorformat.cpp +++ b/src/gromacs/utility/errorformat.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015, 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. @@ -43,12 +43,11 @@ #include "errorformat.h" -#include "config.h" - #include #include #include +#include "buildinfo.h" #include "gromacs/utility/baseversion.h" #include "gromacs/utility/programcontext.h" #include "gromacs/utility/stringutil.h" diff --git a/src/testutils/testinit.cpp b/src/testutils/testinit.cpp index 3969e4c363..4bfdd9e203 100644 --- a/src/testutils/testinit.cpp +++ b/src/testutils/testinit.cpp @@ -43,14 +43,13 @@ #include "testinit.h" -#include "config.h" - #include #include #include #include +#include "buildinfo.h" #include "gromacs/commandline/cmdlinehelpcontext.h" #include "gromacs/commandline/cmdlinehelpwriter.h" #include "gromacs/commandline/cmdlineinit.h" -- 2.22.0