libgromacs CMake source file management cleanup
authorTeemu Murtola <teemu.murtola@gmail.com>
Mon, 30 Nov 2015 10:23:03 +0000 (12:23 +0200)
committerTeemu Murtola <teemu.murtola@gmail.com>
Mon, 30 Nov 2015 10:23:03 +0000 (12:23 +0200)
- Remove obsolete globbing for *.c files.
- Do not install anything remaining in legacyheaders/, which makes it
  possible to remove the whole CMakeLists.txt files from there.
- Add gmx_add_libgromacs_sources() as an alternative to globbing, and
  use it in places where we were only using the globbing to get full
  paths (so that they work where we want).

Change-Id: I654b84b6f48b7991faa3d7a349d5118be932493d

src/gromacs/CMakeLists.txt
src/gromacs/fft/CMakeLists.txt
src/gromacs/fileio/CMakeLists.txt
src/gromacs/gmxana/CMakeLists.txt
src/gromacs/gmxlib/CMakeLists.txt
src/gromacs/hardware/CMakeLists.txt
src/gromacs/legacyheaders/CMakeLists.txt [deleted file]
src/gromacs/legacyheaders/types/CMakeLists.txt [deleted file]
src/gromacs/trajectoryanalysis/CMakeLists.txt
src/gromacs/utility/CMakeLists.txt

index 2eae73b7ad6f69cbc188f804d3102ed8de095314..7cf2c5d4d560784ab2bfed7d9b481e0be0c0a535 100644 (file)
 
 set(LIBGROMACS_SOURCES)
 
+set_property(GLOBAL PROPERTY GMX_LIBGROMACS_SOURCES)
 set_property(GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
 
+function (_gmx_add_files_to_property PROPERTY)
+    foreach (_file ${ARGN})
+        if (IS_ABSOLUTE "${_file}")
+            set_property(GLOBAL APPEND PROPERTY ${PROPERTY} ${_file})
+        else()
+            set_property(GLOBAL APPEND PROPERTY ${PROPERTY}
+                         ${CMAKE_CURRENT_LIST_DIR}/${_file})
+        endif()
+    endforeach()
+endfunction ()
+
+function (gmx_add_libgromacs_sources)
+    _gmx_add_files_to_property(GMX_LIBGROMACS_SOURCES ${ARGN})
+endfunction ()
+
 function (gmx_install_headers)
     if (NOT GMX_BUILD_MDRUN_ONLY)
         file(RELATIVE_PATH _dest ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_LIST_DIR})
@@ -43,14 +59,7 @@ function (gmx_install_headers)
                 DESTINATION "${INCL_INSTALL_DIR}/${_dest}"
                 COMPONENT   development)
     endif()
-    foreach (_file ${ARGN})
-        if (IS_ABSOLUTE "${_file}")
-            set_property(GLOBAL APPEND PROPERTY GMX_INSTALLED_HEADERS ${_file})
-        else()
-            set_property(GLOBAL APPEND PROPERTY GMX_INSTALLED_HEADERS
-                         ${CMAKE_CURRENT_LIST_DIR}/${_file})
-        endif()
-    endforeach()
+    _gmx_add_files_to_property(GMX_INSTALLED_HEADERS ${ARGN})
 endfunction ()
 
 function (gmx_write_installed_header_list)
@@ -116,7 +125,6 @@ add_subdirectory(pulling)
 add_subdirectory(simd)
 add_subdirectory(imd)
 if (NOT GMX_BUILD_MDRUN_ONLY)
-    add_subdirectory(legacyheaders)
     add_subdirectory(gmxana)
     add_subdirectory(gmxpreprocess)
     add_subdirectory(correlationfunctions)
@@ -127,7 +135,8 @@ if (NOT GMX_BUILD_MDRUN_ONLY)
     add_subdirectory(tools)
 endif()
 
-list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES})
+get_property(PROPERTY_SOURCES GLOBAL PROPERTY GMX_LIBGROMACS_SOURCES)
+list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES} ${PROPERTY_SOURCES})
 
 # This would be the standard way to include thread_mpi, but
 # we want libgromacs to link the functions directly
@@ -170,9 +179,7 @@ endif()
 # Recent versions of gcc and clang give warnings on scanner.cpp, which
 # is a generated source file. These are awkward to suppress inline, so
 # we do it in the compilation command (after testing that the compiler
-# supports the suppressions). Setting the properties only works after
-# the related target has been created, e.g. after when the file is
-# used with add_library().
+# supports the suppressions).
 include(CheckCXXCompilerFlag)
 check_cxx_compiler_flag(-Wno-unused-parameter HAS_NO_UNUSED_PARAMETER)
 if (HAS_NO_UNUSED_PARAMETER)
index 60d6402d863b16b7fbe6aed14e51aa63e4016c69..a01d3918c7010082a8f3c4b18aba0112759c3430 100644 (file)
@@ -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.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-# GLOB is used to get full paths
-file(GLOB FFT_SOURCES
-     fft.cpp fft5d.cpp parallel_3dfft.cpp)
+gmx_add_libgromacs_sources(
+     fft.cpp
+     fft5d.cpp
+     parallel_3dfft.cpp
+     )
 
 if (GMX_FFT_FFTPACK)
-    file(GLOB FFT_SPECIFIC_SOURCES fft_fftpack.cpp)
-    list(APPEND FFT_SPECIFIC_SOURCES
-         ${CMAKE_SOURCE_DIR}/src/external/fftpack/fftpack.c)
+    gmx_add_libgromacs_sources(
+        fft_fftpack.cpp
+        ${CMAKE_SOURCE_DIR}/src/external/fftpack/fftpack.c)
 endif()
 if (GMX_FFT_FFTW3)
-    file(GLOB FFT_SPECIFIC_SOURCES fft_fftw3.cpp)
+    gmx_add_libgromacs_sources(fft_fftw3.cpp)
 endif()
 if (GMX_FFT_MKL)
-    file(GLOB FFT_SPECIFIC_SOURCES fft_mkl.cpp)
+    gmx_add_libgromacs_sources(fft_mkl.cpp)
 endif()
 
-set(LIBGROMACS_SOURCES
-    ${LIBGROMACS_SOURCES} ${FFT_SOURCES} ${FFT_SPECIFIC_SOURCES} PARENT_SCOPE)
-
 gmx_install_headers(fft.h)
 
 if (BUILD_TESTING)
index e29292e85deae7b5a9a81608065d6d603765fb56..bcc0d1249247b0c63990790630a2613941c29877 100644 (file)
@@ -32,7 +32,7 @@
 # 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(GLOB FILEIO_SOURCES *.cpp *.c)
+file(GLOB FILEIO_SOURCES *.cpp)
 
 if(GMX_USE_PLUGINS)
   set(FILEIO_SOURCES ${FILEIO_SOURCES} ${CMAKE_SOURCE_DIR}/src/external/vmd_molfile/vmddlopen.c)
index 19772897542846ae9505d66fffe081a59a3449fd..c53ff6f4e61ea99bb793f5a58c4e9e542d55c244 100644 (file)
@@ -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.
@@ -32,7 +32,7 @@
 # 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(GLOB GMXANA_SOURCES *.c *.cpp)
+file(GLOB GMXANA_SOURCES *.cpp)
 
 gmx_install_headers(
     gstat.h
index 1f976b04e61988f7813058d71124ffb1acf76136..4f0d313ea89639d4d447424105208564a1381378 100644 (file)
@@ -38,7 +38,7 @@ add_subdirectory(nonbonded)
 
 # The nonbonded directory contains subdirectories that are only
 # conditionally built, so we cannot use a GLOB_RECURSE here.
-file(GLOB GMXLIB_SOURCES *.c *.cpp)
+file(GLOB GMXLIB_SOURCES *.cpp)
 
 # gpu utils + cuda tools module
 if(GMX_GPU)
index 07f2877cec8ec7fa597a1f74ece8f25efae8f862..67c34ffa8f3f6a11df96f7a4e381953bad54354c 100644 (file)
 # 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(GLOB HARDWARE_SOURCES hardwaretopology.cpp cpuinfo.cpp)
-set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${HARDWARE_SOURCES} PARENT_SCOPE)
+gmx_add_libgromacs_sources(
+    cpuinfo.cpp
+    hardwaretopology.cpp
+    )
 
 if (BUILD_TESTING)
     add_subdirectory(tests)
diff --git a/src/gromacs/legacyheaders/CMakeLists.txt b/src/gromacs/legacyheaders/CMakeLists.txt
deleted file mode 100644 (file)
index d9a8515..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# This file is part of the GROMACS molecular simulation package.
-#
-# Copyright (c) 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.
-#
-# 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.
-
-# includes: Nothing to build, just installation
-file(GLOB HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
-gmx_install_headers(${HEADERS})
-
-add_subdirectory(types)
diff --git a/src/gromacs/legacyheaders/types/CMakeLists.txt b/src/gromacs/legacyheaders/types/CMakeLists.txt
deleted file mode 100644 (file)
index ee38c56..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# This file is part of the GROMACS molecular simulation package.
-#
-# Copyright (c) 2014, 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.
-
-# includes: Nothing to build, just installation
-file(GLOB HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
-list(REMOVE_ITEM HEADERS commrec.h)
-gmx_install_headers(${HEADERS})
index a60b69a9241c917c179d4e24c7dc767fd7acc8cb..037a96483882f55f3808ff954141a62b14a69d46 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2010,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.
@@ -32,7 +32,7 @@
 # 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(GLOB TRAJECTORYANALYSIS_SOURCES *.cpp modules/*.cpp modules/*.c)
+file(GLOB TRAJECTORYANALYSIS_SOURCES *.cpp modules/*.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TRAJECTORYANALYSIS_SOURCES} PARENT_SCOPE)
 
 gmx_install_headers(
index c4cf228bf186599a05e0a7c2e4e9ade922de34fd..11e3e33b886d302547db302e6f93054755b87136 100644 (file)
@@ -32,7 +32,7 @@
 # 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(GLOB UTILITY_SOURCES *.c *.cpp)
+file(GLOB UTILITY_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
 
 gmx_install_headers(