Project

General

Profile

Bug #991

gmx_header_config.h should not be configured in the source folder

Added by Roland Schulz over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
build system
Target version:
Affected version - extra info:
only 5.0 dev versions
Affected version:
Difficulty:
uncategorized
Close

Description

Currently gmx_header_config.h is created in the source folder. The problem is that this causes problems with more than one binary folder with different values and thus different versions of gmx_header_config.h. One configuration just overwrites the one of the other build and thus the next compile of the first build will be wrong. The reason it is currently placed in the source folder is to allow relative include before install. I can't think of any simple way to make relative paths and multiple binary folders work. I think it is more important that it gives the correct result with more than one binary folder and thus I suggest to place it in the folder and don't use relative include paths. The only idea to support both would be to always first install copy all headers (including gmx_header_config.h) into ${CMAKE_BINARY_DIR}/include and then use that as include_directories. Is that a good idea? Any other suggestion?

Associated revisions

Revision c20969c3 (diff)
Added by Teemu Murtola over 7 years ago

Improve the build system for gmx_header_config.h.

- Configure gmx_header_config.h in the binary directory to make it work
with multiple coexisting binary directories.
- Or rather, configure a gmx_header_config_gen.h there, and include it
using a relative path from a fixed gmx_header_config.h. Add location
of the generated file to include path. This makes relative include
paths still work in the source, as headers can continue to include
gmx_header_config.h, which is still in the source tree.
- Add Doxygen comments for the files, with an explicit todo item to try
to get rid of the CMake-generated defines (or even better, all of
them).
- Make config.h include gmx_header_config.h to make it easier (and less
error-prone) to move stuff between these two headers. Remove
unnecessary (after this change) #includes for gmx_header_config.h
from source files.

Fixes #991.

Change-Id: Ib9686356c681b8fd2cce34511557566c9f4d20a2

History

#1 Updated by Teemu Murtola over 7 years ago

  • Subject changed from gmx_header_config.h to gmx_header_config.h should not be configured in the source folder
  • Assignee set to Teemu Murtola
  • Target version set to 5.0

https://gerrit.gromacs.org/#/c/1274/ should fix this while still allowing the use of relative include paths. That change also adds a todo item in the comments to get rid of the headers altogether (and in particular of the CMake-generated part, because that may generate similar issues if there is more than one Gromacs library installed with just one set of headers), but that may be difficult with GMX_CXX11 unless we just go with boost::shared_ptr as the smart pointer type in all public interfaces. But that is outside the scope of this bug report

#2 Updated by Teemu Murtola over 7 years ago

  • Status changed from New to Closed

#3 Updated by Teemu Murtola almost 6 years ago

  • Project changed from Source code reorganization to GROMACS
  • Category set to build system
  • Affected version - extra info set to only 5.0 dev versions
  • Affected version set to 5.0

Also available in: Atom PDF