Establish `api/` as the home for installed headers.
authorM. Eric Irrgang <mei2n@virginia.edu>
Wed, 4 Nov 2020 08:03:33 +0000 (08:03 +0000)
committerJoe Jordan <ejjordan12@gmail.com>
Wed, 4 Nov 2020 08:03:33 +0000 (08:03 +0000)
Prepare to remove `src/` from global build tree include path.
* Create `api/legacy` for the new `legacy_api` target.
* Move gmxapi and nblib public header dependencies to `api/legacy`.

This change is orthogonal to the clarification of the public API.
The purpose is to normalize the way we manage installed headers.
gmxapi and nblib already provide their public interfaces through files
and CMake targets in `api/`. For the remaining installed libgromacs
headers, the `legacy_api` target provides a transitional home as the
modules are individually updated in terms of CMake machinery and as the
legacy API functionality is reexamined.

Refs #3288

57 files changed:
admin/gitlab-ci/gromacs.gitlab-ci.yml
api/CMakeLists.txt
api/legacy/CMakeLists.txt [new file with mode: 0644]
api/legacy/include/gromacs/fileio/confio.h [moved from src/gromacs/fileio/confio.h with 100% similarity]
api/legacy/include/gromacs/fileio/filetypes.h [moved from src/gromacs/fileio/filetypes.h with 97% similarity]
api/legacy/include/gromacs/fileio/oenv.h [moved from src/gromacs/fileio/oenv.h with 100% similarity]
api/legacy/include/gromacs/fileio/pdbio.h [moved from src/gromacs/fileio/pdbio.h with 100% similarity]
api/legacy/include/gromacs/fileio/tpxio.h [moved from src/gromacs/fileio/tpxio.h with 100% similarity]
api/legacy/include/gromacs/math/do_fit.h [moved from src/gromacs/math/do_fit.h with 100% similarity]
api/legacy/include/gromacs/math/functions.h [moved from src/gromacs/math/functions.h with 99% similarity]
api/legacy/include/gromacs/math/units.h [moved from src/gromacs/math/units.h with 98% similarity]
api/legacy/include/gromacs/math/utilities.h [moved from src/gromacs/math/utilities.h with 100% similarity]
api/legacy/include/gromacs/math/vec.h [moved from src/gromacs/math/vec.h with 100% similarity]
api/legacy/include/gromacs/math/vectypes.h [moved from src/gromacs/math/vectypes.h with 100% similarity]
api/legacy/include/gromacs/restraint/restraintpotential.h [moved from src/gromacs/restraint/restraintpotential.h with 99% similarity]
api/legacy/include/gromacs/utility/arrayref.h [moved from src/gromacs/utility/arrayref.h with 100% similarity]
api/legacy/include/gromacs/utility/basedefinitions.h [moved from src/gromacs/utility/basedefinitions.h with 100% similarity]
api/legacy/include/gromacs/utility/current_function.h [moved from src/gromacs/utility/current_function.h with 97% similarity]
api/legacy/include/gromacs/utility/exceptions.h [moved from src/gromacs/utility/exceptions.h with 100% similarity]
api/legacy/include/gromacs/utility/gmxassert.h [moved from src/gromacs/utility/gmxassert.h with 98% similarity]
api/legacy/include/gromacs/utility/listoflists.h [moved from src/gromacs/utility/listoflists.h with 100% similarity]
api/legacy/include/gromacs/utility/real.h [moved from src/gromacs/utility/real.h with 100% similarity]
api/legacy/version.h.cmakein [new file with mode: 0644]
api/nblib/CMakeLists.txt
api/nblib/tests/CMakeLists.txt
docs/dev-manual/includestyle.rst
docs/doxygen/Doxyfile-common.cmakein
docs/doxygen/check-source.py
docs/doxygen/cycle-suppressions.txt
docs/doxygen/suppressions.txt
python_packaging/sample_restraint/src/cpp/CMakeLists.txt
python_packaging/sample_restraint/tests/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/tests/CMakeLists.txt
src/gromacs/fileio/CMakeLists.txt
src/gromacs/fileio/confio.cpp
src/gromacs/fileio/filetypes.cpp
src/gromacs/fileio/oenv.cpp
src/gromacs/fileio/pdbio.cpp
src/gromacs/fileio/tests/CMakeLists.txt
src/gromacs/fileio/tpxio.cpp
src/gromacs/linearalgebra/CMakeLists.txt
src/gromacs/math/CMakeLists.txt
src/gromacs/math/do_fit.cpp
src/gromacs/math/functions.cpp
src/gromacs/math/units.cpp
src/gromacs/math/utilities.cpp
src/gromacs/mdrunutility/tests/CMakeLists.txt
src/gromacs/modularsimulator/CMakeLists.txt
src/gromacs/restraint/CMakeLists.txt
src/gromacs/selection/CMakeLists.txt
src/gromacs/utility/CMakeLists.txt
src/gromacs/utility/exceptions.cpp
src/gromacs/utility/gmxassert.cpp
src/programs/CMakeLists.txt
src/programs/mdrun/tests/CMakeLists.txt
src/testutils/CMakeLists.txt

index f5c9ea23ca64588048e3af5dc8b0740ae5a40c8e..a7ec874ed8a2cc6808fd309c80573f39377cfb59 100644 (file)
@@ -225,7 +225,7 @@ gromacs:gcc-7:configure:
   image: gromacs/cmake-3.13.0-gcc-7-amdopencl-clfft-openmpi-master
   variables:
     CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=AVX2_256"
-    CMAKE_EXTRA_OPTIONS: "-DGMX_EXTERNAL_CLFFT=ON"
+    CMAKE_EXTRA_OPTIONS: "-DGMX_EXTERNAL_CLFFT=ON -DGMX_INSTALL_LEGACY_API=ON"
     COMPILER_MAJOR_VERSION: 7
 
 gromacs:gcc-8-cuda-11.0:configure:
index 80375188fafdcff090380995bdc7ccd6a75d9b62..c71f607fe6ca29d73e2fcbd05b6d6dfdc8f6189f 100644 (file)
@@ -32,6 +32,9 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# The legacy public API headers may still be installed,
+# but may be removed or changed without warning.
+add_subdirectory(legacy)
 
 # Activate targets for new C++ API components and docs.
 if(GMX_NATIVE_WINDOWS OR GMX_BUILD_MDRUN_ONLY)
diff --git a/api/legacy/CMakeLists.txt b/api/legacy/CMakeLists.txt
new file mode 100644 (file)
index 0000000..116bf49
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2020, 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.
+#
+# GROMACS is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1
+# of the License, or (at your option) any later version.
+#
+# GROMACS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with GROMACS; if not, see
+# http://www.gnu.org/licenses, or write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+#
+# If you want to redistribute modifications to GROMACS, please
+# consider that scientific software is very special. Version
+# control is crucial - bugs must be traceable. We will be happy to
+# consider code for inclusion in the official distribution, but
+# derived work must not be called official GROMACS. Details are found
+# in the README & COPYING files - if they are missing, get the
+# official version at http://www.gromacs.org.
+#
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org.
+
+# The legacy installed API consists of headers that are not considered
+# to be maintainable in terms of a stable API specification. These headers
+# will no longer be available to install in a future release.
+
+# Note: Any usage requirements that should be transitive should be added to
+# this INTERFACE target. Compiler and linker options (that do not need to
+# be propagated when linking to the `common` target) can be added directly
+# to the `common` target.
+add_library(legacy_api INTERFACE)
+target_include_directories(legacy_api INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+                           $<INSTALL_INTERFACE:include>)
+
+configure_file(version.h.cmakein include/gromacs/version.h)
+
+# Allow an export target for legacy_api since it is a dependency of the
+# installable libgromacs target.
+install(TARGETS legacy_api
+        EXPORT libgromacs
+        INCLUDES DESTINATION include)
+
+if(GMX_INSTALL_LEGACY_API)
+    # Install public header directories.
+    install(DIRECTORY include/gromacs
+            DESTINATION include)
+
+    # Install "configured" files from the build tree.
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/gromacs/version.h
+            DESTINATION include/gromacs)
+endif()
similarity index 97%
rename from src/gromacs/fileio/filetypes.h
rename to api/legacy/include/gromacs/fileio/filetypes.h
index d56e1997b18eac9ec701555873f7a7b2a6835334..b3bad3c7838ea7bf09a7bc4a56ccfaa97b6ff813 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2020, 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.
similarity index 99%
rename from src/gromacs/math/functions.h
rename to api/legacy/include/gromacs/math/functions.h
index 35150b3ddd7c2da8a66ddbd92d9515b744b545b8..271e1cf76035529d27aa07b4fb5313bbb2c62303 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018,2019,2020, 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.
similarity index 98%
rename from src/gromacs/math/units.h
rename to api/legacy/include/gromacs/math/units.h
index 865fd31175994d1a426977af9d2afbca082ce88f..bb9f8075ac16a217895c50bad5f0dbc1fede5c76 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2018,2019,2020, 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.
similarity index 99%
rename from src/gromacs/restraint/restraintpotential.h
rename to api/legacy/include/gromacs/restraint/restraintpotential.h
index 72bf0dbe712d25ed80262202b4096d0bd5a71ca4..872d0690160688484e7fe606f13f6ca3f44693fc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, 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.
similarity index 97%
rename from src/gromacs/utility/current_function.h
rename to api/legacy/include/gromacs/utility/current_function.h
index 1f18cab6ffce9d542ae887075677ca3556e24bfc..e7718893285984e1190c680191db9093d3ead6d3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2019,2020, 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.
similarity index 98%
rename from src/gromacs/utility/gmxassert.h
rename to api/legacy/include/gromacs/utility/gmxassert.h
index c278f2c2fc3c702d473c718a47a60793c0a1345b..089b73c1df7122089163830aad4a7518ddad7780 100644 (file)
@@ -2,7 +2,7 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 2011-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, 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.
diff --git a/api/legacy/version.h.cmakein b/api/legacy/version.h.cmakein
new file mode 100644 (file)
index 0000000..ffe1a25
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2012,2014,2020, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \file
+ * \brief
+ * Version information for software that links to \Gromacs.
+ *
+ * \if libapi
+ * This include file will be configured by CMake and contains version
+ * information.  It is not used by \Gromacs, but intended for software that
+ * links to \Gromacs.
+ * The values come from the main CMakeLists.txt.
+ * \endif
+ *
+ * This file exists from 4.6 onward, and can be included as
+ * `<gromacs/version.h>`.  In 4.6, it is also included by
+ * `<gromacs/typedefs.h>, but that header has already moved in 5.0.
+ *
+ * This header defines two values, the \Gromacs version, and the API version.
+ * The versions are in numerical form, where, for example, version
+ * 4.6.1 would be 40601.
+ *
+ * The API version is defined in ::GMX_API_VERSION, and denotes the
+ * version of the programmer interface, i.e. the installed header files
+ * and compatible library.
+ *
+ * Programs written against the \Gromacs library can use this file
+ * to provide some backward compatibility even though parts of the API
+ * change.  For example:
+ * \code
+   #include <gromacs/version.h>
+   #if (GMX_API_VERSION < 50000)
+       .... <do pre-5.0 stuff>
+   #else
+       .... <do post-5.0 stuff>
+   #endif
+   \endcode
+ * where version.h is included directly. For code that must be compatible
+ * between 4.5 and 4.6, an interim solution is to include typedefs.h, which
+ * includes this file:
+ * \code
+   #include <gromacs/typedefs.h>
+   #if !defined(GMX_API_VERSION) || (GMX_API_VERSION < 40600)
+       ....  <do 4.5 specific stuff>
+   #elif (GMX_API_VERSION < 40700)
+       ....  <do 4.6 specific stuff>
+   #endif
+   \endcode
+ *
+ * \inpublicapi
+ */
+#ifndef GMX_VERSION_H
+#define GMX_VERSION_H
+
+/*! \brief
+ * API version of this set of \Gromacs headers.
+ *
+ * If there are multiple versions of \Gromacs that work with the same set of
+ * headers, then this version is not updated between the versions, even though
+ * ::GMX_VERSION is.
+ * For 4.6 and 5.0 (and likely for some time in the future as well), this
+ * tracks the exact \Gromacs version.
+ */
+#define GMX_API_VERSION @GMX_API_VERSION@
+
+/*! \brief
+ * Exact \Gromacs version of this set of headers.
+ *
+ * This specifies the version number of the actual \Gromacs library that
+ * installed these headers.
+ */
+#define GMX_VERSION @GMX_VERSION_NUMERIC@
+
+#endif
index e2054314c18945028cc968915ff3337bb276f5f0..d41c856c204ae262c6d902b27c250808904a8114 100644 (file)
@@ -116,6 +116,8 @@ set_target_properties(nblib
 target_link_libraries(nblib PRIVATE libgromacs)
 target_include_directories(nblib PRIVATE ${PROJECT_SOURCE_DIR}/api)
 include_directories(BEFORE ${CMAKE_SOURCE_DIR}/api)
+# There are transitive dependencies on the legacy GROMACS headers.
+target_link_libraries(nblib PUBLIC legacy_api)
 
 install(TARGETS nblib
         EXPORT nblib
index 366027339c88838c2e747a255e6fa8a525e2885a..67cf8a51dc401e97758140adf72f34857879fc12 100644 (file)
@@ -46,6 +46,7 @@ gmx_add_unit_test_library(nblib_test_infrastructure
     )
 target_include_directories(nblib_test_infrastructure PRIVATE ${PROJECT_SOURCE_DIR}/api)
 target_include_directories(nblib_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+target_link_libraries(nblib_test_infrastructure PRIVATE legacy_api)
 
 set(testname "NbLibSetupTests")
 set(exename "nblib-setup-test")
index 5c2b890297d97e3d2e2b92f81b2e89d319aa38b8..ece8fbaf1ac9b363fee6e885c2722600cc0c6294 100644 (file)
@@ -7,8 +7,8 @@ between each group, and headers within each group sorted alphabetically.
 1. Each *source* file should include ``gmxpre.h`` first.
 2. If a *source* file has a corresponding header, it should be included next.
    If the header is in the same directory as the source, then it is included
-   without any path (i.e., relative to the source), otherwise relative to
-   ``src/`` (the latter case should be rare).
+   without any path (i.e., relative to the source). Otherwise, the canonical
+   include path of ``libraryname/modulename/header.h`` is used.
 3. If the file depends on defines from ``config.h``, that comes next.
 4. This is followed by standard C/C++ headers, grouped as follows:
 
@@ -23,15 +23,11 @@ between each group, and headers within each group sorted alphabetically.
    ``<gtest/gtest.h>``.
 6. |Gromacs|-specific libraries from ``src/external/``, such as
    ``"thread_mpi/threads.h"``.
-7. |Gromacs|-specific headers that are not internal to the including module,
-   included with a path relative to ``src/``.
-8. In *test* files, headers not internal to the module, but specific to
-   testing code, are in a separate block at this point, paths relative to
-   ``src/``.
-9. Finally, |Gromacs| headers that are internal to the including module are
-   included using a relative path (but never with a path starting with ``../``;
-   such headers go into group 7 instead).  For test files, this group contains
-   headers that are internal to tests for that module.
+7. |Gromacs| headers that are not part of the including module.
+8. Public |Gromacs| headers that are part of the including module.
+9. Finally, |Gromacs| headers that are internal to the including module,
+   executable, or test target
+   (typically at the same path as the source file).
 
 All |Gromacs| headers are included with quotes (``"gromacs/utility/path.h"``),
 other headers with angle brackets (``<stdio.h>``).  Headers under ``src/external/``
@@ -48,20 +44,11 @@ is up to the author of the code to put the headers in proper order in such
 cases.  Trailing comments on the same line as #include statements are
 preserved and do not affect the checker/sorter.
 
-The includestyle used to differentiate between header files that were declared
-to be part of the module and not used outside the module, and those that were
-either not part of a module, used in other modules, or installed.
-As the possibility of installation has been removed (for now), changes to the
-previous organization might occur where such installed files were implicitly
-marked as being used outside of a module even though they were not used within
-|Gromacs| outside their module.
-
 As part of the effort to build a proper API, a new scheme of separating between
 public, library and module functionality in header files is planned.
-
-The guidelines are enforced by an automatic checker script that can also
-sort/reformat include statements to follow the guidelines.
-See :doc:`gmxtree` for details.
+See also :doc:`gmxtree` and
+`API restructuring issues <https://gitlab.com/gromacs/gromacs/-/issues?label_name%5B%5D=API+restructuring>`__
+for details.
 
 Enforcing a consistent order and style has a few advantages:
 
