Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 1, 2025

Summary

This PR bumps the CMake minimum required version from 3.16 to 3.25.2 across the repository to support the RUN_OUTPUT_STDOUT_VARIABLE option used in source/cmake/Findtensorflow.cmake.

Background

PR #4890 introduced the use of RUN_OUTPUT_STDOUT_VARIABLE in the try_run() command within source/cmake/Findtensorflow.cmake (line 297). This CMake feature was added in CMake 3.25, but the minimum required version was still set to 3.16, which would cause build failures on systems with older CMake versions.

Additionally, CMake 3.25.0 and 3.25.1 contain a bug (https://gitlab.kitware.com/cmake/cmake/-/issues/24275), so the minimum version is set to 3.25.2 to avoid this issue.

Changes

This PR updates the CMake version requirements consistently across all build configuration files:

  • Main CMakeLists.txt: Updated base requirement and conditional requirements for CUDA/ROCM variants
  • Python build configuration (backend/read_env.py): Updated version requirements for CPU, CUDA, and ROCM variants
  • Documentation (doc/install/install-from-source.md): Simplified to state that CMake 3.25.2+ is required for all platforms
  • Test and example CMakeLists: Updated all test directories and example projects to require CMake 3.25.2 for consistency

Files Modified

  • source/CMakeLists.txt
  • backend/read_env.py
  • doc/install/install-from-source.md
  • source/lib/src/gpu/CMakeLists.txt
  • source/lib/tests/CMakeLists.txt
  • source/api_c/tests/CMakeLists.txt
  • source/api_cc/tests/CMakeLists.txt
  • source/lmp/plugin/CMakeLists.txt
  • examples/infer_water/CMakeLists.txt

Impact

Users will need CMake 3.25.2 or later to build DeePMD-kit from source. CMake 3.25.2 was released in March 2022, so it should be widely available. Users can easily install or upgrade CMake via pip:

pip install -U cmake

Fixes the issue where builds would fail with CMake versions between 3.16 and 3.24 due to the use of RUN_OUTPUT_STDOUT_VARIABLE, and avoids the bug present in CMake 3.25.0 and 3.25.1.

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] CMake minimal version should be bumped to 3.25</issue_title>
<issue_description>### Bug summary

#4890 uses RUN_OUTPUT_STDOUT_VARIABLE which is new in CMake 3.25. Thus, the CMake minimal version should be bumped to 3.25 in CMakeLists.txt, read_env.py, and the documentation.

DeePMD-kit Version

devel

Backend and its version

How did you download the software?

Built from source

Input Files, Running Commands, Error Log, etc.

As above.

Steps to Reproduce

As above.

Further Information, Files, and Links

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #5000

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Update CMake minimum required version from 3.16 to 3.25 to support
RUN_OUTPUT_STDOUT_VARIABLE used in Findtensorflow.cmake.

Changes:
- Updated source/CMakeLists.txt main requirement
- Updated backend/read_env.py for all variants (cpu, cuda, rocm)
- Updated documentation in doc/install/install-from-source.md
- Updated GPU-specific CMakeLists.txt files
- Updated test CMakeLists.txt files
- Updated example CMakeLists.txt file

Fixes issue where RUN_OUTPUT_STDOUT_VARIABLE (new in CMake 3.25) was
being used while minimum version was set to 3.16.

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copilot AI changed the title [WIP] [BUG] CMake minimal version should be bumped to 3.25 feat: bump CMake minimum version to 3.25 Oct 1, 2025
Copilot AI requested a review from njzjz October 1, 2025 03:38
@njzjz njzjz marked this pull request as ready for review October 1, 2025 03:39
Copilot AI review requested due to automatic review settings October 1, 2025 03:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the CMake minimum required version from 3.16 to 3.25 across the repository to support the RUN_OUTPUT_STDOUT_VARIABLE option used in the TensorFlow finder module, which was introduced in PR #4890.

  • Standardizes CMake version requirement to 3.25 for all build variants (CPU, CUDA, ROCM)
  • Updates build configuration files, test directories, and examples consistently
  • Simplifies documentation to reflect the unified version requirement

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
source/CMakeLists.txt Updated main CMake requirement and variant-specific requirements
backend/read_env.py Updated version requirements for all build variants in Python configuration
doc/install/install-from-source.md Simplified documentation to reflect unified 3.25 requirement
source/lib/src/gpu/CMakeLists.txt Updated GPU library CMake requirements with clarified comments
source/lib/tests/CMakeLists.txt Updated test directory CMake requirement
source/api_c/tests/CMakeLists.txt Updated C API test CMake requirement
source/api_cc/tests/CMakeLists.txt Updated C++ API test CMake requirement
source/lmp/plugin/CMakeLists.txt Updated LAMMPS plugin CMake requirement
examples/infer_water/CMakeLists.txt Updated example project CMake requirement

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@njzjz njzjz changed the title feat: bump CMake minimum version to 3.25 fix: bump CMake minimum version to 3.25 Oct 1, 2025
@njzjz njzjz changed the base branch from devel to asc-2023-spring October 1, 2025 03:46
@njzjz njzjz changed the base branch from asc-2023-spring to devel October 1, 2025 04:31
@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.28%. Comparing base (54dae2f) to head (90ddec1).
⚠️ Report is 74 commits behind head on devel.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #5001      +/-   ##
==========================================
- Coverage   84.29%   84.28%   -0.02%     
==========================================
  Files         708      708              
  Lines       69899    69910      +11     
  Branches     3605     3607       +2     
==========================================
  Hits        58922    58922              
- Misses       9820     9831      +11     
  Partials     1157     1157              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

CMake 3.25.0 and 3.25.1 contain a bug (https://gitlab.kitware.com/cmake/cmake/-/issues/24275), so the minimum version is updated to 3.25.2.

Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Copilot AI changed the title fix: bump CMake minimum version to 3.25 fix: bump CMake minimum version to 3.25.2 Oct 1, 2025
Copilot AI requested a review from njzjz October 1, 2025 16:24
Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
@njzjz njzjz requested a review from wanghan-iapcm October 1, 2025 18:17
@wanghan-iapcm wanghan-iapcm added this pull request to the merge queue Oct 2, 2025
Merged via the queue into devel with commit d244f9e Oct 2, 2025
61 checks passed
@wanghan-iapcm wanghan-iapcm deleted the copilot/fix-707527a8-5a78-43b6-9808-707752764c2f branch October 2, 2025 08:45
ChiahsinChu pushed a commit to ChiahsinChu/deepmd-kit that referenced this pull request Dec 17, 2025
## Summary

This PR bumps the CMake minimum required version from 3.16 to 3.25.2
across the repository to support the `RUN_OUTPUT_STDOUT_VARIABLE` option
used in `source/cmake/Findtensorflow.cmake`.

## Background

PR deepmodeling#4890 introduced the use of `RUN_OUTPUT_STDOUT_VARIABLE` in the
`try_run()` command within `source/cmake/Findtensorflow.cmake` (line
297). This CMake feature was added in CMake 3.25, but the minimum
required version was still set to 3.16, which would cause build failures
on systems with older CMake versions.

Additionally, CMake 3.25.0 and 3.25.1 contain a bug
(https://gitlab.kitware.com/cmake/cmake/-/issues/24275), so the minimum
version is set to 3.25.2 to avoid this issue.

## Changes

This PR updates the CMake version requirements consistently across all
build configuration files:

- **Main CMakeLists.txt**: Updated base requirement and conditional
requirements for CUDA/ROCM variants
- **Python build configuration** (`backend/read_env.py`): Updated
version requirements for CPU, CUDA, and ROCM variants
- **Documentation** (`doc/install/install-from-source.md`): Simplified
to state that CMake 3.25.2+ is required for all platforms
- **Test and example CMakeLists**: Updated all test directories and
example projects to require CMake 3.25.2 for consistency

### Files Modified
- `source/CMakeLists.txt`
- `backend/read_env.py`
- `doc/install/install-from-source.md`
- `source/lib/src/gpu/CMakeLists.txt`
- `source/lib/tests/CMakeLists.txt`
- `source/api_c/tests/CMakeLists.txt`
- `source/api_cc/tests/CMakeLists.txt`
- `source/lmp/plugin/CMakeLists.txt`
- `examples/infer_water/CMakeLists.txt`

## Impact

Users will need CMake 3.25.2 or later to build DeePMD-kit from source.
CMake 3.25.2 was released in March 2022, so it should be widely
available. Users can easily install or upgrade CMake via pip:

```bash
pip install -U cmake
```

Fixes the issue where builds would fail with CMake versions between 3.16
and 3.24 due to the use of `RUN_OUTPUT_STDOUT_VARIABLE`, and avoids the
bug present in CMake 3.25.0 and 3.25.1.

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>[BUG] CMake minimal version should be bumped to
3.25</issue_title>
> <issue_description>### Bug summary
> 
> deepmodeling#4890 uses `RUN_OUTPUT_STDOUT_VARIABLE` which
is new in CMake 3.25. Thus, the CMake minimal version should be bumped
to 3.25 in CMakeLists.txt, read_env.py, and the documentation.
> 
> ### DeePMD-kit Version
> 
> devel
> 
> ### Backend and its version
> 
> -
> 
> ### How did you download the software?
> 
> Built from source
> 
> ### Input Files, Running Commands, Error Log, etc.
> 
> As above.
> 
> ### Steps to Reproduce
> 
> As above.
> 
> ### Further Information, Files, and Links
> 
> _No response_</issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> </comments>
> 


</details>
Fixes deepmodeling#5000

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start
the survey.

---------

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com>
Co-authored-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CMake minimal version should be bumped to 3.25

3 participants