set(USE_PYTHON_SCRIPTS ON)
endif()
-# Create a stamp file whenever cmake is run, as the list of installed files may
-# have changed.
-gmx_get_stamp_filename(configure_stamp_file cmake-configure)
-file(WRITE ${configure_stamp_file} "Timestamp for configuration")
# Note that if you relocate this file, you also need to change gmxtree.py.
-set(INSTALLED_HEADERS_FILE ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt)
-gmx_add_custom_output_target(find-installed-headers
- OUTPUT ${INSTALLED_HEADERS_FILE}
- COMMAND ${CMAKE_COMMAND}
- -D SRCDIR=${CMAKE_SOURCE_DIR}
- -D BUILDDIR=${CMAKE_BINARY_DIR}
- -D OUTFILE=${INSTALLED_HEADERS_FILE}
- -P ${CMAKE_CURRENT_SOURCE_DIR}/getInstalledHeaders.cmake
- DEPENDS ${configure_stamp_file}
- COMMENT "Generating installed headers list")
+# TODO: Try to find a solution where this would be hard-coded here, completely
+# separate from the logic that generates it.
+set(INSTALLED_HEADERS_FILE ${PROJECT_BINARY_DIR}/src/gromacs/installed-headers.txt)
########################################################################
# Doxygen configuration
-S ${CMAKE_SOURCE_DIR} -B ${CMAKE_BINARY_DIR}
--ignore-cycles ${CMAKE_CURRENT_SOURCE_DIR}/cycle-suppressions.txt
-o ${DEPGRAPH_DIR}
- DEPENDS doc-xml find-installed-headers
+ DEPENDS doc-xml ${INSTALLED_HEADER_FILE}
${CMAKE_CURRENT_SOURCE_DIR}/doxygenxml.py
${CMAKE_CURRENT_SOURCE_DIR}/gmxtree.py
${CMAKE_CURRENT_SOURCE_DIR}/graphbuilder.py
${CMAKE_CURRENT_SOURCE_DIR}/cycle-suppressions.txt
COMMENT "Generating include dependency graphs for dot")
- add_dependencies(dep-graphs-dot-fast find-installed-headers)
# Add separate targets for converting the .dot files to .png.
# These are not needed by the Doxygen targets, but are useful for
COMMENT "Checking Doxygen documentation" VERBATIM)
add_custom_target(doc-check-fast COMMAND ${doc_check_command}
COMMENT "Checking Doxygen documentation" VERBATIM)
- add_dependencies(doc-check doc-xml find-installed-headers)
- add_dependencies(doc-check-fast find-installed-headers)
+ add_dependencies(doc-check doc-xml)
endif()
endif()
.gitattributes for all the files.
load_installed_file_list() can be called to load the list of installed
- files from the build tree (generated by the find-installed-headers target).
+ files from the build tree (generated by CMake).
scan_files() can be called to read all the files and initialize #include
dependencies between the files based on the information. This is done like
def load_installed_file_list(self):
"""Load list of installed files from the build tree."""
- listpath = os.path.join(self._build_root, 'docs', 'doxygen', 'installed-headers.txt')
+ listpath = os.path.join(self._build_root, 'src', 'gromacs', 'installed-headers.txt')
with open(listpath, 'r') as installedfp:
for line in installedfp:
path = line.strip()
set(LIBGROMACS_SOURCES)
-function (gmx_install_headers DESTINATION)
+set_property(GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
+
+function (gmx_install_headers)
if (NOT GMX_BUILD_MDRUN_ONLY)
- if (DESTINATION)
- set(DESTINATION ${INCL_INSTALL_DIR}/gromacs/${DESTINATION})
+ file(RELATIVE_PATH _dest ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_LIST_DIR})
+ install(FILES ${ARGN}
+ 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(DESTINATION ${INCL_INSTALL_DIR}/gromacs)
+ set_property(GLOBAL APPEND PROPERTY GMX_INSTALLED_HEADERS
+ ${CMAKE_CURRENT_LIST_DIR}/${_file})
endif()
- install(FILES ${ARGN} DESTINATION ${DESTINATION} COMPONENT development)
- endif()
+ endforeach()
endfunction ()
+function (gmx_write_installed_header_list)
+ get_property(_list GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
+ string(REPLACE ";" "\n" _list "${_list}")
+ # TODO: Make this only update the file timestamp if the contents actually change.
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt "${_list}")
+endfunction()
+
if(GMX_USE_TNG)
option(GMX_EXTERNAL_TNG "Use external TNG instead of compiling the version shipped with GROMACS."
OFF)
tmpi_get_source_list(THREAD_MPI_SOURCES ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/src)
list(APPEND LIBGROMACS_SOURCES ${THREAD_MPI_SOURCES})
-set(LIBGROMACS_HEADERS
+configure_file(version.h.cmakein version.h)
+gmx_install_headers(
analysisdata.h
commandline.h
options.h
selection.h
trajectoryanalysis.h
- utility.h)
-configure_file(version.h.cmakein version.h)
-gmx_install_headers("" ${LIBGROMACS_HEADERS})
-gmx_install_headers("" ${CMAKE_CURRENT_BINARY_DIR}/version.h)
+ utility.h
+ ${CMAKE_CURRENT_BINARY_DIR}/version.h
+ )
# This code is here instead of utility/CMakeLists.txt, because CMake
# custom commands and source file properties can only be set in the directory
VERSION ${LIBRARY_VERSION}
COMPILE_FLAGS "${OpenMP_C_FLAGS}")
+gmx_write_installed_header_list()
+
# Only install the library in mdrun-only mode if it is actually necessary
# for the binary
if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
file(GLOB ANALYSISDATA_SOURCES *.cpp modules/*.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ANALYSISDATA_SOURCES} PARENT_SCOPE)
-set(ANALYSISDATA_PUBLIC_HEADERS
+gmx_install_headers(
abstractdata.h
analysisdata.h
arraydata.h
dataframe.h
- datamodule.h)
-gmx_install_headers(analysisdata ${ANALYSISDATA_PUBLIC_HEADERS})
+ datamodule.h
+ )
add_subdirectory(modules)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2013, by the GROMACS development team, led by
+# Copyright (c) 2010,2013,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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-set(ANALYSISDATA_MODULES_PUBLIC_HEADERS
+gmx_install_headers(
average.h
displacement.h
histogram.h
lifetime.h
- plot.h)
-gmx_install_headers(analysisdata/modules ${ANALYSISDATA_MODULES_PUBLIC_HEADERS})
+ plot.h
+ )
file(GLOB COMMANDLINE_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${COMMANDLINE_SOURCES} PARENT_SCOPE)
-set(COMMANDLINE_PUBLIC_HEADERS
+gmx_install_headers(
cmdlinehelpwriter.h
cmdlineinit.h
cmdlinemodule.h
cmdlineparser.h
cmdlineprogramcontext.h
- pargs.h)
-gmx_install_headers(commandline ${COMMANDLINE_PUBLIC_HEADERS})
+ pargs.h
+ )
if (BUILD_TESTING)
add_subdirectory(tests)
set(LIBGROMACS_SOURCES
${LIBGROMACS_SOURCES} ${FFT_SOURCES} ${FFT_SPECIFIC_SOURCES} PARENT_SCOPE)
-set(FFT_PUBLIC_HEADERS
- fft.h)
-gmx_install_headers(fft ${FFT_PUBLIC_HEADERS})
+gmx_install_headers(fft.h)
if (BUILD_TESTING)
add_subdirectory(tests)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${FILEIO_SOURCES} PARENT_SCOPE)
-set(FILEIO_PUBLIC_HEADERS
+gmx_install_headers(
confio.h
enxio.h
filenm.h
xtcio.h
xvgr.h
)
-gmx_install_headers(fileio ${FILEIO_PUBLIC_HEADERS})
if (GMX_USE_TNG AND TNG_IO_DEFINITIONS)
set_property(SOURCE tngio.cpp
file(GLOB GMXANA_SOURCES *.c *.cpp)
-set(GMXANA_PUBLIC_HEADERS
+gmx_install_headers(
gstat.h
)
-gmx_install_headers(gmxana ${GMXANA_PUBLIC_HEADERS})
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXANA_SOURCES} PARENT_SCOPE)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2012,2013,2014, by the GROMACS development team, led by
+# 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.
# the research papers on the package. Check out http://www.gromacs.org.
# includes: Nothing to build, just installation
-file(GLOB ROOT_LEGACY_HEADERS *.h)
-file(GLOB ROOT_LEGACY_HEADERS_PRIVATE thread_mpi.h tmpi.h gmx_hash.h
- gmx_ga2la.h gpu_utils.h pmalloc_cuda.h)
-file(GLOB TYPES_LEGACY_HEADERS types/*.h)
-file(GLOB TYPES_LEGACY_HEADERS_PRIVATE types/commrec.h)
-list(REMOVE_ITEM ROOT_LEGACY_HEADERS ${ROOT_LEGACY_HEADERS_PRIVATE})
-list(REMOVE_ITEM TYPES_LEGACY_HEADERS ${TYPES_LEGACY_HEADERS_PRIVATE})
-gmx_install_headers(legacyheaders ${ROOT_LEGACY_HEADERS})
-gmx_install_headers(legacyheaders/types ${TYPES_LEGACY_HEADERS})
+file(GLOB HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
+list(REMOVE_ITEM HEADERS gmx_hash.h gmx_ga2la.h gpu_utils.h pmalloc_cuda.h)
+gmx_install_headers(${HEADERS})
+
+add_subdirectory(types)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-function (generate_installed_file_list SRCDIR BUILDDIR OUTFILE)
- file(GLOB_RECURSE INSTALL_FILE_LIST "${BUILDDIR}/cmake_install.cmake")
- set(MATCH_REGEX "(${SRCDIR}|${BUILDDIR})/.*\\.h")
- set(HEADER_LIST)
- foreach (INSTALL_FILE ${INSTALL_FILE_LIST})
- file(STRINGS ${INSTALL_FILE} HEADER_LINES REGEX "${MATCH_REGEX}")
- foreach (HEADER_LINE ${HEADER_LINES})
- string (REGEX MATCH "${MATCH_REGEX}" HEADER "${HEADER_LINE}")
- list(APPEND HEADER_LIST "${HEADER}")
- endforeach ()
- endforeach ()
- string(REPLACE ";" "\n" HEADER_LIST "${HEADER_LIST}")
- file(WRITE ${OUTFILE} "${HEADER_LIST}")
-endfunction ()
-
-if (NOT DEFINED SRCDIR OR NOT DEFINED BUILDDIR OR NOT DEFINED OUTFILE)
- message(FATAL_ERROR "Required input variable (SRCDIR, BUILDDIR, OUTFILE) not set")
-endif ()
-generate_installed_file_list(${SRCDIR} ${BUILDDIR} ${OUTFILE})
+# 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})
set(LIBGROMACS_SOURCES
${LIBGROMACS_SOURCES} ${LINEARALGEBRA_SOURCES} PARENT_SCOPE)
-set(LINEARALGEBRA_PUBLIC_HEADERS
+gmx_install_headers(
eigensolver.h
matrix.h
- sparsematrix.h)
-gmx_install_headers(linearalgebra ${LINEARALGEBRA_PUBLIC_HEADERS})
+ sparsematrix.h
+ )
file(GLOB LISTED_FORCES_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${LISTED_FORCES_SOURCES} PARENT_SCOPE)
-set(LISTED_FORCES_PUBLIC_HEADERS
- bonded.h)
-
-gmx_install_headers(listed-forces ${LISTED_FORCES_PUBLIC_HEADERS})
+gmx_install_headers(
+ bonded.h
+ )
if (BUILD_TESTING)
# add_subdirectory(tests)
file(GLOB MATH_SOURCES *.cpp *.c)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${MATH_SOURCES} PARENT_SCOPE)
-set(MATH_PUBLIC_HEADERS
+gmx_install_headers(
3dtransforms.h
gmxcomplex.h
do_fit.h
vec.h
vectypes.h
)
-gmx_install_headers(math ${MATH_PUBLIC_HEADERS})
if (BUILD_TESTING)
# add_subdirectory(tests)
file(GLOB OPTIONS_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${OPTIONS_SOURCES} PARENT_SCOPE)
-set(OPTIONS_PUBLIC_HEADERS
+gmx_install_headers(
abstractoption.h
basicoptions.h
filenameoption.h
optionfiletype.h
optionflags.h
options.h
- timeunitmanager.h)
-gmx_install_headers(options ${OPTIONS_PUBLIC_HEADERS})
+ timeunitmanager.h
+ )
if (BUILD_TESTING)
add_subdirectory(tests)
file(GLOB PBCUTIL_SOURCES *.cpp *.c)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PBCUTIL_SOURCES} PARENT_SCOPE)
-set(PBCUTIL_PUBLIC_HEADERS
+gmx_install_headers(
ishift.h
pbc.h
- rmpbc.h)
-
-gmx_install_headers(pbcutil ${PBCUTIL_PUBLIC_HEADERS})
+ rmpbc.h
+ )
if (BUILD_TESTING)
# add_subdirectory(tests)
file(GLOB SELECTION_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${SELECTION_SOURCES} PARENT_SCOPE)
-set(SELECTION_PUBLIC_HEADERS
+gmx_install_headers(
nbsearch.h
indexutil.h
position.h
selectioncollection.h
selectionenums.h
selectionoption.h
- selectionoptionmanager.h)
-gmx_install_headers(selection ${SELECTION_PUBLIC_HEADERS})
+ selectionoptionmanager.h
+ )
if (BUILD_TESTING)
add_subdirectory(tests)
file(GLOB SWAP_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${SWAP_SOURCES} PARENT_SCOPE)
-gmx_install_headers(swap enums.h)
+gmx_install_headers(enums.h)
file(GLOB TIMING_SOURCES *.cpp *.c)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TIMING_SOURCES} PARENT_SCOPE)
-set(TIMING_PUBLIC_HEADERS
+gmx_install_headers(
wallcycle.h
- walltime_accounting.h)
-
-gmx_install_headers(timing ${TIMING_PUBLIC_HEADERS})
+ walltime_accounting.h
+ )
if (BUILD_TESTING)
# add_subdirectory(tests)
file(GLOB TOOLS_SOURCES *.cpp *.c)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOOLS_SOURCES} PARENT_SCOPE)
-set(TOOLS_PUBLIC_HEADERS
- )
-gmx_install_headers(tools ${TOOLS_PUBLIC_HEADERS})
-
if (BUILD_TESTING)
# add_subdirectory(tests)
endif()
file(GLOB TOPOLOGY_SOURCES *.cpp *.c)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOPOLOGY_SOURCES} PARENT_SCOPE)
-set(TOPOLOGY_PUBLIC_HEADERS
+gmx_install_headers(
atomprop.h
atoms.h
block.h
index.h
mtop_util.h
symtab.h
- topology.h)
-
-gmx_install_headers(topology ${TOPOLOGY_PUBLIC_HEADERS})
+ topology.h
+ )
if (BUILD_TESTING)
# add_subdirectory(tests)
file(GLOB TRAJECTORYANALYSIS_SOURCES *.cpp modules/*.cpp modules/*.c)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TRAJECTORYANALYSIS_SOURCES} PARENT_SCOPE)
-set(TRAJECTORYANALYSIS_PUBLIC_HEADERS
+gmx_install_headers(
analysismodule.h
analysissettings.h
- cmdlinerunner.h)
-gmx_install_headers(trajectoryanalysis ${TRAJECTORYANALYSIS_PUBLIC_HEADERS})
+ cmdlinerunner.h
+ )
if (BUILD_TESTING)
add_subdirectory(tests)
file(GLOB UTILITY_SOURCES *.c *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
-set(UTILITY_PUBLIC_HEADERS
+gmx_install_headers(
arrayref.h
basedefinitions.h
cstringutil.h
smalloc.h
stringutil.h
)
-gmx_install_headers(utility ${UTILITY_PUBLIC_HEADERS})
if (BUILD_TESTING)
add_subdirectory(tests)