Skip to content

Conversation

namanlp
Copy link
Contributor

@namanlp namanlp commented Aug 28, 2025

This PR is continuation of my work on GSoC Project : Build Script Delegation

What does this PR try to resolve?

Through this PR, I want the user to be able to access each build script's OUT_DIR.

How to test and review this PR?

There is a feature gate multiple-build-scripts that can be passed via cargo-features in Cargo.toml. So, you have to add

cargo-features = ["multiple-build-scripts"]

Preferably on the top of the Cargo.toml and use nightly toolchain to use the feature

Then, you can access the OUT_DIR of given build script by accessing it like a compile time environment variable, for example:

const BUILD1_OUT_DIR: &'static str = env!("BUILD1_OUT_DIR");
const BUILD2_OUT_DIR: &'static str = env!("BUILD2_OUT_DIR");

fn main() {
    println!("{}", BUILD1_OUT_DIR);
    println!("{}", BUILD2_OUT_DIR);
}

@namanlp namanlp force-pushed the multiple-build-scripts-4 branch from 75ff71c to 0d5b7b0 Compare August 28, 2025 14:50
@rustbot rustbot added the A-build-scripts Area: build.rs scripts label Aug 28, 2025
@namanlp namanlp force-pushed the multiple-build-scripts-4 branch 2 times, most recently from abc9c9c to c0d23d2 Compare September 6, 2025 10:48
@namanlp namanlp force-pushed the multiple-build-scripts-4 branch from c0d23d2 to 6c8bc08 Compare September 7, 2025 12:37
@rustbot rustbot added the A-build-execution Area: anything dealing with executing the compiler label Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants