[PR #1630] [MERGED] [IMPROVEMENT] Use Corrosion to build Rust code #2341

Closed
opened 2026-01-29 17:21:37 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1630
Author: @emilazy
Created: 8/1/2024
Status: Merged
Merged: 8/12/2024
Merged by: @PunitLodha

Base: masterHead: push-rozmtsmxykmp


📝 Commits (2)

  • 6d6537c [IMPROVEMENT] Use Corrosion to build Rust code
  • 741b7d5 Merge branch 'master' into push-rozmtsmxykmp

📊 Changes

3 files changed (+36 additions, -44 deletions)

View changed files

📝 docs/CHANGES.TXT (+1 -0)
📝 src/CMakeLists.txt (+4 -4)
📝 src/rust/CMakeLists.txt (+31 -40)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.
  • I have mentioned this change in the changelog.

My familiarity with the project is as follows (check one):

  • I have never used CCExtractor.
  • I have used CCExtractor just a couple of times.
  • I absolutely love CCExtractor, but have not contributed previously.
  • I am an active contributor to CCExtractor.

Currently, using the CMake Ninja generator fails when Rust code is enabled, because the dependencies and outputs of the Rust code compilation are not fully declared. I tried to fix this with the BYPRODUCTS feature, but it seemed like it wouldn’t really work. Instead, I ported the Rust build to Corrosion, which is a CMake package designed to integrate CMake and Cargo. Corrosion is used by other projects that combine C++ and Rust, like the work‐in‐progress Rust port of the fish shell. Now people can get faster, more reliable builds using Ninja, and the CMake code is simpler and cleaner.

Developers and users do not need to explicitly install Corrosion, thanks to CMake’s FetchContent feature. However, if Corrosion is installed on the system, that version will be used.

I bumped the minimum CMake requirement to 3.15.0, as Corrosion requires this version and CMake was warning that compatibility for versions as old as the current declaration will be removed in the future. However, if this is not desired, I could lower it back down so that users on older versions of CMake can still build the project as long as they disable Rust, and the policy_max argument of cmake_minimum_required could be used to fix the warning.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1630 **Author:** [@emilazy](https://github.com/emilazy) **Created:** 8/1/2024 **Status:** ✅ Merged **Merged:** 8/12/2024 **Merged by:** [@PunitLodha](https://github.com/PunitLodha) **Base:** `master` ← **Head:** `push-rozmtsmxykmp` --- ### 📝 Commits (2) - [`6d6537c`](https://github.com/CCExtractor/ccextractor/commit/6d6537cf110ded38688f75ed3a437dd487d9af8e) [IMPROVEMENT] Use Corrosion to build Rust code - [`741b7d5`](https://github.com/CCExtractor/ccextractor/commit/741b7d557ebe9f165353d65ce6a70e407dfd5b42) Merge branch 'master' into push-rozmtsmxykmp ### 📊 Changes **3 files changed** (+36 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `docs/CHANGES.TXT` (+1 -0) 📝 `src/CMakeLists.txt` (+4 -4) 📝 `src/rust/CMakeLists.txt` (+31 -40) </details> ### 📄 Description <!-- Please prefix your pull request with one of the following: **[FEATURE]** **[FIX]** **[IMPROVEMENT]**. --> **In raising this pull request, I confirm the following (please check boxes):** - [x] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [x] I have checked that another pull request for this purpose does not exist. - [x] I have considered, and confirmed that this submission will be valuable to others. - [x] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [x] I give this submission freely, and claim no ownership to its content. - [x] **I have mentioned this change in the [changelog](https://github.com/CCExtractor/ccextractor/blob/master/docs/CHANGES.TXT).** **My familiarity with the project is as follows (check one):** - [ ] I have never used CCExtractor. - [x] I have used CCExtractor just a couple of times. - [ ] I absolutely love CCExtractor, but have not contributed previously. - [ ] I am an active contributor to CCExtractor. --- Currently, using the CMake Ninja generator fails when Rust code is enabled, because the dependencies and outputs of the Rust code compilation are not fully declared. I tried to fix this with the `BYPRODUCTS` feature, but it seemed like it wouldn’t really work. Instead, I ported the Rust build to [Corrosion](https://github.com/corrosion-rs/corrosion), which is a CMake package designed to integrate CMake and Cargo. Corrosion is used by other projects that combine C++ and Rust, like the work‐in‐progress Rust port of the [fish shell](https://github.com/fish-shell/fish-shell). Now people can get faster, more reliable builds using Ninja, and the CMake code is simpler and cleaner. Developers and users do not need to explicitly install Corrosion, thanks to CMake’s `FetchContent` feature. However, if Corrosion is installed on the system, that version will be used. I bumped the minimum CMake requirement to 3.15.0, as Corrosion requires this version and CMake was warning that compatibility for versions as old as the current declaration will be removed in the future. However, if this is not desired, I could lower it back down so that users on older versions of CMake can still build the project as long as they disable Rust, and the `policy_max` argument of [`cmake_minimum_required`](https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html) could be used to fix the warning. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:21:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2341