@@ -73,7 +60,7 @@ Enforcing a consistent order and style has a few advantages:
   first.  With this order, the person working on the header is most likely to
   see these problems instead of someone else seeing them later when
   refactoring unrelated code.
-* Consistent usage of paths in #include directives makes it easy to use
+* Consistent usage of paths in ``#include`` directives makes it easy to use
   ``grep`` to find all uses of a header, as well as all include dependencies
   between two modules.
 * An automatic script can be used to re-establish clean code after
index d713ea9b564995041de8233d033bf44b584f67fd..e9cc7b858ce89759830c8a50c75edbbf48e17480 100644 (file)
@@ -3,6 +3,7 @@ PROJECT_NAME           = @CMAKE_PROJECT_NAME@
 LAYOUT_FILE            = @CMAKE_CURRENT_SOURCE_DIR@/DoxygenLayout.xml
 INPUT                  = @CMAKE_CURRENT_SOURCE_DIR@ \
                          @CMAKE_SOURCE_DIR@/src \
+                         @CMAKE_SOURCE_DIR@/api/legacy/include \
                          @CMAKE_SOURCE_DIR@/share/template
 FILE_PATTERNS          = *.c *.cpp *.h *.md
 # CUDA files could be included like this, but currently produce a lot of
@@ -29,7 +30,10 @@ EXCLUDE_SYMBOLS       += TEST TEST_F TEST_P TYPED_TEST_CASE TYPED_TEST INSTANTIA
 EXCLUDE_SYMBOLS       += MOCK_METHOD* MOCK_CONST_METHOD*
 FULL_PATH_NAMES        = YES
 STRIP_FROM_PATH        = @CMAKE_SOURCE_DIR@
-STRIP_FROM_INC_PATH    = @CMAKE_SOURCE_DIR@/src
+STRIP_FROM_INC_PATH    = @CMAKE_SOURCE_DIR@/src \
+                         @CMAKE_SOURCE_DIR@/src/include \
+                         @CMAKE_SOURCE_DIR@/src/gromacs/*/include \
+                         @CMAKE_SOURCE_DIR@/api/legacy/include
 INCLUDE_PATH           = @CMAKE_SOURCE_DIR@/src
 HAVE_DOT               = @DOXYGEN_DOT_FOUND@
 DOT_PATH               = @DOXYGEN_DOT_PATH@
index 8790eb6a1780d01893a2ea9155232f71981193f5..b37ea833cb51ccc4072bc00307a34a6d4ddb1742 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2018,2019,2020, 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.
@@ -340,19 +340,22 @@ class ModuleDependencyGraph(object):
 
 def check_all(tree, reporter, check_ignored):
     """Do all checks for the GROMACS tree."""
-    includesorter = IncludeSorter()
-    for fileobj in tree.get_files():
-        if isinstance(fileobj, gmxtree.GeneratorSourceFile):
-            continue
-        check_file(fileobj, tree, reporter)
-        for includedfile in fileobj.get_includes():
-            check_include(fileobj, includedfile, reporter)
-        if fileobj.should_includes_be_sorted():
-            is_sorted, details = includesorter.check_sorted(fileobj)
-            if not is_sorted:
-                details.append("You can use includesorter.py to do the sorting automatically; see docs/dev-manual/gmxtree.rst")
-                reporter.code_issue(fileobj,
-                        "include style/order is not consistent; see docs/dev-manual/includestyle.rst", details)
+    # Include sorting is disabled pending resolution of
+    # https://gitlab.com/gromacs/gromacs/-/issues/3288 and
+    # https://gitlab.com/gromacs/gromacs/-/issues/3659
+    # includesorter = IncludeSorter()
+    # for fileobj in tree.get_files():
+    #     if isinstance(fileobj, gmxtree.GeneratorSourceFile):
+    #         continue
+    #     check_file(fileobj, tree, reporter)
+    #     for includedfile in fileobj.get_includes():
+    #         check_include(fileobj, includedfile, reporter)
+    #     if fileobj.should_includes_be_sorted():
+    #         is_sorted, details = includesorter.check_sorted(fileobj)
+    #         if not is_sorted:
+    #             details.append("You can use includesorter.py to do the sorting automatically; see docs/dev-manual/gmxtree.rst")
+    #             reporter.code_issue(fileobj,
+    #                     "include style/order is not consistent; see docs/dev-manual/includestyle.rst", details)
 
     for classobj in tree.get_classes():
         check_class(classobj, reporter)
index ad53e6cb201dafc4f4d59b59b8d05d9ab4fd1acf..2bbaeef3061357efa2731a5108db62c334aa9bc7 100644 (file)
@@ -16,7 +16,6 @@ nbnxm -> mdlib
 simd -> hardware
 gpu_utils -> hardware
 listed_forces -> mdlib
-utility -> math
 
 # modular simulator uses shellfc from mdrun, but is later included in mdrun by simulator builder
 modularsimulator -> mdrun
index a6538a629f163f194e75486586a409382fbb6cd7..c32d4efeeadcedf9f2ac8aca5ea8427286a1b889 100644 (file)
@@ -1,63 +1,71 @@
-# The script is currently a bit too eager
-share/template/template.cpp: error: source file documentation appears outside full documentation
-# The parser in the script is not clever enough
-src/gromacs/version.h: warning: includes local file as <gromacs/version.h>
-
-# These are OK
-src/gromacs/linearalgebra/eigensolver.cpp: warning: should include "config.h"
-src/gromacs/linearalgebra/gmx_arpack.cpp: warning: should include "config.h"
-src/gromacs/linearalgebra/gmx_blas/*: warning: does not include "gmxpre.h" first
-src/gromacs/linearalgebra/gmx_blas/*: warning: should include "config.h"
-src/gromacs/linearalgebra/gmx_lapack/*: warning: does not include "gmxpre.h" first
-src/gromacs/linearalgebra/gmx_lapack/*: warning: should include "config.h"
-src/gromacs/utility/baseversion-gen.cpp: warning: does not include "gmxpre.h" first
-
-# Exclude header files that are used for inlining code; the responsibility for
-# making the right #includes should be on the source file that uses these.
-# TODO: # Stop using the preprocessor for meta-programming!
-src/gromacs/ewald/pme_simd4.h: warning: should include "pme_simd.h"
-src/gromacs/ewald/pme_spline_work.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/ewald/pme_spline_work.h: warning: includes "simd.h" unnecessarily
-src/gromacs/ewald/pme_spread.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/nbnxm/boundingboxes.h: warning: includes "simd.h" unnecessarily
-src/gromacs/nbnxm/kernels_simd_2xmm/kernel_inner.h: warning: should include "simd.h"
-src/gromacs/nbnxm/kernels_simd_2xmm/kernel_outer.h: warning: should include "simd.h"
-src/gromacs/nbnxm/kernels_simd_4xm/kernel_inner.h: warning: should include "simd.h"
-src/gromacs/nbnxm/kernels_simd_4xm/kernel_outer.h: warning: should include "simd.h"
-src/gromacs/nbnxm/pairlist_simd_2xmm.h: warning: should include "simd.h"
-src/gromacs/nbnxm/pairlist_simd_4xm.h: warning: should include "simd.h"
-
-# This module name doesn't really fall into any currently used pattern; needs some thought
-: error: no matching directory for module: module_mdrun_integration_tests
-
-# These would be nice to fix, but can wait for later / deletion / rewrites
-src/gromacs/nbnxm/kernels_simd_2xmm/kernel_common.h: warning: should include "nbnxm_simd.h"
-src/gromacs/nbnxm/kernels_simd_4xm/kernel_common.h: warning: should include "nbnxm_simd.h"
-
 # This seems to be a false positive
 src/gromacs/nbnxm/cuda/nbnxm_cuda_types.h: error: NbnxmGpu: is in internal file(s), but appears in public documentation
 
+# doxygen has problems with the template construct in this file
+src/gromacs/modularsimulator/signallers.h: error: build: is documented, but does not have brief description
+
 # False positive caused by forward-declaration of BasicVector in src/testutils/refdata.h
-src/gromacs/math/vectypes.h: error: gmx::BasicVector: is in library file(s), but appears in public documentation
+src/testutils/refdata.h: error: gmx::BasicVector: is in library file(s), but appears in public documentation
 
-# Temporary while we change the SIMD implementation
-src/gromacs/simd/impl_sparc64_hpc_ace/impl_sparc64_hpc_ace_common.h: warning: should include "simd.h"
+#
+# All following suppressions are disabled while the include checker
+# is temporarily disabled pending resolution of
+# https://gitlab.com/gromacs/gromacs/-/issues/3288 and
+# https://gitlab.com/gromacs/gromacs/-/issues/3659
+#
 
-src/gromacs/simd/tests/scalar.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/simd/tests/scalar_math.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/simd/tests/scalar_util.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/tables/cubicsplinetable.h: warning: includes "simd.h" unnecessarily
-src/gromacs/tables/quadraticsplinetable.h: warning: includes "simd.h" unnecessarily
+# # The script is currently a bit too eager
+# share/template/template.cpp: error: source file documentation appears outside full documentation
+# # The parser in the script is not clever enough
+# src/gromacs/version.h: warning: includes local file as <gromacs/version.h>
 
-# These are specific to Folding@Home, and easiest to suppress here
-src/gmxpre.h: warning: includes non-local file as "swindirect.h"
+# # These are OK
+# src/gromacs/linearalgebra/eigensolver.cpp: warning: should include "config.h"
+# src/gromacs/linearalgebra/gmx_arpack.cpp: warning: should include "config.h"
+# src/gromacs/linearalgebra/gmx_blas/*: warning: does not include "gmxpre.h" first
+# src/gromacs/linearalgebra/gmx_blas/*: warning: should include "config.h"
+# src/gromacs/linearalgebra/gmx_lapack/*: warning: does not include "gmxpre.h" first
+# src/gromacs/linearalgebra/gmx_lapack/*: warning: should include "config.h"
+# src/gromacs/utility/baseversion-gen.cpp: warning: does not include "gmxpre.h" first
 
-# New external API (see https://gitlab.com/gromacs/gromacs/-/issues/2586) has some unresolved
-# conflicts with previous definitions of public API, installed API, and other things
-# described or implemented in check-source.py, gmxtree.py, gmxtree.rst, and others
-# TODO: resolve definitions, update testing heuristics, and activate policy checks
-# for src/api/cpp files.
-src/api/cpp/*: *
+# # Exclude header files that are used for inlining code; the responsibility for
+# # making the right #includes should be on the source file that uses these.
+# # TODO: # Stop using the preprocessor for meta-programming!
+# src/gromacs/ewald/pme_simd4.h: warning: should include "pme_simd.h"
+# src/gromacs/ewald/pme_spline_work.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/ewald/pme_spline_work.h: warning: includes "simd.h" unnecessarily
+# src/gromacs/ewald/pme_spread.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/nbnxm/boundingboxes.h: warning: includes "simd.h" unnecessarily
+# src/gromacs/nbnxm/kernels_simd_2xmm/kernel_inner.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/kernels_simd_2xmm/kernel_outer.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/kernels_simd_4xm/kernel_inner.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/kernels_simd_4xm/kernel_outer.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/pairlist_simd_2xmm.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/pairlist_simd_4xm.h: warning: should include "simd.h"
 
-# doxygen has problems with the template construct in this file
-src/gromacs/modularsimulator/signallers.h: error: build: is documented, but does not have brief description
+# # This module name doesn't really fall into any currently used pattern; needs some thought
+# : error: no matching directory for module: module_mdrun_integration_tests
+
+# # These would be nice to fix, but can wait for later / deletion / rewrites
+# src/gromacs/nbnxm/kernels_simd_2xmm/kernel_common.h: warning: should include "nbnxm_simd.h"
+# src/gromacs/nbnxm/kernels_simd_4xm/kernel_common.h: warning: should include "nbnxm_simd.h"
+
+
+# # Temporary while we change the SIMD implementation
+# src/gromacs/simd/impl_sparc64_hpc_ace/impl_sparc64_hpc_ace_common.h: warning: should include "simd.h"
+
+# src/gromacs/simd/tests/scalar.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/simd/tests/scalar_math.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/simd/tests/scalar_util.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/tables/cubicsplinetable.h: warning: includes "simd.h" unnecessarily
+# src/gromacs/tables/quadraticsplinetable.h: warning: includes "simd.h" unnecessarily
+
+# # These are specific to Folding@Home, and easiest to suppress here
+# src/gmxpre.h: warning: includes non-local file as "swindirect.h"
+
+# # New external API (see https://gitlab.com/gromacs/gromacs/-/issues/2586) has some unresolved
+# # conflicts with previous definitions of public API, installed API, and other things
+# # described or implemented in check-source.py, gmxtree.py, gmxtree.rst, and others
+# # TODO: resolve definitions, update testing heuristics, and activate policy checks
+# # for src/api/cpp files.
+# src/api/cpp/*: *
index 9fac443fd75ae37d22d40b062cb347e9410130e1..6e70fb46df5217e761c03ec0c2655b5f5a86d519 100644 (file)
@@ -20,4 +20,4 @@ set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES SKIP_BUILD_R
 # If building with setuptools, CMake will not be performing the install
 set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
 
-target_link_libraries(gmxapi_extension_ensemblepotential PRIVATE Gromacs::gmxapi)
+target_link_libraries(gmxapi_extension_ensemblepotential PUBLIC Gromacs::libgromacs Gromacs::gmxapi)
index 3cc6a2dbad0e3835225fe998aca8c9001fbb56fd..0952396d334cb0c46e940e691be9f8066f661337 100644 (file)
@@ -97,7 +97,7 @@ configure_file(testingconfiguration.in.h testingconfiguration.h)
 add_executable(gmxapi_extension_library-test test_binding.cpp)
 add_dependencies(gmxapi_extension_library-test gmxapi_extension_spc2_water_box)
 target_include_directories(gmxapi_extension_library-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(gmxapi_extension_library-test Gromacs::gmxapi GTest::Main)
+target_link_libraries(gmxapi_extension_library-test Gromacs::libgromacs Gromacs::gmxapi GTest::Main)
 gtest_add_tests(TARGET gmxapi_extension_library-test
                 TEST_LIST BasicPlugin)
 
index 00eb3031520203f061c5de9289c1eb4d50013535..e99890ac99807bb710f7794a6d31478ce3c811fd 100644 (file)
@@ -142,10 +142,8 @@ if (WIN32)
 endif()
 list(APPEND libgromacs_object_library_dependencies thread_mpi)
 
-configure_file(version.h.cmakein version.h)
 if(GMX_INSTALL_LEGACY_API)
   install(FILES
-          ${CMAKE_CURRENT_BINARY_DIR}/version.h
          analysisdata.h
          options.h
          selection.h
@@ -321,6 +319,8 @@ target_link_libraries(libgromacs
                       PUBLIC
                       ${GMX_PUBLIC_LIBRARIES}
                       )
+target_link_libraries(libgromacs PUBLIC legacy_api)
+
 if (GMX_OPENMP)
     target_link_libraries(libgromacs PUBLIC OpenMP::OpenMP_CXX)
 endif()
@@ -380,6 +380,7 @@ endif()
 
 # Only install the library in mdrun-only mode if it is actually necessary
 # for the binary
+# TODO: Stop installing libgromacs. Possibly allow installation during deprecation period with GMX_INSTALL_LEGACY_API.
 if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
     install(TARGETS libgromacs
             EXPORT libgromacs
@@ -398,8 +399,8 @@ if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
     if(GMX_INSTALL_LEGACY_API)
         target_compile_features(libgromacs INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
     endif()
-    add_library(Gromacs::libgromacs ALIAS libgromacs)
 endif()
+add_library(Gromacs::libgromacs ALIAS libgromacs)
 
 if (NOT GMX_BUILD_MDRUN_ONLY)
     include(InstallLibInfo.cmake)
index bcecb7340e7f0ca17cbf22adf1a96d2eb4d4371f..c55d59b055fcc4e6247ccc1ceb8f7b86923d40c3 100644 (file)
@@ -35,6 +35,7 @@
 gmx_add_unit_test_library(analysisdata-test-shared
                           datatest.cpp
                           mock_datamodule.cpp)
+target_link_libraries(analysisdata-test-shared PRIVATE legacy_api)
 
 gmx_add_unit_test(AnalysisDataUnitTests analysisdata-test
     CPP_SOURCE_FILES
index f0e81bb03cd50c4434b9afc32eaf3138b0fd7053..3738f1d2ad12281ae58ad62372d529bc4a343428 100644 (file)
@@ -49,17 +49,6 @@ endif()
 
 target_sources(libgromacs PRIVATE ${FILEIO_SOURCES})
 
-if(GMX_INSTALL_LEGACY_API)
-  install(FILES
-          oenv.h
-         confio.h
-          pdbio.h
-          tpxio.h
-          trxio.h
-         filetypes.h
-          DESTINATION include/gromacs/fileio)
-endif()
-
 if (BUILD_TESTING)
      add_subdirectory(tests)
 endif()
index 7114d54c6d7e56862080fd25fcaaddc440d98e1b..3b52aadf1c217d5fe90ad2e8ee475040b80cea33 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "confio.h"
+#include "gromacs/fileio/confio.h"
 
 #include <cstdio>
 #include <cstring>
index 6729446ecd33dc47f4bdba90956301823a41bda5..9cc48d08a4240658858666e2ccdfa99e401fa2ee 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "filetypes.h"
+#include "gromacs/fileio/filetypes.h"
 
 #include <cstring>
 
index 0c99fa191a521704831fc02f86b81c540e23b968..e51c52ccc1b525eb2d935828d8b8e29d067c377b 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "oenv.h"
+#include "gromacs/fileio/oenv.h"
 
 #include "gromacs/utility/enumerationhelpers.h"
 #include "gromacs/utility/exceptions.h"
index f551dde39129a3e06e80fd3f854f0325377f421b..c3f6810bcbca812089508caa5719ca586a6399a9 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "pdbio.h"
+#include "gromacs/fileio/pdbio.h"
 
 #include <cctype>
 #include <cmath>
index 5017b67f4c53d98e9e17ce20f8ab08888da68dbf..6b9186057719abb2861b35f147389d500b118b93 100644 (file)
@@ -48,3 +48,4 @@ gmx_add_unit_test(FileIOTests fileio-test
         ${tng_sources}
         xvgio.cpp
     )
+target_link_libraries(fileio-test PRIVATE legacy_api)
index 9ea2337f86727f243dca4cff6997fe0b5e13d248..b72e66cf2acee6f6a92015b8926e0286ff96ec02 100644 (file)
@@ -39,7 +39,7 @@
 
 /* This file is completely threadsafe - keep it that way! */
 
-#include "tpxio.h"
+#include "gromacs/fileio/tpxio.h"
 
 #include <cstdio>
 #include <cstdlib>
index 4c0ab0c09ca8794ec055ab1fc288bac34be96f64..75c7ac1037e986db0cfed86c1cf40e8a27b4d03d 100644 (file)
@@ -47,6 +47,10 @@ set(LINEARALGEBRA_SOURCES
     ${LINEARALGEBRA_SOURCES} ${BLAS_SOURCES} ${LAPACK_SOURCES})
 
 add_library(linearalgebra OBJECT ${LINEARALGEBRA_SOURCES})
+target_include_directories(linearalgebra PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+# TODO: Only expose the module's public headers.
+target_include_directories(linearalgebra INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+
 gmx_target_compile_options(linearalgebra)
 target_compile_definitions(linearalgebra PRIVATE HAVE_CONFIG_H)
 # The linearalgebra code is all considered external, and we will
@@ -62,5 +66,6 @@ else()
     # not expect null termination of C strings.
     gmx_target_warning_suppression(linearalgebra -Wno-stringop-truncation HAS_NO_STRINGOP_TRUNCATION)
 endif()
+target_link_libraries(linearalgebra PRIVATE legacy_api)
 list(APPEND libgromacs_object_library_dependencies linearalgebra)
 set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
index 16d6ccd7408227be68d04e515f169c1a4d290314..a879d44e2e34d86b4c1c75ecb0a4d097d368a7cf 100644 (file)
 file(GLOB MATH_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${MATH_SOURCES} PARENT_SCOPE)
 
-# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/988) Find a new convention for defining public API.
-install(FILES
-       do_fit.h
-       functions.h
-       units.h
-       utilities.h
-       vec.h
-        vectypes.h
-        DESTINATION include/gromacs/math)
-
-if(GMX_INSTALL_LEGACY_API)
-  install(FILES
-         do_fit.h
-         units.h
-         utilities.h
-          DESTINATION include/gromacs/math)
-endif()
-
-
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index b8be02f06dbc903616c8643ef6e2a9209a7bcc7a..d214c9b689f4ebc4cc7e805f8f11fa69b72ca1b5 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "do_fit.h"
+#include "gromacs/math/do_fit.h"
 
 #include <cmath>
 #include <cstdio>
index 2cd3e3280a82a23ff8371ade0c91b0aaa7e55ba8..db8b99db426c8122d939c6a96ce356f304cfba1e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2019,2020, 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,7 +44,7 @@
 
 #include "gmxpre.h"
 
-#include "functions.h"
+#include "gromacs/math/functions.h"
 
 #include "config.h"
 
index 6881111e60613897049147da154d70721519a11c..883e74d15197cf010681e76014cded7691d905fc 100644 (file)
@@ -35,7 +35,7 @@
  */
 #include "gmxpre.h"
 
-#include "units.h"
+#include "gromacs/math/units.h"
 
 #include <cstdio>
 
index 3412f2c47208c4a6d591875ff40de9dab8e75e53..067cc32b25b81476635397f0a0bba91371a8c210 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "utilities.h"
+#include "gromacs/math/utilities.h"
 
 #include "config.h"
 
index e538b8ffeddf3529ba31202757571cc24022d46f..1a95671662ce36728d8131a7dea049d445360f6d 100644 (file)
@@ -34,6 +34,7 @@
 
 gmx_add_unit_test_library(mdrunutility-test-shared
                           threadaffinitytest.cpp)
+target_link_libraries(mdrunutility-test-shared PUBLIC legacy_api)
 
 gmx_add_unit_test(MdrunUtilityUnitTests mdrunutility-test
     CPP_SOURCE_FILES
index ac50973e41ceb9cd2278ad4afb69a58d2050a519..30614ffac87ece02862f1a4f137d244fc2439e10 100644 (file)
@@ -40,6 +40,7 @@ gmx_target_compile_options(modularsimulator)
 target_compile_definitions(modularsimulator PRIVATE HAVE_CONFIG_H)
 # Should be possible to remove this when resolving #3290
 target_include_directories(modularsimulator SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+target_link_libraries(modularsimulator PRIVATE legacy_api)
 
 if(GMX_OPENMP)
     # Explicitly set properties for modular simulator module to compile with openmp
index 06a082e57fdd4005f2d62ec91472474fc2bd5405..d1bc6a3e80073d5898271e5acde28f4ff8db8327 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2017,2018,2019,2020, 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,8 +37,6 @@ gmx_add_libgromacs_sources(
     manager.cpp
     restraintmdmodule.cpp
     )
-# TODO this is a hacky way to expose things for the API and needs to be changed to something proper
-install(FILES restraintpotential.h DESTINATION include/gromacs/restraint)
 
 if (BUILD_TESTING)
     add_subdirectory(tests)
index e621fa58813b9033bb42c1d709a304e2ffe9c414..a0c5e11170737a368f2367866807944b9a8d09cc 100644 (file)
@@ -56,6 +56,8 @@ else()
     gmx_target_warning_suppression(scanner -Wno-missing-declarations HAS_NO_MISSING_DECLARATIONS)
     gmx_target_warning_suppression(scanner -Wno-null-conversion HAS_NO_NULL_CONVERSIONS)
 endif()
+target_link_libraries(scanner PRIVATE legacy_api)
+
 list(APPEND libgromacs_object_library_dependencies scanner)
 set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
 
index 93e82808cde05fa4fe50da929ba1f9a2f8eb29b3..d4d9c0a5e31a13051321dc8a9a6f3959cc81488c 100644 (file)
@@ -39,22 +39,11 @@ if (GMX_GPU_CUDA)
 endif()
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
 
-# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/988) Find a new convention for defining public API.
-install(FILES
-        basedefinitions.h
-        current_function.h
-        gmxassert.h
-        real.h
-        DESTINATION include/gromacs/utility)
-
 if(GMX_INSTALL_LEGACY_API)
   install(FILES
-          arrayref.h
           baseversion.h
           classhelpers.h
           enumerationhelpers.h
-          exceptions.h
-          listoflists.h
          fileptr.h
          futil.h
          flags.h
index 84e57940a50f43b119e119d514588507e31a274e..784cf34b250af31a72a9f86641773dc011d34cd5 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "exceptions.h"
+#include "gromacs/utility/exceptions.h"
 
 #include <cstring>
 
index e0d06d56ab3a9de92772d25c22391bf7c43490df..b75f5a81a33fbf980087cf0ba3a5752b03033cd0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2014,2015,2019,2020, 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.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "gmxassert.h"
+#include "gromacs/utility/gmxassert.h"
 
 #include <cstdio>
 #include <cstdlib>
index 6a336db5d324494316472f78d2916af6c65112d1..29da4ea35f3ae885aa435570e9f38cc895632c5a 100644 (file)
@@ -41,13 +41,14 @@ target_compile_definitions(mdrun_objlib PRIVATE HAVE_CONFIG_H)
 target_include_directories(mdrun_objlib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
 # Should be possible to remove this when resolving #3290
 target_include_directories(mdrun_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+target_link_libraries(mdrun_objlib PRIVATE legacy_api)
 
 if(GMX_FAHCORE)
     # The lack of a real source file here alongside the object library
     # may break some generators, according to CMake documentation. If
     # so, we can consider adding some dummy file to make it work.
     add_library(fahcore $<TARGET_OBJECTS:mdrun_objlib>)
-    target_link_libraries(fahcore PRIVATE ${GMX_COMMON_LIBRARIES})
+    target_link_libraries(fahcore PRIVATE ${GMX_COMMON_LIBRARIES} legacy_api)
 elseif(GMX_BUILD_MDRUN_ONLY)
     add_executable(mdrun $<TARGET_OBJECTS:mdrun_objlib> mdrun_main.cpp)
     gmx_target_compile_options(mdrun)
@@ -74,7 +75,9 @@ else()
     gmx_target_compile_options(view_objlib)
     target_compile_definitions(view_objlib PRIVATE HAVE_CONFIG_H)
     target_include_directories(view_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+    target_link_libraries(view_objlib PRIVATE legacy_api)
     add_library(gmx_objlib OBJECT ${GMX_MAIN_SOURCES})
+    target_link_libraries(gmx_objlib PRIVATE legacy_api)
     target_include_directories(gmx_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
     add_executable(gmx
         $<TARGET_OBJECTS:gmx_objlib>
@@ -83,9 +86,10 @@ else()
     add_executable(Gromacs::gmx ALIAS gmx)
     gmx_target_compile_options(gmx)
     target_compile_definitions(gmx PRIVATE HAVE_CONFIG_H)
-    target_link_libraries(gmx libgromacs
-        ${GMX_COMMON_LIBRARIES}
-        ${GMX_EXE_LINKER_FLAGS})
+    target_link_libraries(gmx PRIVATE
+                          libgromacs
+                          ${GMX_COMMON_LIBRARIES}
+                          ${GMX_EXE_LINKER_FLAGS})
     if(GMX_X11)
         target_link_libraries(gmx ${X11_LIBRARIES})
     endif()
index b051068c0670184835bd4dda10d283a2b7e00d10..7c0a67a76338a2a80a11f88ced44d27e30d29148 100644 (file)
@@ -47,6 +47,7 @@ gmx_add_unit_test_library(mdrun_test_infrastructure
     $<TARGET_OBJECTS:mdrun_objlib>
     )
 target_include_directories(mdrun_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+target_link_libraries(mdrun_test_infrastructure PUBLIC legacy_api)
 
 # To avoid running into test timeouts, some end-to-end tests of mdrun
 # functionality are split off. This can be rearranged in future as we
index 5e1c1ad329c173fa377735a5a20d4c2501716197..3dd632ef550fa8c4d3ed269e4d0c012b3a129817 100644 (file)
@@ -81,6 +81,8 @@ if (GMX_GPU_CUDA)
 else()
     add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS} ${TESTUTILS_SOURCES})
 endif()
+# TODO: Use a non-degenerate interface include directory.
+target_include_directories(testutils PUBLIC ${CMAKE_SOURCE_DIR}/src)
 
 if (GMX_GPU_SYCL)
     set_source_files_properties(test_device.cpp