Major Cmake / C++ include refactor#191
Open
scal444 wants to merge 4 commits into
Open
Conversation
Switch every project-local #include "..." to use the path relative to the
repository root, e.g.
#include "src/forcefields/mmff.h"
#include "rdkit_extensions/mmff_flattened_builder.h"
#include "tests/test_utils.h"
Bare neighbor includes ("foo.h"), upward-relative includes ("../foo.h"), and
angle-bracket project-local includes (<foo.h>) are no longer accepted.
Mechanism:
- Add an INTERFACE library nvmolkit_include_root (in the root CMakeLists.txt)
that exports ${PROJECT_SOURCE_DIR} as its include path. A single
link_libraries(nvmolkit_include_root) just before the project subdirectories
applies it to every first-party target.
- Drop the previous per-target target_include_directories(...
${CMAKE_CURRENT_SOURCE_DIR}) and ${PROJECT_SOURCE_DIR}/... entries that
existed only to expose project headers via library include dirs. They are
now redundant.
- Drop a couple of dead include paths (nvmolkit/utils does not exist;
smarts_filter no longer needs ${PROJECT_SOURCE_DIR}/src once the include
rewrite happens).
Add admin/run_include_check.sh + admin/include_check.py to enforce the
policy. Default mode rewrites in place, -d / --check mode reports violations
and exits non-zero. Wired into .github/workflows/lint.yml as a new
include-check job alongside clang-format, cmake-format, and ruff-format.
Configure, build, and ctest pass.
evasnow1992
reviewed
Jun 1, 2026
| ) | ||
| if rewritten is None: | ||
| # Already-correct quoted form, system include, or third-party. | ||
| if close_char == ">" and rewritten is None and reason is None: |
Collaborator
There was a problem hiding this comment.
rewritten is None this line seems to be redundant given it's inside the if block from line 189
evasnow1992
approved these changes
Jun 1, 2026
Collaborator
evasnow1992
left a comment
There was a problem hiding this comment.
One minor comment. Other changes look good to me. thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removed all of our manual in-tree include CMake code. All includes are now relative to the project root, with most of them under
src/.Added a new formatter checker to CI to avoid backslide.