Skip to content

CMake cleanup (step 1) - #8304

Merged
mohanchen merged 5 commits into
deepmodeling:developfrom
Growl1234:cmake
Nov 23, 2026
Merged

mohanchen merged 5 commits into
deepmodeling:developfrom
Growl1234:cmake

Conversation

@Growl1234

@Growl1234 Growl1234 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator
  • Drop legacy option deprecation logic; those deprecated options are now not recognized anymore.
  • Re-order CMake options to make this part look clearer.
  • Drop GIT_SUBMODULES options as it's not used anywhere.
  • Fix MKL linking in pyabacus CMake (use abacus::mkl)
  • Use CMake's built-in FindLAPACK directly, including BLAS discovery. LAPACK::LAPACK target is available since CMake version 3.18.

The next steps will be done with a purpose of minimzing the use of custom helpers and definitions, e.g. _abacus_feature_definitions, abacus_add_target_compile_requirements etc. This would require:

  • All dependency linking are target-based (what my next CMake PR will do)
  • Bump the minimal required version of CMake. Since ABACUS source tree and CMake handling is rather deep and complicated, this cmake_minimum_required() version bump would be substantial in order to meet the expectation (3.24+; most likely 3.27 to take use of compile context which will replace abacus_add_target_compile_requirements entirely)

This cleanup series is expected to be completed before the official 3.11 release.

@Growl1234 Growl1234 added the Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS label Nov 9, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generic BLAS/LAPACK discovery change drops a still-documented custom-path interface; please preserve it or provide an explicit migration.

Reviewed 6a3819b0de42 against 27c3e1065bfe through static source tracing, including affected CMake callers and CMake 3.18.6 finder contracts. git diff --check passed; configuration, builds, tests, and CI results remain unverified.

Non-blocking: Please add the exact verification commands and outcomes to the PR description, noting whether the pyabacus MKL path was exercised and which checks remain unrun.

Comment thread CMakeLists.txt Resolved
Comment thread python/pyabacus/CMakeLists.txt Resolved

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The obsolete arguments leave unused path settings in the four build helpers; the cleanup is noted inline.

Reviewed the 6a3819b0de42 → 4d16dcfdcba3 increment statically. git diff --check and the trusted governance check passed; configuration, builds, tests, and CI remain unverified.

Comment thread toolchain/build_abacus_gnu.sh Resolved

@Cstandardlib Cstandardlib left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup.
I suggest documenting major incompatible build-option changes in a section of release notes or installation guide for a while, listing the deprecated options and their replacements as more CMake cleanup PRs are planned, so the users can easily migrate from unsupported options.

@mohanchen
mohanchen merged commit b9047f3 into deepmodeling:develop Nov 23, 2026
24 checks passed
@mohanchen mohanchen added the Refactor Refactor ABACUS codes label Nov 23, 2026
mohanchen pushed a commit that referenced this pull request Nov 26, 2026
…and checker rules (#8374)

* Governance: add CMake build guidelines, diff-scoped cmake-format CI, and checker rules

Recent CMake modernization (#7584, #7671, #7695, #8161, #8181-#8188, #8304)
established clear target-based layering, feature-macro conventions, and
formatting, but left those conventions undocumented and unenforced on new PRs.

This change adds the documentation and automated governance gates:

- Add `docs/developers_guide/cmake_guidelines.md` (wired into
  `docs/developers_guide/index.rst`) documenting the four-layer build
  boundaries, forbidden legacy patterns, and standard templates for external
  dependencies, submodules, and unit tests.
- Add rule 24 to `AGENTS.md`, update the rule grading matrix in
  `docs/developers_guide/agent_governance.md`, and synchronize
  `.coderabbit.yaml` and `.github/instructions/abacus-governance.instructions.md`.
- Add a diff-scoped blocking `cmake-format` job for pull requests in
  `.github/workflows/precommit.yml` while keeping the repo-wide `pre-commit`
  rollout job non-blocking.
- Extend `tools/03_code_analysis/agent_governance_check.py` (with 10 new unit
  tests in `tools/03_code_analysis/test_agent_governance_check.py`) to check
  diff-added CMake lines for:
  - removed/deprecated patterns (`${math_libs}`, `USE_LIBXC`,
    `ENABLE_RAPIDJSON`, `ENABLE_LIBCOMM`, `remove_definitions()`);
  - directory-scoped compile/include/link commands and `find_package()` /
    `find_library()` under `source/`;
  - legacy `install()` and `file(COPY ...)` staging in unit-test CMake files;
  - newly added root options or `cmake/modules/*.cmake` files missing a
    corresponding `cmake/CollectBuildInfoVars.cmake` update (warning).

* Fix CMake governance parsing and review regressions

* Docs: mark abacus_disable_feature_definitions as discouraged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compile & CICD & Docs & Dependencies Issues related to compiling ABACUS Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants