Skip to content

Centralize Rust build logic into RustBuild.cmake - #8536

Open
bdash wants to merge 1 commit into
devfrom
test_rust_cmake
Open

Centralize Rust build logic into RustBuild.cmake#8536
bdash wants to merge 1 commit into
devfrom
test_rust_cmake

Conversation

@bdash

@bdash bdash commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Each Rust crate now calls bn_add_rust_crate to configure its build, greatly reducing the amount of boilerplate.

This CMake function discovers dependencies on other crates within the repository and generates the appropriate CMake dependencies. The build invocation for crates within the same workspace are combined where possible (i.e., no custom cargo flags are required) in order to allow dependencies to be reused and to improve scheduling efficiency.

Static library variants of crates are generated when needed (static-only targets, or targets that are statically linked for demo builds), removing the need to maintain custom static variants of crates. Static libraries are merged into a static umbrella crate to avoid the duplicate symbol errors related to the Rust standard library that would otherwise occur when linking multiple static crates into the same binary.

Each Rust crate now calls `bn_add_rust_crate` to configure its build,
greatly reducing the amount of boilerplate.

This CMake function discovers dependencies on other crates within the
repository and generates the appropriate CMake dependencies. The build
invocation for crates within the same workspace are combined where
possible (i.e., no custom cargo flags are required) in order to allow
dependencies to be reused and to improve scheduling efficiency.

Static library variants of crates are generated when needed (static-only
targets, or targets that are statically linked for demo builds),
removing the need to maintain custom static variants of crates. Static
libraries are merged into a static umbrella crate to avoid the duplicate
symbol errors related to the Rust standard library that would otherwise
occur when linking multiple static crates into the same binary.
@emesare
emesare self-requested a review September 9, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant